How do I undo all changes made since the last time I saved the file in a single step?
:earlier 1f
The :earlier {count}f command navigates Vim's undo tree to the state of the buffer at the time of the last (or Nth) file write.
488 results for ":e!"
:earlier 1f
The :earlier {count}f command navigates Vim's undo tree to the state of the buffer at the time of the last (or Nth) file write.
<C-u> in insert mode
Pressing while in insert mode deletes all characters entered since you last entered insert mode on the current line.
gq{motion}
The gq{motion} operator reformats text to fit within Vim's textwidth setting, inserting hard line breaks where lines are too long.
gh
Vim's Select mode behaves like the familiar selection model in most GUI editors: after selecting text, any printable character you type replaces the selection a
<C-o>
The (Ctrl+o) command jumps the cursor backward through the jump list, returning you to previous cursor positions.
:set breakindentopt=shift:2
When breakindent is enabled, wrapped continuation lines are indented to match the start of their logical line.
mode()
The mode() function returns a short string identifying the current editing mode — 'n' for Normal, 'i' for Insert, 'v' for Visual character-wise, 'V' for Visua
macros #macros #normal-mode #visual-mode #insert-mode #editing
:set virtualedit=onemore
By default, Vim's cursor cannot go past the last character of a line in normal mode — pressing $ lands on the final character, not after it.
:tabnew filename
The :tabnew filename command opens a file in a new tab page in Vim.
buffers-windows #buffers-windows #tabs #ex-commands #navigation
zz
The zz command scrolls the window so that the current cursor line appears in the middle of the screen.
:{line}put {register}
How it works The :put Ex command pastes the contents of a register after a specified line.
<C-i>
Every time you make a "jump" — using G, /, %, :tag, , or similar commands — Vim records your position in the jump list.
:'<,'>normal @a
The :'normal @a command executes the macro stored in register a on every line within the current visual selection.
:set nowritebackup
By default, Vim saves files using a "write-then-rename" strategy: it writes to a temporary backup file and then renames it over the original.
z{height}<CR>
The z{height} command simultaneously resizes the current window to exactly {height} lines, scrolls so the current line sits at the top of the window, and moves
buffers-windows #buffers-windows #windows #resize #navigation
:r filename
The :r filename command reads the contents of filename and inserts them into the current buffer below the cursor line.
@q (inside macro recording)
A recursive macro calls itself as its last action, causing it to repeat indefinitely until it hits an error (like reaching end of file or failing a search).
g<C-a>
The g command increments numbers across a visual selection so that each subsequent line gets a progressively higher value.
ysiw)
The vim-surround plugin provides the ys (you surround) operator to wrap any Vim text object or motion with a delimiter pair.
plugins #plugins #surround #editing #text-objects #normal-mode
"+y
The "+y command yanks (copies) text into the system clipboard register, making it available to paste in other applications outside of Vim.