How do I insert a timestamp computed by Vimscript directly from Normal mode?
"=strftime('%Y-%m-%d %H:%M')<CR>p
The expression register lets you evaluate Vimscript on demand and paste the result immediately.
category:
registers
tags:
#registers
#expression-register
#automation
#timestamps
How do I exchange two blocks of text using visual mode?
visual select + d, move, P
To swap two pieces of text, delete the first selection, navigate to the second, select it, and paste.
category:
visual-mode
tags:
#visual-mode
#editing
#registers
How do I evaluate a Vim expression and paste the result directly from a register?
The expression register lets you compute text on demand and insert it without leaving Normal mode workflows.
category:
registers
tags:
#registers
#expression-register
#normal-mode
#automation
How do I paste the last Ex command I ran into my buffer?
The : register holds the most recently executed Ex command.
category:
registers
tags:
#registers
#ex-commands
#normal-mode
#productivity
How do I copy the current file's full path to the system clipboard?
Sometimes you need to share or use the full path of the file you're editing — for a terminal command, a config file, or a chat message.
category:
registers
tags:
#registers
#ex-commands
#editing
#clipboard
How do I replace a visual selection with yanked text in Vim?
In visual mode, pressing p replaces the selected text with the contents of the default register.
category:
visual-mode
tags:
#visual-mode
#editing
#registers
#normal-mode
How do I paste the name of the alternate (previously edited) file into the buffer?
The # register holds the name of the alternate file — the file you were editing just before the current one.
category:
registers
tags:
#registers
#buffers
#navigation
#normal-mode
How do I move my cursor into the preview window to interact with its contents?
The preview window is a special auxiliary split — usually at the top — opened by commands like :ptag, :pedit, and omni-completion to display reference infor
category:
buffers-windows
tags:
#buffers
#windows
#navigation
#editing
How do I paste over a visual selection and automatically save the replaced text to a register?
When you visually select text and press p, Vim replaces the selection with the contents of the default register and saves the replaced text into the unnamed reg
category:
visual-mode
tags:
#visual-mode
#registers
#editing
#paste
How do I change the working directory to the folder containing the current file without affecting other windows?
:lcd %:p:h sets the working directory for the current window to the directory of the file you're editing, using Vim's path expansion modifiers.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
#navigation
How do I open netrw in a left sidebar rooted at the current file's directory?
When you are editing deep in a project, opening netrw from the working directory often puts you in the wrong place.
category:
plugins
tags:
#plugins
#buffers
#windows
#navigation
How do I store the current file path in a named Vim register?
Named registers are not only for yanked text.
category:
registers
tags:
#registers
#command-line
#filename-modifiers
#editing
How do I paste the current Git commit hash directly from Vim using the expression register?
"=system('git rev-parse --short HEAD')->trim()<CR>p
If you frequently write commit references in notes, code comments, or release docs, you can avoid shell context switches and paste the hash straight from Vim.
category:
registers
tags:
#registers
#command-line
#editing
#git
How do I refer to the current filename, extension, or directory in Vim ex commands?
Vim's filename modifiers let you derive path components from the current file's name directly inside ex commands.
category:
command-line
tags:
#command-line
#ex-commands
#buffers
How do I open quickfix at the bottom with a fixed height and keep cursor focus in my editing window?
:botright copen 8 | wincmd p
Quickfix is powerful, but opening it can disrupt window layout and yank focus away from your current editing context.
category:
buffers-windows
tags:
#buffers
#windows
#quickfix
#command-line
How do I access text from small deletes like dw or x?
The small delete register ("-) captures text from delete operations that are less than one line — like dw, x, dt.
category:
registers
tags:
#registers
#delete
#paste
#normal-mode
How do I paste text from the system clipboard into Vim?
The "+p command pastes the contents of the system clipboard into Vim.
category:
registers
tags:
#registers
#editing
#normal-mode
How do I populate a window-local location list for only the current file using ripgrep output?
:call setloclist(0, [], 'r', {'title': 'TODO current file', 'lines': systemlist('rg --vimgrep TODO ' . shellescape(expand('%:p'))), 'efm': '%f:%l:%c:%m'})
For focused review work, a window-local location list is often better than global quickfix.
category:
buffers-windows
tags:
#buffers
#windows
#location-list
#search
#quickfix
How do I set each window's local working directory to its buffer path?
When multiple splits point at files from different projects, relative-path commands can become inconsistent and error-prone.
category:
buffers-windows
tags:
#buffers
#windows
#command-line
#workflow
How do I use the alternate file register to quickly reference the previous file?
"#p or <C-r># in insert mode
The # register always contains the name of the alternate file — typically the file you were editing just before the current one.
category:
registers
tags:
#registers
#buffers
#file-management
#workflow