How do I paste the contents of a register as a new line below the cursor regardless of the register type in Vim?
The :put Ex command always inserts a register's content as a new line below the current line, regardless of whether the register holds characterwise, linewise,
category:
editing
tags:
#registers
#editing
#paste
#ex-commands
#normal-mode
How do I select or operate on the content of an HTML or XML tag using text objects?
Vim provides two built-in text objects for HTML and XML tags: it (inner tag) and at (a tag).
category:
editing
tags:
#text-objects
#editing
#visual-mode
#html
#normal-mode
How do I access the current and alternate filename registers in Vim?
Vim provides special read-only registers that hold the current and alternate filenames.
category:
registers
tags:
#registers
#filename
#special-registers
#buffers
How do I convert a register's type between characterwise and linewise?
:call setreg('a', @a, 'l')
Registers in Vim have a type — characterwise, linewise, or blockwise — that affects how their contents are pasted.
category:
registers
tags:
#registers
#setreg
#type-conversion
#linewise
How do I run Lua code in the context of a specific buffer without switching to it in Neovim?
vim.
category:
config
tags:
#ex-commands
#vimscript
#buffers
#config
How do I copy the current file's path into the system clipboard from Vim?
The % register always holds the name of the current file (as a relative path).
category:
registers
tags:
#registers
#editing
#ex-commands
How do I access the alternate file register?
The # register contains the name of the alternate file — the previously edited file in the current window.
category:
registers
tags:
#registers
#buffers
How do I access the text from my last insert session?
The .
category:
registers
tags:
#registers
#editing
#normal-mode
How do I add, change, or delete surrounding characters with vim-surround?
cs"' (change), ds" (delete), ys iw" (add)
The vim-surround plugin by Tim Pope adds commands for working with surrounding characters like quotes, brackets, and tags.
category:
plugins
tags:
#plugins
#editing
#text-objects
How do I open the directory containing the current file in netrw from within Vim?
The command :e %:h opens netrw (Vim's built-in file browser) in the directory that contains the current file.
category:
command-line
tags:
#command-line
#navigation
#buffers
#netrw
#editing
How do I change whether a register pastes as character, line, or block-wise?
:call setreg('"', @", 'l')
Vim registers carry not just their text content but also a type: charwise (c), linewise (l), or blockwise (b).
category:
registers
tags:
#registers
#editing
#normal-mode
#paste
How do I insert the result of a Vim expression or calculation directly into text?
The expression register ("=) lets you evaluate any Vim expression and insert its result as text.
category:
registers
tags:
#registers
#insert-mode
#editing
#ex-commands
How do I always access my last yanked text regardless of deletes?
Register 0 (the yank register) always contains the text from your most recent yank command — and unlike the unnamed register, it is never overwritten by delet
category:
registers
tags:
#registers
#paste
#yank
#workflow
How do I extract the directory, filename, or extension from the current file path inside a Vim command?
Vim's filename modifiers let you derive path components from the current buffer's filename directly on the command line.
category:
command-line
tags:
#ex-commands
#command-line
#editing
How do I open or edit a file in the same directory as the file I am currently editing?
Vim expands % to the current file's path in Ex commands, and the :h modifier strips the last filename component to give you just the directory.
category:
command-line
tags:
#ex-commands
#buffers
#navigation
#editing
How do I change existing surrounding quotes to parentheses with vim-surround?
The cs operator in vim-surround (change surrounding) swaps one pair of delimiters for another without touching the content inside.
category:
plugins
tags:
#plugins
#editing
#surround
#text-objects
How do I customize the status line at the bottom of the screen?
:set statusline=%f\ %m%r%=%l/%L
The statusline option controls what information is shown in the status bar at the bottom of each window.
category:
config
tags:
#config
#ex-commands
How do I make Tab and Enter behave differently when the completion popup menu is open?
The pumvisible() function returns 1 when the insert-mode completion popup menu (pum) is visible, and 0 otherwise.
category:
config
tags:
#config
#insert-mode
#completion
How do I change the content between HTML tags without manually selecting it?
The cit command deletes everything between the nearest pair of HTML/XML tags and drops you into insert mode, ready to type the replacement.
category:
editing
tags:
#editing
#text-objects
#normal-mode
#html
#tags
How do I enable a popup menu for command-line tab completion in Neovim?
Setting wildoptions=pum tells Neovim to use its popup menu for command-line tab completion instead of the traditional horizontal wildmenu bar.
category:
config
tags:
#config
#completion
#command-line