Skip to content

Commit

Permalink
Add <Plug> maps for next/previous commands
Browse files Browse the repository at this point in the history
This also loosens up some nnoremaps to be nmaps so space.vim can be
triggered.
  • Loading branch information
tpope committed Feb 13, 2010
1 parent e0ff84c commit 014d559
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions plugin/unimpaired.vim
Expand Up @@ -13,11 +13,16 @@ set cpo&vim
" Next and previous {{{1

function! s:MapNextFamily(map,cmd)
let end = ' ".(v:count ? v:count : "")<CR>'
execute 'nnoremap <silent> ['. a:map .' :<C-U>exe "'.a:cmd.'previous'.end
execute 'nnoremap <silent> ]'. a:map .' :<C-U>exe "'.a:cmd.'next' .end
execute 'nnoremap <silent> ['.toupper(a:map).' :<C-U>exe "'.a:cmd.'first' .end
execute 'nnoremap <silent> ]'.toupper(a:map).' :<C-U>exe "'.a:cmd.'last' .end
let map = '<Plug>unimpaired'.toupper(a:map)
let end = ' ".(v:count ? v:count : "")<CR>'
execute 'nmap <silent> '.map.'Previous :<C-U>exe "'.a:cmd.'previous'.end
execute 'nmap <silent> '.map.'Next :<C-U>exe "'.a:cmd.'next'.end
execute 'nmap <silent> '.map.'First :<C-U>exe "'.a:cmd.'first'.end
execute 'nmap <silent> '.map.'Last :<C-U>exe "'.a:cmd.'last'.end
execute 'nmap <silent> ['. a:map .' '.map.'Previous'
execute 'nmap <silent> ]'. a:map .' '.map.'Next'
execute 'nmap <silent> ['.toupper(a:map).' '.map.'First'
execute 'nmap <silent> ]'.toupper(a:map).' '.map.'Last'
endfunction

call s:MapNextFamily('a','')
Expand Down

0 comments on commit 014d559

Please sign in to comment.