arames / vim-diffgofile

Quickly jump to diff locations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a fork of https://github.com/vim-scripts/DiffGoFile, itself a mirror of
the vim script 1888. This repo contains fixes and changes to suit my needs.
Changes include:
- Add the g:diffgofile_goto_existing_buffer option to allow opening diff
  locations in existing buffers.

With vim-plug, use

    Plug 'arames/vim-diffgofile', {
      \ 'do': 'ln -s cd ftplugin && diff_gofile.vim git_diffgofile.vim'
      \ }

to install the plugin and automatically create a symlink to enable the features
for git diffs. You can also create the symlink manually.

________________________________________________________________________________

This is a mirror of http://www.vim.org/scripts/script.php?script_id=1888

Description:
If you are editing diff file and you want to jump quickly to corresponding source files, function DiffGoFile does that. Place cursor on the spot in diff file which interests you, call DiffGoFile and you will be presented with the source file exactly at the place you were looking at. Currently only unified diff is supported, but the script has framework for adding more types.

Invocation:
Place cursor on the line you are interested in and
:call DiffGoFile('X')
Where X is one of: n - open in New window
                   v - open in Vertical split
                   h - open in Horizontal split
                   t - open in new Tab

Configuration:
You may wish to setup a hotkey, I'm using CTRL-] (:tag) for example

autocmd FileType diff,git nnoremap <buffer> <C-]> :call DiffGoFile('n')<CR>

About

Quickly jump to diff locations


Languages

Language:Vim Script 100.0%