How do I join all selected lines into one line?
J (in visual mode)
In visual mode, pressing J joins all selected lines into a single line with spaces between them.
Search Vim Tricks
Searching...J (in visual mode)
In visual mode, pressing J joins all selected lines into a single line with spaces between them.
<C-v>selection r{char}
In visual block mode, pressing r followed by a character replaces every character in the selected rectangle with that character.
v
The v command enters character-wise visual mode, letting you select text one character at a time.
<C-v>jj$A
Combining visual block mode with $ and A lets you append text at the end of multiple lines, even when the lines have different lengths.
<C-v>selection c
In visual block mode, pressing c changes (replaces) all the text in the selected rectangle.
<C-v>jjI1. <Esc>
Visual block insert can add numbered prefixes to lines.
y$
The y$ command yanks (copies) text from the cursor position to the end of the line.
:earlier 10m
The :earlier command restores the buffer to its state at a specific time in the past.
:sort
The :sort command sorts lines in the current buffer or a specified range alphabetically.
ddp
The ddp sequence swaps the current line with the line below it.
:%s/\s\+$//
The :%s/\s\+$// command removes trailing whitespace (spaces and tabs) from every line in the file.
:m {line-number}
The :m (move) command moves the current line to after the specified line number.
<C-a>
The command increments the number under or after the cursor by 1.
X
The X command deletes the character to the left of the cursor (before it).
dip
The dip command deletes the inner paragraph — all contiguous non-blank lines surrounding the cursor.
:t {line-number}
The :t (copy/transfer) command duplicates the current line and places it after the specified line number.
<C-x>
The command decrements the number under or after the cursor by 1.
ce
The ce command changes from the cursor position to the end of the current word.
==
The == command auto-indents the current line based on the surrounding context.
cc
The cc command deletes the entire content of the current line (preserving indentation) and enters insert mode.