diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-11-04 02:27:42 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-11-04 02:28:16 +1300 |
commit | b0a15bf0e7aae09b8a875a3803632e878be595bd (patch) | |
tree | 5088d5c15fba8ed4812344972e7ecf32e764fee8 /vim/config/join.vim | |
parent | Use <Plug> prefix, make space strip configurable (diff) | |
download | dotfiles-b0a15bf0e7aae09b8a875a3803632e878be595bd.tar.gz dotfiles-b0a15bf0e7aae09b8a875a3803632e878be595bd.zip |
Spin stable join config out into new plugin
Again using the <Plug> mapping abstraction and not defining the mapping
for the user.
Diffstat (limited to 'vim/config/join.vim')
-rw-r--r-- | vim/config/join.vim | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/vim/config/join.vim b/vim/config/join.vim index 7d764dce..ebf42a8b 100644 --- a/vim/config/join.vim +++ b/vim/config/join.vim @@ -2,26 +2,9 @@ " despite the noble Steve Losh's exhortations set nojoinspaces -" Keep my cursor in place when I join lines +" Rebind normal J to run plugin-defined join that doesn't jump around, but +" only if we have the eval feature, because otherwise this mapping won't exist +" and we should keep the default behaviour if has('eval') - - " Declare function - function! s:StableNormalJoin() - - " Save current cursor position - let l:lc = line('.') - let l:cc = col('.') - - " Build and execute join command - let l:command = '.,+' . v:count1 . 'join' - execute l:command - - " Restore cursor position - call cursor(l:lc, l:cc) - - endfunction - - " Remap J to the above function - nnoremap <silent> J :<C-U>call <SID>StableNormalJoin()<CR> - + nmap J <Plug>FixedJoin endif |