path: root/vim/plugin
diff options
authorTom Ryder <tom@sanctum.geek.nz>2017-11-12 20:57:13 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-12 20:57:13 +1300
commit937458202c8311ecbed7a51a4cec1d1941a6bfd0 (patch)
tree00b3900dc6a7e351218dfe8f55b1fd575bf08889 /vim/plugin
parent871806685c2fcf26b81f3b324741d346ab365802 (diff)
Bind norm J on fixed_join.vim load if appropriate
If there are no mappings to the <Plug>FixedJoin target that the fixed_join.vim plugin provides at the time it is loaded, and the line-joining function of normal-mode J is not already mapped, the plugin will try to map it itself, for a more plug-and-play.
Diffstat (limited to 'vim/plugin')
1 files changed, 6 insertions, 0 deletions
diff --git a/vim/plugin/fixed_join.vim b/vim/plugin/fixed_join.vim
index 83977c2f..2e7f2abd 100644
--- a/vim/plugin/fixed_join.vim
+++ b/vim/plugin/fixed_join.vim
@@ -31,6 +31,12 @@ noremap <silent> <unique>
\ <Plug>FixedJoin
\ :<C-U>call <SID>FixedJoin()<CR>
+" If there's no mapping to it already, try to bind normal-mode J to it, to
+" simply replace the old functionality
+nmap <unique>
+ \ J
+ \ <Plug>FixedJoin
" Create a command as well in case it's useful
if has('user_commands')
command -nargs=0