Hot answers tagged

7

The command is called :diffthis. It must be executed in every window you want to add to the comparison. The inverse is :diffoff which exits diff mode in the current window. To exit diff mode in all applicable windows add a bang: :diffoff!.


7

You can do this with the vim-gitgutter plugin. If you're not using git, then Signify has a similar feature. After installing vim-gitgutter, you can switch the highlighting on and off with the following commands: turn on with :GitGutterLineHighlightsEnable turn off with :GitGutterLineHighlightsDisable toggle with :GitGutterLineHighlightsToggle. Or, to ...


4

If your vim supports diff mode (which is in most cases), there is no difference. There is a minor difference though, if your vim is compiled without the +diff feature, vimdiff a b will produce the error message: This Vim was not compiled with the diff feature. However, vim -d a b will silently accept without entering diff mode. Unless you are on amiga, ...


3

The vim binary is able to answer by many names and it will tweak its behavior based on which name it is called. This is a somewhat common practice in Unix, where a program will support checking the name by which it's invoked and will behave differently depending on that name. At installation time, a single binary will be copied, but symbolic links or ...


3

For NeoVim, you can setup your ~/.gitconfig with the following commands git config --global merge.tool nvim git config --global mergetool.keepBackup false git config --global mergetool.nvim.cmd $'nvim -d $LOCAL $REMOTE $MERGED -c \'$wincmd w\' -c \'wincmd J\'' Your ~/.gitconfig should then look like: [merge] tool = nvim [mergetool] keepBackup = ...


2

I remembered that I can load vim without any vimrc file using this command, which made the problem disappear. gvimdiff -u NONE file1 file2 I went to my vimrc and commented out the first 30 lines, then the first 60 lines, and so on until the problem disappeared. The offending line in my vimrc was cd c:\a\b. (I'm using dummy names for the file system of course....


2

Extending Ingo Karkat's solution to terminal, hi DiffAdd ctermfg=NONE ctermbg=Green hi DiffChange ctermfg=NONE ctermbg=NONE hi DiffDelete ctermfg=LightBlue ctermbg=Red hi DiffText ctermfg=Yellow ctermbg=Red Below are the cterm-colors, if you want to add your preferred color instead of the ones I used. NR-16 ...


1

By default vim -d (at least my version, 7.4) will open files in vertical mode, i.e. side by side. (This is equivalent to using -O option.) To open files in "stacked" mode, i.e. one below another, add -o option.


1

My vim doesn't use iwhiteeol by default: *'dip'* *'diffopt'* 'diffopt' 'dip' string (default "internal,filler") global {not available when compiled without the |+diff| feature} Option settings for diff mode. It can consist of the following items. All are optional. Items must be ...


1

Before saving a file, I frequently verify changes before saving using: :w !diff - % (diff <memory copy> <original file> Quickly see changes in a simple diff style without changing the file.


Only top voted, non community-wiki answers of a minimum length are eligible