On Thursday, January 23, 2014 11:34:02 AM UTC-5, Christian Brabandt
wrote:
> Here is a version, that should do, what the OP wanted:
>
> fu! <sid>JumpInFile(forward)
> redir => a |exe ":sil jumps"|redir end
> let b = split(a, '\n')[1:]
> let idx = match(b, '^>.*')
> if idx == -1
> return "\<esc>"
> endif
> let idx = (a:forward ? idx-1 : idx+1)
> let i = 0
> if get(b, idx, -1) != -1
> let entry = matchlist(get(b, idx),
> \ '^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(\d\+\)'.
> \ '\s\+\(.*\)')
> if empty(entry)
> return "\<esc>"
> endif
> if !empty(entry[4])
> let line = matchstr(getline(entry[2]+0), '^\s*\zs.\{'.
> \ strwidth(entry[4]).'}')
> else
> let line = getline(entry[2]+0)
> endif
> if line ==# entry[4]
> if a:forward && entry[1] > 0
> return (entry[1]) . "\<C-O>"
> elseif !a:forward && entry[1] > 0
> return (entry[1]-1) . "\<C-I>"
> endif
> else
> return "\<esc>"
> endif
> endif
> return "\<esc>"
> endfu
>
> nnoremap <expr> g<C-O> <sid>JumpInFile(1)
> nnoremap <expr> g<C-I> <sid>JumpInFile(0)
Thanks, Christian. What should the file name be?
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment