How do I speed up Vim when editing files with very long lines like minified code or CSV?
:set synmaxcol=200
The synmaxcol option tells Vim the maximum column up to which it will apply syntax highlighting on each line.
870 results for "it at"
:set synmaxcol=200
The synmaxcol option tells Vim the maximum column up to which it will apply syntax highlighting on each line.
expand('<cfile>')
The expand('') function returns the filename that Vim sees under the cursor — the same file that gf would open.
command-line #command-line #ex-commands #navigation #editing #motions
<C-r>0
In Insert mode, {reg} pastes the contents of any register inline at the cursor.
<C-w>^
Vim tracks the alternate buffer — the last file you were editing before the current one.
2<C-g>
Pressing prints the current filename, buffer status, and cursor position in the status line.
:let @a = @a[:-2]
Macros and named registers are just strings, so you can surgically edit them instead of re-recording from scratch.
:let @q = @:
The : register always holds the last Ex command you ran.
:psearch /pattern/
When you need quick context from another file but do not want to disturb your current editing window, :psearch gives you a clean workflow.
buffers-windows #buffers #windows #preview-window #search #navigation
5@q
Prefix the @ macro-execution command with a count to run the macro that many times in a row.
o (in Visual mode)
When you make a Visual selection in Vim, the cursor sits at one end while the other end is anchored.
:set diffopt+=algorithm:histogram
Switches Vim's diff algorithm from the default Myers algorithm to histogram, which produces more semantically meaningful diffs by avoiding false matches between
:set makeprg={command}
Vim's :make command runs a build program and automatically loads its output into the quickfix list so you can jump directly to errors and warnings.
:s/old/new/g
The :s/old/new/g command replaces all occurrences of old with new on the current line only.
expand('%:p:h:t')
Vim's filename modifiers can be chained to transform paths step by step.
%:e
Vim exposes the current filename as % in Ex commands, and you can apply modifiers to extract specific parts of the path.
g; and g,
Vim tracks every position where you made a change in the changelist.
vim.diagnostic.jump()
Neovim 0.
:set splitright splitbelow
By default, :split opens a new window above the current one and :vsplit opens to the left — the opposite of most modern IDEs and editors.
: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
<C-q> (Telescope)
While inside any Telescope picker, pressing sends all current results to the quickfix list and closes the picker.