Skip to content

Commit

Permalink
Merge pull request #1 from jamesl33/master
Browse files Browse the repository at this point in the history
Added the ability to run a command after jumping e.g. 'zz'
  • Loading branch information
arp242 committed Aug 10, 2019
2 parents 90fa9fc + 27eb12e commit 1bd06d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Use `g:jumpy_map` to configure the mappings:
let g:jumpy_map = ['<Leader>[', '<Leader>]'] Use Leader.
let g:jumpy_map = 0 Don't map anything.

Use `g:jumpy_after` to run a command after after jumping:

let g:jumpy_after = '' Default.
let g:jumpy_after = 'zz' Center the screen.

Currently supported filetype with their patterns:

Filetype What it matches Regexp
Expand Down
10 changes: 6 additions & 4 deletions autoload/jumpy.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ fun! jumpy#map(pattern) abort
return
endif

let l:after = get(g:, 'jumpy_after', '')

for l:mode in ['n', 'o', 'x']
exe printf('%snoremap <buffer> <silent> %s :<C-u>call jumpy#jump("%s", "%s", "next")<CR>',
\ l:mode, l:map[0], fnameescape(a:pattern), l:mode)
exe printf('%snoremap <buffer> <silent> %s :<C-u>call jumpy#jump("%s", "%s", "prev")<CR>',
\ l:mode, l:map[1], fnameescape(a:pattern), l:mode)
exe printf('%snoremap <buffer> <silent> %s :<C-u>call jumpy#jump("%s", "%s", "next")<CR>%s',
\ l:mode, l:map[0], fnameescape(a:pattern), l:mode, l:after)
exe printf('%snoremap <buffer> <silent> %s :<C-u>call jumpy#jump("%s", "%s", "prev")<CR>%s',
\ l:mode, l:map[1], fnameescape(a:pattern), l:mode, l:after)
endfor
endfun

Expand Down

0 comments on commit 1bd06d2

Please sign in to comment.