How do I prevent Vim from adding a newline at the end of a file when saving?
:set nofixendofline
By default, Vim enforces POSIX compliance by appending a final newline to any file that lacks one.
:set nofixendofline
By default, Vim enforces POSIX compliance by appending a final newline to any file that lacks one.
:digraphs
:digraphs (abbreviated :dig) displays a full reference table of every digraph registered in Vim.
command-line #editing #special-characters #insert-mode #command-line
=ip
The =ip command combines Vim's auto-indent operator (=) with the inner paragraph text object (ip) to re-indent every line in the current paragraph in a single k
{Visual}<C-a>
In Visual mode, pressing increments every number within the selection by 1 (or by a given [count]).
:set nojoinspaces
By default, Vim follows an old typesetting convention and inserts two spaces after a period, exclamation mark, or question mark when joining lines with J.
:e ++ff=unix
The ++ff modifier forces Vim to re-read the current file from disk using a specific fileformat — unix (LF), dos (CRLF), or mac (CR).
:[range]right [width]
Vim's :right command right-aligns text by padding lines with leading spaces up to a given width.
yiw{nav}viwp{nav}viwp
When you paste over a visual selection in Vim, the displaced text is moved into the unnamed register "".
registers #registers #visual-mode #editing #text-objects #normal-mode
ZZ
ZZ is a normal mode shorthand that saves and quits only if the buffer has been modified.
<C-a> in insert mode
Pressing while in insert mode inserts the same text that was typed during the previous insert mode session.
:5t.
The :t ex command (also spelled :copy) copies a range of lines to a target address without touching any register.
:'<,'>norm .
The :'norm .
visual-mode #visual-mode #editing #normal-mode #repeat #dot-operator
:g/pattern/Commentary
vim-commentary exposes Commentary as an Ex command that toggles comments on the current line, making it composable with Vim's :global command.
:[range]center {width}
Vim has a built-in :center command that pads lines with leading spaces to visually center them within a given column width.
command-line #formatting #text-alignment #ex-commands #editing
:DiffOrig
:DiffOrig opens a side-by-side split comparing your current (unsaved) buffer against the version on disk.
buffers-windows #diff #buffers #editing #workflow #buffers-windows
gnn / grn / grm
nvim-treesitter's incremental selection module lets you grow and shrink your visual selection one syntax node at a time.
]c / [c (gitsigns.nvim)
gitsigns.
:Oil
oil.
:[range]luado {lua-expr}
Neovim's :luado command runs a Lua expression on each line of a range, allowing you to transform text using the full power of Lua's string library.
:sort! n
The :sort! n command sorts the lines of a buffer (or a range) by their numeric value in descending order.