Last Updated: February 25, 2016
·
491
· jirichara

Avert Vim's auto completion slowness on networked filesystem

I work a lot on networked filesystem last days (as I already mentioned in my previous article). Unfortunately Vim has run into problems with autocompletetion. It was just insanely slow :confused:, because Vim has tried to search for matching words also in included files. The solution for me was to disable scanning for included files in insert mode like this:

set complete-=i

If you wan't Vim to do it automatically for you when new buffer is opened:

function FastScanOnSSHFS()
  let l:result=system('stat -f -L -c %T ' . shellescape(expand('%:p:h')))

  if l:result =~ 'fuseblk'
    setlocal complete-=i
  endif
endfunction

autocmd BufNewFile,BufRead * call FastScanOnSSHFS()

Source