From b1dee73b770c7bda4bcc24b54c5ab2dd9953eb17 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 3 Nov 2017 00:28:36 +1300 Subject: Separate command typos config to plugin Tentatively named command_typos.vim. I've just moved this as-is for now, but it will need review, especially the hardcoded mappings. --- vim/plugin/command_typos.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 vim/plugin/command_typos.vim (limited to 'vim/plugin/command_typos.vim') diff --git a/vim/plugin/command_typos.vim b/vim/plugin/command_typos.vim new file mode 100644 index 00000000..5ee43e09 --- /dev/null +++ b/vim/plugin/command_typos.vim @@ -0,0 +1,14 @@ +" Tolerate typos like :Wq, :Q, or :Qa and do what I mean, including any +" arguments or modifiers; I fat-finger these commands a lot because I type +" them so rapidly, and they don't correspond to any other commands I use +if has('user_commands') + command! -bang -complete=file -nargs=? E e + command! -bang -complete=file -nargs=? W w + command! -bang -complete=file -nargs=? WQ wq + command! -bang -complete=file -nargs=? Wq wq + command! -bang Q q + command! -bang Qa qa + command! -bang QA qa + command! -bang Wa wa + command! -bang WA wa +endif -- cgit v1.2.3 From 2eb421d272c65106a9922f0be764bb2ac12f3fe3 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 4 Nov 2017 17:38:38 +1300 Subject: Check 'eval' feature for loading command_typos.vim I strongly suspect the presence of 'user_commands' implies it, but I'm not sure. --- vim/plugin/command_typos.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim/plugin/command_typos.vim') diff --git a/vim/plugin/command_typos.vim b/vim/plugin/command_typos.vim index 5ee43e09..592392ab 100644 --- a/vim/plugin/command_typos.vim +++ b/vim/plugin/command_typos.vim @@ -1,7 +1,7 @@ " Tolerate typos like :Wq, :Q, or :Qa and do what I mean, including any " arguments or modifiers; I fat-finger these commands a lot because I type " them so rapidly, and they don't correspond to any other commands I use -if has('user_commands') +if has('eval') && has('user_commands') command! -bang -complete=file -nargs=? E e command! -bang -complete=file -nargs=? W w command! -bang -complete=file -nargs=? WQ wq -- cgit v1.2.3 From 562c9ce6fbbd6fc8b9c5e470121dcc8e731de21e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 4 Nov 2017 17:39:23 +1300 Subject: Use same comment boilerplate for custom plugins A brief explanation, an author name, and the license should do fine. --- vim/plugin/command_typos.vim | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vim/plugin/command_typos.vim') diff --git a/vim/plugin/command_typos.vim b/vim/plugin/command_typos.vim index 592392ab..32d194fb 100644 --- a/vim/plugin/command_typos.vim +++ b/vim/plugin/command_typos.vim @@ -1,6 +1,11 @@ +" " Tolerate typos like :Wq, :Q, or :Qa and do what I mean, including any " arguments or modifiers; I fat-finger these commands a lot because I type " them so rapidly, and they don't correspond to any other commands I use +" +" Author: Tom Ryder +" License: Same as Vim itself +" if has('eval') && has('user_commands') command! -bang -complete=file -nargs=? E e command! -bang -complete=file -nargs=? W w -- cgit v1.2.3