diff options
| author | Teddy Wing | 2019-12-10 21:29:46 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2019-12-13 20:50:49 +0100 | 
| commit | 88904fd725e31d614408c2a95b5d8a56f0de4ae0 (patch) | |
| tree | a0ac7ae08a860c23c5f53d064cba42a066321a43 | |
| parent | c34de5c3663e2b07e021a6b22abc3f0382c72d4a (diff) | |
| download | dotvim-88904fd725e31d614408c2a95b5d8a56f0de4ae0.tar.bz2 | |
Add 'cmd-escape' plugin idea
A mapping that toggles <Space> to insert '\ ', automatically escaping
spaces when entering file names (such as when creating files with spaces
in their names).
Working, but I now need to clean up the code.
| -rw-r--r-- | bundle/cmd-escape/plugin/cmd_escape.vim | 25 | 
1 files changed, 25 insertions, 0 deletions
| diff --git a/bundle/cmd-escape/plugin/cmd_escape.vim b/bundle/cmd-escape/plugin/cmd_escape.vim new file mode 100644 index 0000000..c37e335 --- /dev/null +++ b/bundle/cmd-escape/plugin/cmd_escape.vim @@ -0,0 +1,25 @@ +let s:active = 0 + +function! s:Activate() +	cnoremap <Space> \<Space> +	let s:active = 1 +endfunction + +function! s:Deactivate() +	cunmap <Space> +	let s:active = 0 +endfunction + +function s:Toggle() +	if s:active +		cunmap <Space> +		let s:active = 0 +	else +		cnoremap <Space> \<Space> +		let s:active = 1 +	endif + +	return '' +endfunction + +cnoremap <C-x><Space> <C-r>=<SID>Toggle()<CR> | 
