How do I use a macro to align text on a specific character like the equals sign?
qa0f=20i <Esc>20|C= <Esc>lDjq
How it works Aligning text on a delimiter such as = without plugins requires a clever macro technique.
1019 results for "i" a""
qa0f=20i <Esc>20|C= <Esc>lDjq
How it works Aligning text on a delimiter such as = without plugins requires a clever macro technique.
:nnoremap key command
The :nnoremap command creates a non-recursive normal mode mapping.
"ap, edit, "add
Since macros are stored in registers, you can paste the register content into the buffer, edit it, and yank it back.
<C-x>
The command decrements the number under or after the cursor by 1.
g; and g,
Vim tracks every position where you made a change in the changelist.
:enew
The :enew command creates a new unnamed empty buffer in the current window.
vim-startify plugin
vim-startify provides a configurable start screen when you open Vim without a file.
"+q{keys}q
You can record macros into any register, including the system clipboard (+).
viw
How it works The command viw selects the word under the cursor in visual mode.
\@<=pattern
The \@<= atom is a positive lookbehind in Vim regex.
qa I1. <Esc>j q
This simple macro inserts a list number prefix at the beginning of each line.
])
The ]) command moves forward to the next unmatched ).
`{mark}
The backtick command ` ` followed by a mark name jumps to the exact line and column of that mark, unlike the single-quote ' which only goes to the line.
:nnoremap <leader>x :norm! @a<CR>
Once you've perfected a macro by recording and testing it, you can make it permanent by converting it into a mapping in your vimrc.
:terminal
The :terminal command opens an interactive terminal emulator directly inside a Vim window.
/<C-r>0
How it works After yanking text, you can use it directly as a search pattern by inserting the yank register contents into the search prompt.
/pattern\n next-line
Using \n in a Vim search pattern matches a newline character, allowing you to find patterns that cross line boundaries.
:{range}w filename
The :w command with a range and filename saves only the specified lines to a new file.
qa Yp <C-a> q
By combining a macro with (increment number), you can quickly generate numbered sequences.
:v/pattern/d
The :v command (short for :vglobal) is the inverse of :g — it executes a command on every line that does not match the given pattern.
command-line #editing #ex-commands #search #filtering #productivity