aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-07 09:34:21 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-07 09:37:24 +1300
commitd2669e7190e3db3123589bfcd3ba15a2e4c5243b (patch)
tree7c6651f35660b5e5198fa64b4dad831361b42c0b
parentc0e1371d3bdb9749d39c63e86a3678eb434d4ccb (diff)
downloaddotfiles-d2669e7190e3db3123589bfcd3ba15a2e4c5243b.tar.gz
Add :FixedJoin command
This is optiona; if the user's Vim doesn't have the 'user_commands' feature, the command will just quietly not be created.
-rw-r--r--vim/doc/fixed_join.txt5
-rw-r--r--vim/plugin/fixed_join.vim11
2 files changed, 13 insertions, 3 deletions
diff --git a/vim/doc/fixed_join.txt b/vim/doc/fixed_join.txt
index 0ee957d0..df0df251 100644
--- a/vim/doc/fixed_join.txt
+++ b/vim/doc/fixed_join.txt
@@ -1,4 +1,4 @@
-*fixed_join.txt* Mapping to join lines in normal mode without moving cursor
+*fixed_join.txt* Join lines in normal mode without moving cursor
Author: Tom Ryder <tom@sanctum.geek.nz>
License: Same terms as Vim itself (see |license|)
@@ -6,6 +6,9 @@ License: Same terms as Vim itself (see |license|)
This plugin provides a mapping target <Plug>FixedJoin to create a binding for a
user to join lines in normal mode without the cursor jumping around.
+If also provides a :FixedJoin command if you have +user_commands, but this is
+not required.
+
This plugin lives in Tom Ryder's "dotfiles" suite, and will eventually be spun
off into a separate distribution as it solidifies and this documentation
improves.
diff --git a/vim/plugin/fixed_join.vim b/vim/plugin/fixed_join.vim
index 4c7c7ed4..2c9e1d92 100644
--- a/vim/plugin/fixed_join.vim
+++ b/vim/plugin/fixed_join.vim
@@ -1,6 +1,6 @@
"
-" fixed_join.vim: User-defined key mapping to keep cursor in place when
-" joining lines in normal mode.
+" fixed_join.vim: User-defined key mapping and optional command to keep cursor
+" in place when joining lines in normal mode.
"
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
@@ -31,3 +31,10 @@ endfunction
noremap <silent> <unique>
\ <Plug>FixedJoin
\ :<C-U>call <SID>FixedJoin()<CR>
+
+" Create a command as well in case it's useful
+if has('user_commands')
+ command -nargs=0
+ \ FixedJoin
+ \ call <SID>FixedJoin()
+endif