How do I apply commands to specific line ranges?
:{start},{end} command
Ex commands accept range specifiers that control which lines are affected.
415 results for "n N"
:{start},{end} command
Ex commands accept range specifiers that control which lines are affected.
:let @a = @a . @b
You can manipulate register contents directly using the :let command with the @{reg} syntax.
:cnext and :cprev
The quickfix list holds a set of file positions, typically from compiler errors, grep results, or other tools.
:%s/old/new/gc
Adding the c flag to a substitute command makes Vim pause at every match and ask you whether to replace it.
:'<,'>sort
The :'sort command sorts the currently selected lines in visual mode alphabetically.
:mkview / :loadview
:mkview saves a snapshot of the current window — its fold states, cursor position, and local option values — to a view file on disk.
buffers-windows #folding #buffers-windows #config #ex-commands
:e +/pattern filename
The +{cmd} flag on :edit (and most file-opening commands) runs an Ex command immediately after the file loads.
command-line #command-line #ex-commands #navigation #search #buffers
:verbose map <key> or :verbose set option?
The :verbose prefix shows where a mapping, setting, command, or function was defined — which file and line number.
command-line #command-line #debugging #config #mappings #workflow
:sort /regex/
The :sort /pattern/ command sorts lines by the text that appears after the first match of a pattern, not from the start of each line.
:mkview 2 and :loadview 2
Vim supports up to 9 numbered view slots per file.
buffers-windows #folding #buffers-windows #navigation #config
:lua require('harpoon.mark').add_file()
Harpoon by ThePrimeagen is a Neovim plugin that maintains a small, numbered list of the files you're actively working on.
set statusline=%{MyCustomFunc()}
How it works Vim's statusline supports the %{expr} syntax which evaluates a Vimscript expression and displays the result.
:s/pattern/replace/flags
The substitute command supports several flags that modify its behavior.
:set pumheight=10
By default, Vim's completion popup menu (the PUM — Pop-Up Menu) can expand to fill the entire screen if there are many candidates.
<C-x><C-l>
The command triggers whole-line completion in insert mode.
set complete+=kspell
Adding kspell to the complete option makes and draw from the active spell word list — every word Vim considers correctly spelled.
vim.diagnostic.jump({count=1})
Neovim 0.
<C-x><C-i>
Vim's completion mode searches for keyword matches not just in the current buffer, but also in all files reachable via include directives (e.
g+
Vim's undo history is a tree, not a linear stack.
/<C-r>0
How it works After yanking text, you can use it directly as a search pattern by inserting the yank register contents into the search prompt.