44 votes
Accepted

How to find what slows down Vim?

Vim has a built-in profile set of commands. See :h profile. You would open up vim, and then run the following :profile start profile.log This sets up the file profile.log to be the log file. If it ...
user avatar
24 votes
Accepted

Do large numbers make vim run slowly?

I can reproduce this with the syntax/python.vim that ships with Vim 7.4.663. Using :syntime, this seems to be caused by the following syntax group / pattern: TOTAL COUNT MATCH SLOWEST ...
user avatar
  • 16.9k
20 votes

Most annoying slow-down of a plain-text editor!

Can somebody tell me how to avoid the very annoying vim's slowdown? Hopefully in a user friendly non-geeky way? I run Vim on a company-provided 2013 15" Retina MacBook with a 2.3 GHz i7 processor, 16 ...
user avatar
  • 33.1k
18 votes
Accepted

Cut vim load time

If you just want to see what's consuming start up time, then you can use the --startuptime option. vim --startuptime timing.out The file will look like this: times in msec clock self+sourced ...
user avatar
  • 10.4k
16 votes
Accepted

Vim slows down over time with syntax on

Recent Vim versions have a :syntime command to troubleshoot slowness of syntax highlighting by generating a report of how long each syntax group takes to match. This is very helpful and quickly lets ...
user avatar
  • 16.9k
13 votes
Accepted

Detect most resource hungry plugin

This isn't really possible. Vim doesn't have any concept of isolation, everything lives in a big, happy, single-threaded process, and resources are democratically shared among all plugins. The best ...
user avatar
  • 3,618
10 votes

Why is vim save so slow?

The culprit in this particular situation was the Syntastic plugin. It's forking eslint. I load Syntastic on entering insert mode (using a vim-plug function loader). Vim is plenty snappy on its own....
user avatar
  • 2,091
9 votes
Accepted

Folding slow with vimtex

First: Did you bother to read the vimtex documentation, i.e. :h vimtex-folding? The docs clearly point out that the fold-expr method of folding is slow, and so therefore provides an option g:...
user avatar
8 votes
Accepted

matchpairs makes vim slow

The slowness of delimiter matching is not caused by vim itself but by the matchparen plugin, which is part of the vim distribution and loaded by default in /etc/vim/vimrc in Debian. (This is why I ...
user avatar
  • 395
7 votes

Vim slows down over time with syntax on

Another typical bottleneck in vim's syntax highlight is folding. Editing can become very slow if a fold contains many syntax items (which basically means it goes over many lines), because vim will ...
user avatar
  • 1,552
7 votes
Accepted

Fastest way to compare string with pattern

The operator version =~ is most likely faster than matchstr. This is for a couple reasons: function calls in vim script have a cost matchstr returns a string, therefore has an extra allocation I've ...
user avatar
  • 12.8k
6 votes

matchpairs makes vim slow

If your emails have a particular file type, you could use BufRead or BufNewFile or FileType to turn off some matchpairs automatically: au BufRead,BufNewFile *.email set mps-=<:>
user avatar
  • 1,490
5 votes
Accepted

Is there a way to disable the foldexpr during autocomplete?

I had a problem a while back with syntax folding PHP where typing { would interfere with subsequent folds until I typed the corresponding closing }. I found a suggestion somewhere (I think it was on ...
user avatar
  • 3,159
5 votes

Cut vim load time

You can debug startup time by using the built in Vim profiler (tutorial) If your version of vim is compiled with :profile you can run: vim --cmd 'profile start vimrc.profile' --cmd 'profile! file ~/....
user avatar
  • 611
5 votes

Fastest way to compare string with pattern

I've run @Mass bench against another one that avoids :for as I have the experience of extra costs associated to control statements. My convoluted solution also does its best to avoid lambdas. function!...
user avatar
  • 16.2k
4 votes
Accepted

What is the fastest way to perform this change?

As far as I can tell, your recording doesn't include any vertical motion. This means that 2@q will play your recording twice on the same line. You could add a j at the end of your macro to move down. ...
user avatar
  • 33.1k
4 votes
Accepted

Slow startup time unrelated to plugins

If you are debugging plugins, then do the following: Disable half of your plugins. If it fixes the problem, re-enable half of the disabled ones. If it doesn't, disable half of the ones not yet ...
user avatar
  • 3,159
3 votes

How can I make a slow-ish `system` call in a statusline without corrupting the display?

I have seen this problem in other plugins as well (and some take a LOT more than 0.04 seconds). The issue appears to be that Vim puts the terminal into "cooked" mode so that the command that is run ...
user avatar
  • 8,072
3 votes
Accepted

What are the methods of speeding up parsing of a big file using Ex?

Switch to the old regexp engine, it's much faster than the new one for the particular regexp you're using: set regexpengine=1 You can also turn off stuff you definitely won't be using (cf. wiki), ...
user avatar
  • 3,879
3 votes
Accepted

Vim slows down with multiple buffers etc

I have no idea if any of the following will help, but here are a few things you could try. You have the following autocmd: :au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>85v.\+', -1) I can'...
user avatar
  • 5,888
3 votes
Accepted

neovim takes a long time to open files

I did a search on GitHub and Google. From the results, it's pretty reasonable to assume that that function is from vim-css-color, which isn't in vim-polyglot. In fact it looks like it was removed in ...
user avatar
  • 6,380
3 votes

Detect most resource hungry plugin

Maybe one approach could be vim --startuptime vim.log Then you can sort vim.log output to get the most time consuming plugin. You can then profile vim startup with vim -c 'profile start vim.log' -c '...
user avatar
3 votes

is neovim faster than vim?

For most built-in operations, the runtime between Vim and NeoVim is not noticeably different. That is, both are fast enough to not care about any difference. I've seen one situation that NeoVim is ...
user avatar
2 votes

Is there a way to disable the foldexpr during autocomplete?

perhaps there's a way to use a mapping to turn fdm=manual before autocomplete or some such? Well, this does that: inoremap <C-x> <Esc>:setlocal foldmethod=manual<CR>a<C-x> ...
user avatar
2 votes

Vim slows down over time with syntax on

Here is what I did in the end: Removed xolox/vim-easytags Removed xolox/vim-misc Replaced kien/ctrlp d11wtq/ctrlp_bdelete and tacahiroy/ctrlp-funky with junegunn/fzf Set regexpengine=1 Right now ...
user avatar
  • 2,252
2 votes

How to execute multiple command on file open?

My vim was slowing down because of Plugin 'Yggdroot/indentLine'. @laktak you was right
user avatar
  • 141
2 votes
Accepted

Strangely slow key bindings

When you define a multi key mapping that starts with character that is itself a mapping, vim doesn't know which one you want after only the first character. It waits to see if you'll type another ...
user avatar
  • 7,466
2 votes
Accepted

Are there any built-in functions to search sorted list?

There is nothing built in. But you might check lh-vim-lib. It has the following functions working on sorted lists: lh#list#equal_range() lh#list#lower_bound() lh#list#upper_bound()
user avatar
  • 8,665
1 vote

How to track time-expenditure for Vim operations?

You can profile and measure time Vim spends on executing functions and scripts. For more details, run :h profile in Vim. Here's an example: profile start ~/vim-profile.log profile file ~/.vim/* ...
user avatar
  • 201

Only top scored, non community-wiki answers of a minimum length are eligible