How do you use a macro to sort paragraphs alphabetically?
qavip:sort\n}jq
Record a macro that visually selects the inner paragraph, sorts its lines, then moves to the next paragraph.
415 results for "n N"
qavip:sort\n}jq
Record a macro that visually selects the inner paragraph, sorts its lines, then moves to the next paragraph.
/pattern/+N or /pattern/-N
Vim's search command accepts an offset that places your cursor on a line relative to the match.
qa{jI## Section \n<Esc>}q
Record a macro that goes to the start of each paragraph and inserts a section header.
qa:s/\s\+$//e\n jq
Record a macro that runs a substitution on the current line to remove trailing spaces, then moves down.
qa0f dwi\n<Esc>jq
Extract columns by recording a macro that navigates to the desired field and deletes or yanks it.
n
After performing a search with / or ?, pressing n repeats the search in the same direction to find the next match.
qaA <C-r>=strftime('%Y-%m-%d')\n<Esc>jq
Record a macro that appends a date stamp using the expression register with strftime().
:resize +N / :resize -N
:resize adjusts the height of the current window by a relative or absolute amount.
qa/true\|false\ncgn<C-r>=@"=='true'?'false':'true'\n<Esc>q
Record a macro using cgn with an expression register to toggle between true and false.
:let @q = substitute(@q, '\n$', 'A;<Esc>\n', '')
Rerecording a long macro for one tiny change is slow and error-prone.
qa*Ncgn<C-r>=newName\n<Esc>q
Record a macro using * to search for the word under cursor, cgn to change the next match, type the new name.
qa80|i\n<Esc>jq
Record a macro that moves to column 80 using 80 , inserts a newline, and moves to the next line.
:let i=1\nqao<C-r>=i\n<Esc>:let i+=1\nq
Use a counter variable with the expression register inside a macro.
:earlier {N}m and :later {N}m
Vim's :earlier and :later commands let you travel through your edit history by wall-clock time rather than by individual undo steps.
:/pattern/+N and :/pattern/-N
Vim's Ex command ranges can use search patterns as line addresses, and those addresses can include a numeric offset (+N or -N) to target lines relative to the m
:s/\n/ /
One of the most confusing asymmetries in Vim's substitution syntax: \n and \r mean different things depending on whether they appear in the pattern or the repla
\n in search, \r in replacement
Vim uses \n and \r differently depending on whether they appear in a search pattern or a replacement string, and mixing them up is a common source of confusion.
{count}n
Like most Vim motions, the n and N search repeat commands accept a count prefix.
:earlier {N}m
Vim's :earlier command lets you travel back through the undo history by wall-clock time rather than by the number of changes.
:sort n
:sort n sorts lines by the first number found on each line, comparing values numerically rather than as strings.