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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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....
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:...
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 ...
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 ...
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 ...
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-=<:>
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 ...
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 ~/....
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!...
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.
...
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 ...
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 ...
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), ...
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'...
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 ...
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 '...
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 ...
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>
...
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 ...
2
votes
How to execute multiple command on file open?
My vim was slowing down because of Plugin 'Yggdroot/indentLine'. @laktak you was right
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 ...
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()
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/*
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
performance × 46vimrc × 10
syntax-highlighting × 6
neovim × 5
vimscript × 4
buffers × 3
folding × 3
startup × 3
key-bindings × 2
terminal × 2
autocmd × 2
autocompletion × 2
ssh × 2
large-documents × 2
plugin-vim-polyglot × 2
search × 1
command-line × 1
gvim × 1
cut-copy-paste × 1
indentation × 1
normal-mode × 1
microsoft-windows × 1
external-command × 1
plugin-system × 1
filetype-tex × 1