2017-05-15 08:27:16 +12:00
|
|
|
# vimdiff
|
|
|
|
|
2020-12-14 07:03:56 -06:00
|
|
|
> Open up two or more files in vim and show the differences between them.
|
2023-11-23 14:55:03 +01:00
|
|
|
> See also: `vim`, `vimtutor`, `nvim`.
|
2020-12-14 07:03:56 -06:00
|
|
|
> More information: <https://www.vim.org>.
|
2017-05-15 08:27:16 +12:00
|
|
|
|
2020-12-14 07:03:56 -06:00
|
|
|
- Open two files and show the differences:
|
2017-05-15 08:27:16 +12:00
|
|
|
|
2023-11-26 18:01:32 +01:00
|
|
|
`vimdiff {{path/to/file1}} {{path/to/file2}}`
|
2017-05-15 08:27:16 +12:00
|
|
|
|
2020-12-14 07:03:56 -06:00
|
|
|
- Move the cursor to the window on the left|right:
|
2017-05-15 08:27:16 +12:00
|
|
|
|
2025-03-09 03:23:24 +02:00
|
|
|
`<Ctrl w>{{<h>|<l>}}`
|
2017-05-15 08:27:16 +12:00
|
|
|
|
2022-09-07 03:21:44 +02:00
|
|
|
- Jump to the previous difference:
|
2017-05-15 08:27:16 +12:00
|
|
|
|
2025-03-09 03:23:24 +02:00
|
|
|
`<[><c>`
|
2020-12-14 07:03:56 -06:00
|
|
|
|
2022-09-07 03:21:44 +02:00
|
|
|
- Jump to the next difference:
|
2020-12-14 07:03:56 -06:00
|
|
|
|
2025-03-09 03:23:24 +02:00
|
|
|
`<]><c>`
|
2020-12-14 07:03:56 -06:00
|
|
|
|
|
|
|
- Copy the highlighted difference from the other window to the current window:
|
|
|
|
|
2025-03-09 03:23:24 +02:00
|
|
|
`<d><o>`
|
2020-12-14 07:03:56 -06:00
|
|
|
|
|
|
|
- Copy the highlighted difference from the current window to the other window:
|
|
|
|
|
2025-03-09 03:23:24 +02:00
|
|
|
`<d><p>`
|
2020-12-14 07:03:56 -06:00
|
|
|
|
|
|
|
- Update all highlights and folds:
|
|
|
|
|
2025-03-09 03:23:24 +02:00
|
|
|
`<:>diffupdate`
|
2020-12-14 07:03:56 -06:00
|
|
|
|
|
|
|
- Toggle the highlighted code fold:
|
|
|
|
|
2025-03-09 03:23:24 +02:00
|
|
|
`<z><a>`
|