aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-07 10:07:56 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-07 10:10:03 +1300
commit3b64f6c61d3e2a04cf3f5f6f24b84635947344d5 (patch)
tree774cd31e90cd493a7c8256412463ad9f185d3b42
parent44bd9a85728ec1eb6b4049b31e98ccdad9a8b02b (diff)
downloaddotfiles-3b64f6c61d3e2a04cf3f5f6f24b84635947344d5.tar.gz
Add commands to copy_linebreak.vim
Just to be thorough; if +user_commands are available, offer :CopyLinebreakEnable, :CopyLinebreakDisable, and :CopyLinebreakToggle commands.
-rw-r--r--vim/doc/copy_linebreak.txt6
-rw-r--r--vim/plugin/copy_linebreak.vim15
2 files changed, 20 insertions, 1 deletions
diff --git a/vim/doc/copy_linebreak.txt b/vim/doc/copy_linebreak.txt
index 285d92ea..15e4b1b0 100644
--- a/vim/doc/copy_linebreak.txt
+++ b/vim/doc/copy_linebreak.txt
@@ -14,6 +14,12 @@ Mappings:
<Plug>CopyLinebreakDisable
<Plug>CopyLinebreakToggle
+Commands:
+
+ :CopyLinebreakEnable
+ :CopyLinebreakDisable
+ :CopyLinebreakToggle
+
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/copy_linebreak.vim b/vim/plugin/copy_linebreak.vim
index cc0cc741..2b5f7243 100644
--- a/vim/plugin/copy_linebreak.vim
+++ b/vim/plugin/copy_linebreak.vim
@@ -1,6 +1,7 @@
"
" copy_linebreak.vim: Bind user-defined key sequences to toggle a group of
-" options that make text wrapped with 'wrap' copy-paste friendly.
+" options that make text wrapped with 'wrap' copy-paste friendly. Also creates
+" user commands if it can.
"
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
@@ -50,4 +51,16 @@ noremap <silent> <unique>
noremap <silent> <unique>
\ <Plug>CopyLinebreakToggle
\ :<C-U>call <SID>CopyLinebreakToggle()<CR>
+
+" Provide user commands if we can
+if has('user_commands')
+ command -nargs=0
+ \ CopyLinebreakEnable
+ \ call <SID>CopyLinebreakEnable
+ command -nargs=0
+ \ CopyLinebreakDisable
+ \ call <SID>CopyLinebreakDisable
+ command -nargs=0
+ \ CopyLinebreakToggle
+ \ call <SID>CopyLinebreakToggle
endif