aboutsummaryrefslogtreecommitdiffstats
path: root/bundle/cmd-escape/autoload/cmd_escape.vim
diff options
context:
space:
mode:
authorTeddy Wing2019-12-11 01:12:01 +0100
committerTeddy Wing2019-12-13 20:50:49 +0100
commit089771a8cf6eaf69aba0d7b37442a3b815aa7960 (patch)
treec2990a2fd930f39093c56c857360c3e8a8835969 /bundle/cmd-escape/autoload/cmd_escape.vim
parent88904fd725e31d614408c2a95b5d8a56f0de4ae0 (diff)
downloaddotvim-089771a8cf6eaf69aba0d7b37442a3b815aa7960.tar.bz2
cmd-escape: Make the plugin code more robust
* Move functions into autoload * Remove unused `s:Activate()` and `s:Deactivate()`. These were development ideas. * Add a load guard
Diffstat (limited to 'bundle/cmd-escape/autoload/cmd_escape.vim')
-rw-r--r--bundle/cmd-escape/autoload/cmd_escape.vim15
1 files changed, 15 insertions, 0 deletions
diff --git a/bundle/cmd-escape/autoload/cmd_escape.vim b/bundle/cmd-escape/autoload/cmd_escape.vim
new file mode 100644
index 0000000..dd87b64
--- /dev/null
+++ b/bundle/cmd-escape/autoload/cmd_escape.vim
@@ -0,0 +1,15 @@
+let s:active = 0
+
+" Toggles the <Space> key between normal self-insert and inserting an escaped
+" space ('\ ') in command mode.
+function cmd_escape#Toggle()
+ if s:active
+ cunmap <Space>
+ let s:active = 0
+ else
+ cnoremap <Space> \<Space>
+ let s:active = 1
+ endif
+
+ return ''
+endfunction