How do I load Vim's optional built-in packages like matchit or editorconfig on demand?
:packadd {package}
Vim ships with several useful packages in its opt/ directory that are not loaded by default.
:packadd {package}
Vim ships with several useful packages in its opt/ directory that are not loaded by default.
:profile start profile.log
When Vim feels sluggish, the built-in :profile command lets you measure exactly how much time each script and function consumes.
autocmd FileType python setlocal ts=4 sw=4 et
Using autocmd FileType, you can configure Vim to automatically apply buffer-local settings whenever a file of a particular type is opened.
:syntax sync fromstart
Vim's syntax highlighting engine does not always parse the entire file from the beginning — it uses sync points to determine where to start parsing for the vi
:set operatorfunc=MyFunc<CR>g@
Vim lets you define custom operators that behave like built-in ones (d, c, y) — they wait for a motion or text object, then act on the selected region.
:profile start profile.log | profile func *
When Vim feels sluggish during editing—not just at startup—you need runtime profiling to pinpoint which functions are consuming the most time.
config #profiling #debugging #config #ex-commands #performance
:profile start /tmp/profile.log | profile func *
When Vim feels sluggish during editing (not just at startup), the :profile command lets you measure the execution time of every function call.
:set operatorfunc=MyFunc<CR>g@{motion}
Vim's operatorfunc and g@ let you define custom operators that accept any motion or text object, just like built-in operators d, c, and y.
:syntime on
When Vim feels sluggish while editing files with complex syntax highlighting, :syntime lets you profile exactly which syntax rules are consuming the most time.
:set nrformats+=hex,bin
By default, Vim's and only increment and decrement decimal numbers.
vim --startuptime /tmp/vim-startup.log
When Vim takes too long to start, the --startuptime flag writes a detailed timing log showing exactly how long each plugin, script, and initialization step take
:set undofile undodir=~/.vim/undodir
By default, Vim's undo history is lost when you close a file.
:highlight MyGroup guifg=#ff0000 guibg=NONE gui=bold
The :highlight command lets you define custom colors for syntax elements, UI components, and your own highlight groups.
:setlocal iskeyword+=-
The iskeyword option defines which characters are part of a "word" for motions like w, b, e, , and text objects like iw.
vim: set ts=2 sw=2 et:
Modelines are special comments at the top or bottom of a file that Vim reads to apply file-specific settings.
:set path+=**
Adding to the path option tells Vim to search recursively through all subdirectories when using :find, gf, and other path-related commands.
:let &t_SI = "\e[6 q"
Modern terminals support cursor shape changes via escape sequences.
:set formatoptions+=cro
The formatoptions setting controls how Vim automatically formats text as you type — including comment continuation, auto-wrapping, and paragraph formatting.
:set grepprg=rg\ --vimgrep
Vim's :grep command uses an external program to search files and populate the quickfix list.
:set suffixesadd+=.js,.ts,.py
In many programming languages, import statements reference modules without file extensions (e.