Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Reportbug-Version: 3.45
X-Debbugs-Cc: [EMAIL PROTECTED]
Package: vim
Version: 2:7.2.000-3
Severity: wishlist
Tags: patch

Well, it's not a patch, but a new file, ... anyway, please put the 
attached file in
        /usr/share/vim/vimcurrent/plugin/diff.vim
so you can press <CR> at the "@@ -x,x +x,x @@" lines in a diff
to jump to that chunk in the file.

Very nice if you're doing things like
        svn diff > /tmp/a.patch
        vi /tmp/a.patch
to review your changes.



-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/1 CPU core)
Locale: LANG=de_AT.UTF-8, LC_CTYPE=de_AT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages vim depends on:
ii  libacl1                   2.2.47-2       Access control list shared library
ii  libc6                     2.7-13         GNU C Library: Shared libraries
ii  libgpm2                   1.20.4-2       General Purpose Mouse - shared lib
ii  libncurses5               5.6+20080920-1 shared libraries for terminal hand
ii  libselinux1               2.0.65-5       SELinux shared libraries
ii  vim-common                2:7.2.000-3    Vi IMproved - Common files
ii  vim-runtime               2:7.2.000-3    Vi IMproved - Runtime files

vim recommends no packages.

Versions of packages vim suggests:
ii  exuberant-ctags [ctags]       1:5.7-4    build tag file indexes of source c
pn  vim-doc                       <none>     (no description available)
pn  vim-scripts                   <none>     (no description available)

-- no debconf information
" Plugin to allow pressing <CR> on the line number information lines
" ( @@ -xx,xx +xx,xx @@ ) in unified diffs, to jump to that position in that
" file.


noremap <silent> <buffer> <cr> :call DiffJump()<CR>

function! DiffJump()
	let line=getline(".")
	if line =~ '^@@ -\d\+,\d\+ +\d\+,\d\+ @@'
		" Maybe allow to go to the "old" line?
		let dest=matchstr(line, '+\d\+')
		let filename_linenumber=search('^+++ ', "bnW")
		" With the given pattern the filename always starts in byte 5.
		let t1=strpart(getline(filename_linenumber), 4)
		" Remove tab and all behind.
		let file=substitute(t1, '\t.*$', '', '')
		exe "edit " . dest . " " . file
	else
		echo "Line doesn't include line numbers"
	endif
endfunction

Reply via email to