I currently use 'junegunn/fzf.vim', along with the homebrew version of fzf in the command line to search within projects. My setup uses Neovim and Tmux, and I'm getting intermittent freezing when navigating to files using both :GFiles and :Ag

When it happens, it happens like this:

  • I run GFiles
  • Search split appears
  • I navigate to a particular file and press enter
  • Vim is now completely unresponsive

I know that I should really isolate the issue using a minimal .vimrc, but it is so intermittent I've been completely unable to do that. Sometimes it happens (usually when I'm pairing with another dev, lol) and sometimes it doesn't, despite following the exact same steps. I'm therefore including my full .vimrc below - please don't hate me. If anyone has any tips on how to debug the issue it would be greatfully received because I'm completely at a loss...

" Allows the system keyboard to interact with yank etc
set clipboard=unnamed

set encoding=UTF-8

set hidden

" Store swap files here
set directory^=$HOME/.vim/tmp//

" Indenting
set expandtab
set tabstop=2
set shiftwidth=2

" Highlight search hits
set hlsearch

" Search as chars are added to search
set incsearch

set ignorecase
set smartcase

set laststatus=2

" Turn on syntax highlightingg
syntax enable

"set 'nocompatible' to ward off unexpected things that your distro might
" have made, as well as sanely reset options when re-sourcing .vimrc
set nocompatible

set wildmenu

set showcmd

set ruler

" Actual confirm box rather than dialog box on errors (such as if you quit
" without write)
set confirm

set cursorline
" attempt to determine the type of a file based on its name and possibly its
" contents. Use this to allow intelligent auto-indenting for each filetype,
" " and for plugins that are filetype specific.
" filetype indent plugin on

set number relativenumber " Turn on relative line numbering

augroup numbertoggle
  autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
  autocmd BufLeave,FocusLost,InsertEnter   * set norelativenumber
augroup END

" Install vim-plug if it is missing
if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC

let g:rbpt_max = 16
let g:rbpt_loadcmd_toggle = 0 

" Declare plugins
call plug#begin('~/.vim/plugged') 
Plug 'vim-scripts/git-log'
Plug 'kien/rainbow_parentheses.vim'
Plug 'junegunn/fzf.vim'
Plug '/usr/local/opt/fzf'
Plug 'airblade/vim-gitgutter'
Plug 'flazz/vim-colorschemes'
Plug 'tpope/vim-cucumber'
Plug 'tpope/vim-surround'
Plug 'christoomey/vim-tmux-navigator'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'tpope/vim-commentary'
Plug 'altercation/vim-colors-solarized'
Plug 'easymotion/vim-easymotion'
Plug 'aklt/plantuml-syntax'
Plug 'Shougo/deoplete.nvim'
Plug 'carlitux/deoplete-ternjs'
Plug 'mustache/vim-mustache-handlebars'
Plug 'scrooloose/nerdtree'
Plug 'ternjs/tern_for_vim'
Plug 'vim-scripts/AutoComplPop'
Plug 'jacoborus/tender.vim'
Plug 'drewtempelmeyer/palenight.vim'
Plug 'ryanoasis/vim-devicons'
Plug 'junkblocker/patchreview-vim'
" This is not the original plugin but a fork that adds Github enterprise support
Plug 'jamietanna/vim-codereview' 
Plug 'janko-m/vim-test'
Plug 'w0rp/ale'
Plug 'gioele/vim-autoswap'
Plug 'ekalinin/Dockerfile.vim'
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-dispatch'
Plug 'junegunn/gv.vim'
Plug 'arkwright/vim-whiplash'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'martinda/Jenkinsfile-vim-syntax'
Plug 'ruanyl/vim-gh-line'
Plug 'tpope/vim-unimpaired'
call plug#end()

let g:ale_linters = {'javascript': ['eslint']}
let g:ale_javascript_eslint_use_global = 1
let g:airline#extensions#ale#enabled = 1
let g:airline#extensions#tabline#enabled = 1
" If the plugged directory hasn't been created, install all plugins
if empty(glob('~/.vim/plugged'))

let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"

colorscheme Gruvbox
set background=dark

" Key mappings

" Map leader key to be the space bar
let mapleader = "\<Space>"

let g:airline_powerline_fonts = 1

if !exists('g:airline_symbols')
    let g:airline_symbols = {}

" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'

let test#strategy = "vimux"

" airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''

" Tern mappings
nmap <leader>td :TernDef<CR>
nmap <leader>tdp :TernDefPreview<CR>
nmap <leader>tds :TernDefSplit<CR>
nmap <leader>tdt :TernDefTab<CR>
nmap <leader>tr :TernRefs<CR>
nmap <leader>trn :TernRename<CR>
nmap <leader>tt :TernType<CR>

" Mapping selecting mappings
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)

" Insert mode completion
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-j> <plug>(fzf-complete-file-ag)
imap <c-x><c-l> <plug>(fzf-complete-line)

nmap <silent> t<C-n> :TestNearest<CR> " t Ctrl+n
nmap <silent> t<C-f> :TestFile<CR>    " t Ctrl+f
nmap <silent> t<C-s> :TestSuite<CR>   " t Ctrl+s
nmap <silent> t<C-l> :TestLast<CR>    " t Ctrl+l
nmap <silent> t<C-g> :TestVisit<CR>   " t Ctrl+g

nnoremap <C-n> :bprevious<CR>
nnoremap <C-p> :bnext<CR>

" Advanced customization using autoload functions
inoremap <expr> <c-x><c-k> fzf#vim#complete#word({'left': '15%'})

" Map fzf commands
nmap <leader>k :Ag
nmap <leader>K :Ag!
nmap <leader>f :GitFiles
nmap <leader>F :GitFiles!
nmap <leader>g :GitFiles?
nmap <leader>b :Buffers
nmap <leader>c :Commits
nmap <leader>C :BCommits
nmap <leader>s :Gstatus

map<C-s> :NERDTreeToggle<CR>

map<C-w> :Gblame<CR>

au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces

let g:GITLOG_default_mode = 2
map <silent> <f7> :call GITLOG_ToggleWindows()<cr>
map <silent> <f5> :call GITLOG_FlipWindows()<cr>

let g:ale_sign_error = '✗'
let g:ale_sign_warning = ''

let g:gitgutter_sign_added = ''
let g:gitgutter_sign_modified = ''
  • 2
    Im sure this isnt the problem, but you could save yourself from some serious headaches by using the noremap variants. – D. Ben Knoble Sep 4 '18 at 13:43
  • sometimes fzf freezes when there is currently another instance of the file active( maybe there are lingering swap files) or if the file is in 'readonly mode'. – John Fred Fadrigalan Nov 14 '18 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.