Change maps from CtrlP to FZF

Set up FZF bindings if ctrlp not loaded
This commit is contained in:
ViViDboarder 2017-10-25 12:59:05 -07:00
parent 6e2ff67d48
commit 6269785d63
3 changed files with 36 additions and 2 deletions

View File

@ -24,7 +24,7 @@ call s:smart_source_rc('plugins/gitgutter')
" }} Git " }} Git
" Searching {{ " 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/fzf')
" call s:smart_source_rc('plugins/incsearch') " call s:smart_source_rc('plugins/incsearch')
call s:smart_source_rc('plugins/vim-grepper') call s:smart_source_rc('plugins/vim-grepper')

View File

@ -1,6 +1,8 @@
Plug 'ctrlpvim/ctrlp.vim' Plug 'ctrlpvim/ctrlp.vim'
" Configuration for ctrlp.vim " Configuration for ctrlp.vim
let g:ctrlp_in_use = 1
" Ensure max height isn't too large. (for performance) " Ensure max height isn't too large. (for performance)
let g:ctrlp_max_height = 10 let g:ctrlp_max_height = 10
" Conditional Mappings " Conditional Mappings

View File

@ -1,3 +1,35 @@
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' } Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
Plug 'junegunn/fzf.vim' 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(<q-args>, printf('gotags -silent -sort %s | sed /^!_TAG_/d', shellescape(expand('%'))), <bang>0)
\| else
\| call fzf#vim#buffer_tags(<q-args>, <bang>0)
\| endif
" If no CtrlP, use FZF bindings
if !exists('g:ctrlp_in_use')
" Ctrl-T to launch standard file search
nnoremap <C-t> :FZF<CR>
" Leader Commands
" Find buffers
nnoremap <leader>b :FZFBuffers<CR>
" Find text in files
nnoremap <leader>f :FZFAg<CR>
" Find tags
nnoremap <leader>r :FZFTags<CR>
" Find buffer tags
nnoremap <leader>t :FZFBTags<CR>
" Find git history for buffer
nnoremap <leader>g :FZFBCommits<CR>
endif