How do I move a line or selection up or down in Vim?
:move +1 / :move -2
The :move command relocates lines to a specific position without using delete and paste.
2277 results for "@a"
:move +1 / :move -2
The :move command relocates lines to a specific position without using delete and paste.
:oldfiles
:oldfiles displays a numbered list of every file Vim has recorded in its viminfo (or shada in Neovim) file.
:find {filename}
:find searches for a file in all directories listed in the path option and opens it in the current window.
:{range}center [width]
Vim provides three built-in Ex commands for text alignment: :center, :right, and :left.
/pattern\ze followed
The \ze atom marks the end of the match, so you can match a pattern only when it appears before specific text.
:'<,'>!awk '{printf "%-20s %s\n", $1, $2}'
By piping a visual selection through awk with printf formatting, you can align columns to fixed widths.
visual-mode #visual-mode #formatting #alignment #external-command
f{vi{U
When editing structured text, you often need to transform content inside delimiters without touching the delimiters themselves.
:normal! {keys}
:normal {keys} executes keystrokes as if typed in Normal mode — but it respects your custom mappings and abbreviations.
:nnoremap <leader>d "=strftime('%Y-%m-%d')<CR>p
The expression register (=) evaluates Vimscript expressions and uses the result as register content.
:s/\%#\k\+/REPL/
Most substitutions operate on broad ranges, but sometimes you want a precise edit anchored to where your cursor is right now.
:set nrformats-=octal\<CR>
If you work with IDs, ticket numbers, or zero-padded counters, Vim's default octal behavior can be surprising.
vim.iter()
vim.
<C-r>{register}
Pressing followed by a register name in insert mode inserts the contents of that register at the cursor position without leaving insert mode.
:nnoremap <expr> {key} {expression}
The argument to any map command (:nmap, :inoremap, etc.
config #config #macros #insert-mode #normal-mode #ex-commands
grn, gra, grr, gri
Starting with Neovim 0.
q?
Vim provides three command-line history windows accessible from normal mode: q: for Ex commands, q/ for forward searches, and q? for backward searches.
:set fillchars+=eob:
By default, Vim fills empty lines after the end of a buffer with ~ characters.
:cdo
:cdo {cmd} executes {cmd} on each entry in the quickfix list — one by one, jumping to each location in turn.
command-line #ex-commands #quickfix #search #editing #buffers
<C-o> (insert mode)
Pressing while in insert mode lets you execute exactly one normal mode command and then automatically returns you to insert mode.
qqqqqq{edits}@qq
A recursive macro calls itself at the end of its sequence, creating a loop that automatically repeats until a motion or command fails (such as hitting the last