HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

vimdiff — Open up two or more files in vim and show the differences between them. See also: `vim`, `vimtutor`,

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandvimfilestwocliopenvimdiffmore

Problem

How to use the vimdiff command: Open up two or more files in vim and show the differences between them. See also: vim, vimtutor, nvim. More information: <https://www.vim.org/>.

Solution

vimdiff — Open up two or more files in vim and show the differences between them. See also: vim, vimtutor, nvim. More information: <https://www.vim.org/>.

Open two files and show the differences:
vimdiff {{path/to/file1}} {{path/to/file2}}


Move the cursor to the window on the left|right:
<Ctrl w>{{<h>|<l>}}


Jump to the previous difference:
<[><c>


Jump to the next difference:
<]><c>


Copy the highlighted difference from the other window to the current window:
<d><o>


Copy the highlighted difference from the current window to the other window:
<d><p>


Update all highlights and folds:
<:>diffupdate


Toggle the highlighted code fold:
<z><a>

Code Snippets

Open two files and show the differences

vimdiff {{path/to/file1}} {{path/to/file2}}

Move the cursor to the window on the left|right

<Ctrl w>{{<h>|<l>}}

Jump to the previous difference

<[><c>

Jump to the next difference

<]><c>

Copy the highlighted difference from the other window to the current window

<d><o>

Context

tldr-pages: common/vimdiff

Revisions (0)

No revisions yet.