3

I'm getting lag in vim when navigating relatively small text files if filetype plugin indent on is uncommented in my vimrc file. My full vimrc file is pasted below. Any help on how I can get it enabled properly with no lag? It's worked fine in the past. I only started having this issue lately.

set nocompatible          " We're running Vim, not Vi!
syntax on                 " Enable syntax highlighting

filetype off          " Begin For Vundle
set rtp+=~/.vim/vundle.git/
call vundle#rc()
Bundle 'gmarik/vundle'    
Bundle 'scrooloose/nerdcommenter'
Bundle 'scrooloose/nerdtree'

Bundle "https://github.com/msanders/snipmate.vim"
" End Vundle code

" causing massive lag, disabled
"filetype plugin indent on " Enable filetype-specific indenting and plugins

set number "enable line numbers
set lines=40 columns=100

set clipboard=unnamedplus

" Map ctrl-n to NerdTree
nmap <silent> <c-n> :NERDTreeToggle<CR>

" go to previous file with ,p
let mapleader = "," 
map <Leader>p <C-^> 

" Load matchit (% to bounce from do to end, etc.)
runtime! macros/matchit.vim

augroup myfiletypes
" Clear old autocmds in group
autocmd!
" autoindent with two spaces, always expand tabs
set ai sw=2 sts=2 et

" Move swp files to ~/.vim/tmp
set backupdir=~/.vim/tmp
set directory=~/.vim/tmp
1
  • I don't think that's what cause your problem but you start an autocommand group (augroup myfiletypes) but don't end it (augroup END) and it seems that to commands in it are not filetype specific. I don't know if that's an error in your copy-paste or an actual error in your vimrc but you might want to change that.
    – statox
    Jul 11 '17 at 6:51
1

Most likely you have something in your actual syntax files causing the lag. I'd reccomend running :syntime on, moving about a little, then doing :syntime report. This'll show you what patterns take the longest to check for matches. Consider disabling those, or looking them over if they're custom (usually stored in ~/.vim/after/)

1
  • All I did was move the cursor, but here is the slow culprit. Any ideas how to fix? TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN 7.582617 674 644 0.023922 0.011250 pythonFunction \%(\%(def\s\|class\s\|@)\s*)\@<=\h\%(\w\|\.)* Nov 18 '17 at 8:46
0

I think my issue was related to https://github.com/vim/vim/issues/1098 I've updated to vim 8.0 and it seems to have fixed it.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.