How do I automatically fill a new file with a boilerplate template when creating it in Vim?
autocmd BufNewFile *.py 0r ~/.vim/templates/python.py
When you create a new file in Vim (e.
2277 results for "@a"
autocmd BufNewFile *.py 0r ~/.vim/templates/python.py
When you create a new file in Vim (e.
:{range}!command
The :{range}!command syntax pipes the specified lines through an external shell command and replaces them with the output.
command-line #command-line #shell #filtering #unix #ex-commands
<C-r><C-a>
When you are in command-line mode, inserts the word under the cursor (alphanumeric and _ only).
qA
If you finish recording a macro and realize you forgot a step, you don't need to re-record the whole thing.
macros #macros #registers #normal-mode #editing #productivity
qa{motions}@aq
A recursive macro is one that calls itself at the end of its own recording.
:let i=1 then use <C-r>=i<CR> in macro
By combining a Vimscript variable with the expression register inside a macro, you can create a counter that increments on each replay.
"{register}y{motion}
Vim has 26 named registers (a-z) that act as independent clipboards.
registers #registers #editing #normal-mode #yank #productivity
dp
In Vim's diff mode, dp (diff put) and do (diff obtain) are single-keystroke shorthands for :diffput and :diffget.
buffers-windows #diff #buffers-windows #editing #normal-mode
vim.uv.new_timer()
Neovim exposes vim.
gq
The gq operator reformats text to fit within your configured textwidth.
:tab sb N
How it works The :tab sb N command opens buffer number N in a brand new tab page.
:norm! {command}
:normal {command} runs a sequence of Normal mode keystrokes from the command line (or a range of lines with :%normal), but it applies your custom key mappings.
command-line #ex-commands #macros #normal-mode #command-line
<C-v><Tab>
When expandtab is set, pressing the Tab key inserts spaces instead of a real tab character.
gqip
The gqip command reformats the current paragraph to fit within the configured textwidth.
:resize +N / :resize -N
:resize adjusts the height of the current window by a relative or absolute amount.
<C-v>{motion}$A
In visual block mode, pressing $ makes the right edge of the selection "ragged" — it extends to the real end of each line regardless of length.
"Ay{motion}
Using an uppercase register letter with any operator appends to the register instead of replacing it.
qqq
Pressing qqq in normal mode is the quickest way to empty a macro register.
:vimgrep /pattern/ **/*
While external tools like grep or ripgrep are fast, Vim's built-in :vimgrep has a key advantage: it populates the quickfix list directly, so you can jump betwee
input({prompt})
The built-in input() function pauses execution, displays a prompt at the bottom of the screen, and returns whatever the user types before pressing Enter.