aboutsummaryrefslogtreecommitdiff
path: root/vim/config/join.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim/config/join.vim')
-rw-r--r--vim/config/join.vim25
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