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

@@ -162,8 +162,9 @@ You can use autoload functions to define your own commands.
command! -bang -nargs=* GGrep
\ call fzf#vim#grep('git grep --line-number '.shellescape(<q-args>), 0, <bang>0)
" We use VimEnter event so that the code is run after fzf.vim is loaded
autocmd VimEnter * command! -bang Colors
" Override Colors command. You can safely do this in your .vimrc as fzf.vim
" will not override existing commands.
command! -bang Colors
\ call fzf#vim#colors({'left': '15%', 'options': '--reverse --margin 30%,0'}, <bang>0)
" Augmenting Ag command using fzf#vim#with_preview function
@@ -173,7 +174,7 @@ autocmd VimEnter * command! -bang Colors
"
" :Ag - Start fzf with hidden preview window that can be enabled with "?" key
" :Ag! - Start fzf in fullscreen and display the preview window above
autocmd VimEnter * command! -bang -nargs=* Ag
command! -bang -nargs=* Ag
\ call fzf#vim#ag(<q-args>,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),