Skip to content

Diffλ︎

Compare differences between different files or between a file and its versions.

:diffsplit filename Neovim command opens a split containing the selected filename, showing a diff comparision to the currently opened file

file path completion helps select the correct file for comparison

nvimdiffλ︎

The Git difftool can specify Neovim as a diff viewer to show Git diff views of all the files that have changes

nvimdiff as a command line option

git difftool --tool=nvimdiff <optional-filename>

git difftool can be configured to use Neovim

Git client config to set nvimdiff as difftool

~/.config/git/config
[diff]
  # Neovim diff tool
  tool = nvimdiff

Run git difftool in the root of the project to show the diff of each changed file.

git difftool <optional-filename>

: q a to close the current diff view. The command line prompts to open the next file as a diff view (assuming there are more files to view).

DiffViewλ︎

DiffView compares working space and staged changes side by side, or a diff for git merge conflicts.

Space g d or d in neogit status buffer (SPC g s) will open diffview in a new tab

[ c to move to previous hunk

] c to move to next hunk

Space g to return to neovim buffer or q to return to neogit status buffer

Ctrl h / j / k / l to navigate between open splits

SPC b toggles the sidebar buffer

SPC w l and SPC w h to move cursor between diff buffer and sidebar buffer

Neovim diffview plugin - side by side view of changes in git for local working directory and staging

  • Green - added lines
  • Yellow - changed line
  • Red - deleted lines