Replace CtrlP with FZF

Summary:
Using CtrlP has proven to be slower and has fewer features. We've been
switching over to FZF on a frequent enough basis that it feels
appropriate to make FZF the new default for fuzzy searching.

By swapping out Ctrlp in favor of FZF, this should not break anyone's
fuzzy search but it will replace the tool that executes the search.

Co-authored-by: Chris Toomey <chris@ctoomey.com>
This commit is contained in:
Stephanie Viccari 2019-07-12 17:09:20 -04:00
parent 2e49faecfe
commit 3001fd3d65
4 changed files with 13 additions and 8 deletions

View file

@ -182,7 +182,7 @@ sin importar de nombre del archivo:
Configuración [vim](http://www.vim.org/):
* [Ctrl-P](https://github.com/ctrlpvim/ctrlp.vim) para hallazgo difuso de archivos/buffer/tags.
* [fzf](https://github.com/junegunn/fzf.vim) para hallazgo difuso de archivos/buffer/tags.
* [Rails.vim](https://github.com/tpope/vim-rails) para una mejor navegación de la estructura
de archivos de Rails via `gf` y `:A` (alterno), `:Rextract` parciales,`:Rinvert` migraciones, etc.
* Ejecuta muchos tipos de pruebas [desde vim]([https://github.com/janko-m/vim-test)

View file

@ -181,7 +181,7 @@ What's in it?
[vim](http://www.vim.org/) configuration:
* [Ctrl-P](https://github.com/ctrlpvim/ctrlp.vim) for fuzzy file/buffer/tag finding.
* [fzf](https://github.com/junegunn/fzf.vim) for fuzzy file/buffer/tag finding.
* [Rails.vim](https://github.com/tpope/vim-rails) for enhanced navigation of
Rails file structure via `gf` and `:A` (alternate), `:Rextract` partials,
`:Rinvert` migrations, etc.

10
vimrc
View file

@ -91,11 +91,8 @@ if executable('ag')
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag --literal --files-with-matches --nocolor --hidden -g "" %s'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
" Use ag in fzf for listing files. Lightning fast and respects .gitignore
let $FZF_DEFAULT_COMMAND = 'ag --literal --files-with-matches --nocolor --hidden -g ""'
if !exists(":Ag")
command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
@ -162,6 +159,9 @@ nnoremap <C-l> <C-w>l
nnoremap ]r :ALENextWrap<CR>
nnoremap [r :ALEPreviousWrap<CR>
" Map Ctrl + p to open fuzzy find (FZF)
nnoremap <c-p> :Files<cr>
" Set spellfile to location that is guaranteed to exist, can be symlinked to
" Dropbox or kept in Git and managed outside of thoughtbot/dotfiles using rcm.
set spellfile=$HOME/.vim-spell-en.utf-8.add

View file

@ -16,7 +16,12 @@ call plug#begin('~/.vim/bundle')
" Define bundles via Github repos
Plug 'christoomey/vim-run-interactive'
Plug 'ctrlpvim/ctrlp.vim'
if executable('fzf')
Plug '/usr/local/opt/fzf'
else
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
endif
Plug 'junegunn/fzf.vim'
Plug 'elixir-lang/vim-elixir'
Plug 'fatih/vim-go'
Plug 'janko-m/vim-test'