diff --git a/vim/rc/plugins.rc.vim b/vim/rc/plugins.rc.vim index 23e1955..d3b132e 100644 --- a/vim/rc/plugins.rc.vim +++ b/vim/rc/plugins.rc.vim @@ -24,7 +24,7 @@ call s:smart_source_rc('plugins/gitgutter') " }} Git " Searching {{ -call s:smart_source_rc('plugins/ctrlp') +" call s:smart_source_rc('plugins/ctrlp') call s:smart_source_rc('plugins/fzf') " call s:smart_source_rc('plugins/incsearch') call s:smart_source_rc('plugins/vim-grepper') diff --git a/vim/rc/plugins/ctrlp.rc.vim b/vim/rc/plugins/ctrlp.rc.vim index 7de0813..db0889b 100644 --- a/vim/rc/plugins/ctrlp.rc.vim +++ b/vim/rc/plugins/ctrlp.rc.vim @@ -1,6 +1,8 @@ Plug 'ctrlpvim/ctrlp.vim' " Configuration for ctrlp.vim +let g:ctrlp_in_use = 1 + " Ensure max height isn't too large. (for performance) let g:ctrlp_max_height = 10 " Conditional Mappings diff --git a/vim/rc/plugins/fzf.rc.vim b/vim/rc/plugins/fzf.rc.vim index a10f83a..7fef9d9 100644 --- a/vim/rc/plugins/fzf.rc.vim +++ b/vim/rc/plugins/fzf.rc.vim @@ -1,3 +1,35 @@ Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' } Plug 'junegunn/fzf.vim' -let g:fzf_command_prefix = 'Fzf' +let g:fzf_command_prefix = 'FZF' +" Jump to existing window if possible +let g:fzf_buffers_jump = 1 +" Override key commands +let g:fzf_action = { + \ 'ctrl-t': 'tab split', + \ 'ctrl-s': 'split', + \ 'ctrl-v': 'vsplit' } + +" Override BTags to attempt to include gotags as well +command! -bang -nargs=* FZFBTags + \ if &filetype == 'go' + \| call fzf#vim#buffer_tags(, printf('gotags -silent -sort %s | sed /^!_TAG_/d', shellescape(expand('%'))), 0) + \| else + \| call fzf#vim#buffer_tags(, 0) + \| endif + +" If no CtrlP, use FZF bindings +if !exists('g:ctrlp_in_use') + " Ctrl-T to launch standard file search + nnoremap :FZF + " Leader Commands + " Find buffers + nnoremap b :FZFBuffers + " Find text in files + nnoremap f :FZFAg + " Find tags + nnoremap r :FZFTags + " Find buffer tags + nnoremap t :FZFBTags + " Find git history for buffer + nnoremap g :FZFBCommits +endif