From 62d652645dbe31f2e476a7bdcde18ba22445d555 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 6 Nov 2017 09:43:32 +1300 Subject: Don't overwrite plugin-specified user commands The Google Vimscript Style Guide says: > Excluding [!] prevents your plugin from silently clobbering existing > commands. Command conflicts should be resolved by the user. This makes sense to me as we can think of mapping and user commands as being the user-accessible portion of the interface, rather than the functions which can be properly namespaced with autoload#Syntax(), if exposed at all. --- vim/plugin/command_typos.vim | 18 +++++++++--------- vim/plugin/toggle_option_flag.vim | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'vim/plugin') diff --git a/vim/plugin/command_typos.vim b/vim/plugin/command_typos.vim index 16ba654d..adf2d0eb 100644 --- a/vim/plugin/command_typos.vim +++ b/vim/plugin/command_typos.vim @@ -14,30 +14,30 @@ endif let g:loaded_command_typos = 1 " Define commands -command! -bang -complete=file -nargs=? +command -bang -complete=file -nargs=? \ E \ edit -command! -bang -complete=file -nargs=? +command -bang -complete=file -nargs=? \ W \ write -command! -bang -complete=file -nargs=? +command -bang -complete=file -nargs=? \ WQ \ wq -command! -bang -complete=file -nargs=? +command -bang -complete=file -nargs=? \ Wq \ wq -command! -bang +command -bang \ Q \ quit -command! -bang +command -bang \ Qa \ qall -command! -bang +command -bang \ QA \ qall -command! -bang +command -bang \ Wa \ wall -command! -bang +command -bang \ WA \ wa diff --git a/vim/plugin/toggle_option_flag.vim b/vim/plugin/toggle_option_flag.vim index f8dcd3a9..2543b8c3 100644 --- a/vim/plugin/toggle_option_flag.vim +++ b/vim/plugin/toggle_option_flag.vim @@ -46,9 +46,9 @@ function! s:Toggle(option, flag, local) endfunction " User commands wrapping around calls to the above function -command! -nargs=+ -complete=option +command -nargs=+ -complete=option \ ToggleOptionFlag \ call Toggle(, 0) -command! -nargs=+ -complete=option +command -nargs=+ -complete=option \ ToggleOptionFlagLocal \ call Toggle(, 1) -- cgit v1.2.3