How do I make wrapped lines preserve their indentation level?
:set breakindent
When wrap is enabled, long lines wrap to the next screen row starting at column 1 by default, which makes indented code look messy.
870 results for "it at"
:set breakindent
When wrap is enabled, long lines wrap to the next screen row starting at column 1 by default, which makes indented code look messy.
:breakadd func {funcname}
Vim has a built-in debugger for Vimscript that most users never discover.
:botright split
When you split a window with :split or :vsplit, Vim subdivides only the current window.
buffers-windows #buffers #windows #ex-commands #command-line
<C-r>=
The expression register (=) lets you evaluate Vimscript expressions on the fly and insert the result directly into your text.
registers #editing #insert-mode #registers #productivity #math
<C-v>$A
When you need to append text to the end of several lines that have different lengths, visual block mode with $ is the key.
qa{motions}@aq
A recursive macro is one that calls itself at the end of its own recording.
<C-o>zz
When you are typing in insert mode and the cursor drifts near the top or bottom of the screen, you normally have to press , then zz, then i or a to continue edi
qq{cmds}@qq
A recursive macro is one that calls itself at the end of its own body.
zl and zh
When a line is longer than the window width and wrap is off, Vim can display only part of it.
/\S\zs\s\+$
A plain trailing-whitespace search like /\s\+$ also matches fully blank lines, which is noisy when you only want accidental spaces after real content.
ma and 'a
The ma command sets a mark named a at the current cursor position.
:e +{line} {file}
The :edit command accepts a +{cmd} prefix that executes an Ex command immediately after the file is loaded.
command-line #buffers #ex-commands #navigation #command-line
/pattern/e
Search offsets let you place the cursor at a specific position relative to the match.
g$
The g$ command moves the cursor to the last character of the current screen line, not the end of the logical line.
gnn / grn / grm
nvim-treesitter's incremental selection module lets you grow and shrink your visual selection one syntax node at a time.
5<C-o>
Most Vim users know jumps backward in the jumplist, but fewer use a count with it.
"=
The expression register ("=) lets you evaluate any Vim expression and insert its result as text.
:set scrolloff=999
By default, Vim only scrolls the viewport when the cursor reaches the very top or bottom of the screen.
navigation #navigation #scrolling #config #cursor #scrolloff
:sp +/{pattern} {file}
The +{cmd} syntax lets you run an Ex command immediately after a file is opened.
:cdo s/old/new/ | update
:cdo {cmd} executes a command at every entry in the quickfix list, visiting each location in turn.