Do not override existing commands

So that we don't have to use VimEnter autocmd to override the commands
This commit is contained in:
Junegunn Choi
2017-02-07 11:40:31 +09:00
parent 4329721384
commit 1bf68a978b
3 changed files with 32 additions and 6 deletions

View File

@@ -33,7 +33,10 @@ function! s:defs(commands)
return
endif
for command in a:commands
execute substitute(command, '\ze\C[A-Z]', prefix, '')
let name = ':'.prefix.matchstr(command, '\C[A-Z]\S\+')
if !exists(name)
execute substitute(command, '\ze\C[A-Z]', prefix, '')
endif
endfor
endfunction