From 089771a8cf6eaf69aba0d7b37442a3b815aa7960 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 11 Dec 2019 01:12:01 +0100 Subject: 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 --- bundle/cmd-escape/plugin/cmd_escape.vim | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) (limited to 'bundle/cmd-escape/plugin') diff --git a/bundle/cmd-escape/plugin/cmd_escape.vim b/bundle/cmd-escape/plugin/cmd_escape.vim index c37e335..f9952d4 100644 --- a/bundle/cmd-escape/plugin/cmd_escape.vim +++ b/bundle/cmd-escape/plugin/cmd_escape.vim @@ -1,25 +1,6 @@ -let s:active = 0 +if exists('g:loaded_cmd_escape') + finish +endif +let g:loaded_cmd_escape = 1 -function! s:Activate() - cnoremap \ - let s:active = 1 -endfunction - -function! s:Deactivate() - cunmap - let s:active = 0 -endfunction - -function s:Toggle() - if s:active - cunmap - let s:active = 0 - else - cnoremap \ - let s:active = 1 - endif - - return '' -endfunction - -cnoremap =Toggle() +cnoremap =cmd_escape#Toggle() -- cgit v1.2.3