Permalink
Browse files

Fix [e and ]e after i<C-O>

Closes #11.
  • Loading branch information...
1 parent a5cf25a commit 6ade36686f3e6d17afe0e8253ea991fdddf5470c @tpope committed Sep 6, 2011
Showing with 29 additions and 2 deletions.
  1. +29 −2 plugin/unimpaired.vim
View
@@ -1,6 +1,8 @@
" unimpaired.vim - Pairs of handy bracket mappings
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 1.1
+" TODO: use :try
+" TODO: simpler modeline
if exists("g:loaded_unimpaired") || &cp || v:version < 700
finish
@@ -73,6 +75,31 @@ nnoremap <silent> <Plug>unimpairedOPrevious :<C-U>edit `=<SID>FileByOffset(-v:co
nmap ]o <Plug>unimpairedONext
nmap [o <Plug>unimpairedOPrevious
+nmap [, :call search('^[<=>]\{7\}','bW')<CR>
+nmap ], :call search('^[<=>]\{7\}','W')<CR>
+omap [, V:call search('^[<=>]\{7\}','bW')<CR>
+omap ], V:call search('^[<=>]\{7\}','W')<CR>
+xmap [, :<C-U>exe 'norm! gv'<Bar>call search('^[<=>]\{7\}','bW')<CR>
+xmap ], :<C-U>exe 'norm! gv'<Bar>call search('^[<=>]\{7\}','W')<CR>
+nmap [< :call search('^<<<<<<<','bW')<CR>
+nmap [= :call search('^=======','bW')<CR>
+nmap [> :call search('^>>>>>>>','bW')<CR>
+nmap ]< :call search('^<<<<<<<','W')<CR>
+nmap ]= :call search('^=======','W')<CR>
+nmap ]> :call search('^>>>>>>>','W')<CR>
+xmap [< :<C-U>exe 'norm! gv'<Bar>call search('^<<<<<<<','bW')<CR>
+xmap [= :<C-U>exe 'norm! gv'<Bar>call search('^=======','bW')<CR>
+xmap [> :<C-U>exe 'norm! gv'<Bar>call search('^>>>>>>>','bW')<CR>
+xmap ]< :<C-U>exe 'norm! gv'<Bar>call search('^<<<<<<<','W')<CR>
+xmap ]= :<C-U>exe 'norm! gv'<Bar>call search('^=======','W')<CR>
+xmap ]> :<C-U>exe 'norm! gv'<Bar>call search('^>>>>>>>','W')<CR>
+omap [< V:call search('^<<<<<<<','bW')<CR>
+omap [= V:call search('^=======','bW')<CR>
+omap [> V:call search('^>>>>>>>','bW')<CR>
+omap ]< V:call search('^<<<<<<<','W')<CR>
+omap ]= V:call search('^=======','W')<CR>
+omap ]> V:call search('^>>>>>>>','W')<CR>
+
" }}}1
" Line operations {{{1
@@ -82,8 +109,8 @@ nnoremap <silent> <Plug>unimpairedBlankDown :<C-U>put =repeat(nr2char(10),v:coun
nmap [<Space> <Plug>unimpairedBlankUp
nmap ]<Space> <Plug>unimpairedBlankDown
-nnoremap <silent> <Plug>unimpairedMoveUp :<C-U>exe 'norm m`'<Bar>exe 'move--'.v:count1<CR>``
-nnoremap <silent> <Plug>unimpairedMoveDown :<C-U>exe 'norm m`'<Bar>exe 'move+'.v:count1<CR>``
+nnoremap <silent> <Plug>unimpairedMoveUp :<C-U>exe 'norm! m`'<Bar>exe 'move--'.v:count1<Bar>norm! ``<CR>
+nnoremap <silent> <Plug>unimpairedMoveDown :<C-U>exe 'norm! m`'<Bar>exe 'move+'.v:count1<CR>norm! ``<CR>
@tpope

tpope Sep 6, 2011

Owner

Drat, thanks!

xnoremap <silent> <Plug>unimpairedMoveUp :<C-U>exe 'norm m`'<Bar>exe '''<,''>move--'.v:count1<CR>``
xnoremap <silent> <Plug>unimpairedMoveDown :<C-U>exe 'norm m`'<Bar>exe '''<,''>move''>+'.v:count1<CR>``

0 comments on commit 6ade366

Please sign in to comment.