Code Review from the comfort of vim | Diffurcate
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

I often review Pull requests from the browser as it just makes it so easy to see the diffs and navigate through them, but there comes a time when the diffs...

Date: December 4, 2021

I often review Pull requests from the browser as it just makes it so easy to see the diffs and navigate through them, but there comes a time when the diffs get really big and hard to follow. That’s when its time to bring in the comforts of vim.

[4m[38;2;248;248;242mhttps://youtu.be/5NKaZFavM0E[0m

[1m[38;2;189;147;249mPlugins needed[0m
[38;2;68;71;90m──────────────[0m

This all stems from the great plugin by [4m[38;2;248;248;242mAndrewRadev[0m <[38;2;248;248;242mhttps://github.com/AndrewRadev[0m>. It breaks a down into a project. So rather than poping into a pager from [4m[38;2;248;248;242mgit[0m <[38;2;248;248;242m/glossary/git/[0m> diff, you can pipe to diffurcate and it will setup a project in a tmp directory for you and you can browse this project just like any other except it’s just a diff.

[38;2;248;248;242m[code][0m
  Plug 'AndrewRadev/diffurcate.vim'

[1m[38;2;189;147;249mMy aliases[0m
[38;2;68;71;90m──────────[0m

First to quickly checkout PR’s from azure devops I have setup an alias to fuzzy select a pr and let the [38;2;189;147;249maz[0m command do the checkout.

[38;2;248;248;242m[code][0m
  alias azcheckout='az repos pr checkout --id $(az repos pr list --output table | tail -n -2 | fzf | cut -d " " -f1)'

Next I have a few aliases setup for checking diffs. The first one checks what is staged vs the current branch, the others check the current branch vs main or master.

[38;2;248;248;242m[code][0m
  alias diffstaged="git diff --staged | nvim - +Diffurcate '+Telescope find_files'"
  alias diffmain="git diff main.. | nvim - +Diffurcate '+Telescope find_files'"
  alias diffmaster="git diff master.. | nvim - +Diffurcate '+Telescope find_files'"

  diffcommit() {
      git diff $1 | nvim - +Diffurcate '+Telescope find_files'
  }

[1m[38;2;189;147;249mLinks[0m
[38;2;68;71;90m─────[0m

- diffurcte.vim
