How do I encode and decode JSON data in Vimscript for configuration and plugin development?
Vim 8.
category:
config
tags:
#config
#vimscript
#ex-commands
How do I use glob() in Vimscript to get a list of files matching a wildcard pattern?
The glob() built-in function expands a wildcard pattern into a list of matching filesystem paths, entirely within Vimscript.
category:
config
tags:
#config
#vimscript
#files
#ex-commands
How do I prevent a count prefix or visual range from corrupting an Ex command in a Vim mapping?
When writing nnoremap or vnoremap mappings that call Ex commands, Vim may silently prepend a count or a visual range (') to your command before it runs.
category:
config
tags:
#config
#ex-commands
#normal-mode
#visual-mode
How do I insert all command-line completion matches at once without pressing Tab repeatedly?
Pressing on the command line expands all current completion matches into the command at once, rather than cycling through them one at a time with .
category:
command-line
tags:
#command-line
#completion
#ex-commands
How do I safely pass a Vim variable or the word under the cursor as an argument to a shell command?
The shellescape() function wraps a string in shell-safe quoting, escaping any special characters so it can be embedded in a shell command constructed with :exec
category:
command-line
tags:
#ex-commands
#command-line
#editing
#normal-mode
How do I prompt the user for input in the middle of a mapping or Vimscript function?
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.
category:
macros
tags:
#macros
#editing
#ex-commands
#insert-mode
How do I save the current search pattern into a named register before it gets overwritten by a new search?
Vim stores the last search pattern in the special / register (@/).
category:
registers
tags:
#registers
#search
#ex-commands
How do I delete consecutive duplicate lines from a file using a single Ex command?
The :g command with a backreference pattern can detect and delete consecutive duplicate lines in one pass.
category:
command-line
tags:
#ex-commands
#search
#editing
#normal-mode
How do I display the contents of only certain registers instead of all of them at once?
The :reg (alias :registers) command accepts a string of register names as its argument.
category:
registers
tags:
#registers
#ex-commands
#normal-mode
How do I delete each line matching a pattern along with a fixed number of lines that follow it?
Inside a :global command, .
category:
command-line
tags:
#ex-commands
#global
#delete
#editing
#command-line
How do I view all the files Vim would search when resolving include-based completions and lookups?
:checkpath! recursively walks through every file reachable via Vim's include path and displays the full include tree.
category:
navigation
tags:
#navigation
#include
#completion
#ex-commands
How do I sort lines by a secondary field while ignoring a common leading prefix?
The :[range]sort /regex/ command sorts lines while skipping the portion of each line that matches the regex.
category:
command-line
tags:
#ex-commands
#sorting
#command-line
#search
How do I write a Vim search pattern that matches text at or between mark positions?
Vim's \%'m regex atom matches the exact position of mark m in a search pattern.
category:
search
tags:
#search
#marks
#navigation
#ex-commands
#normal-mode
How do I use the filename under the cursor as a value in a Vim mapping or command?
The expand('') function returns the filename that Vim sees under the cursor — the same file that gf would open.
category:
command-line
tags:
#command-line
#ex-commands
#navigation
#editing
#motions
How do I log all Vim verbose output to a file to diagnose slow startup or plugin issues?
:set verbosefile=/tmp/vim.log verbose=9
Vim's verbosefile option redirects all verbose tracing output to a file on disk instead of printing it to the screen.
category:
config
tags:
#config
#debugging
#startup
#verbose
#ex-commands
How do I use Neovim's built-in lazy iterator API to chain filter and map operations over a list?
vim.
category:
config
tags:
#ex-commands
How do I run an external command asynchronously from Neovim Lua and capture its output?
vim.system({cmd}, {opts}, callback)
vim.
category:
command-line
tags:
#command-line
#ex-commands
How do I restrict the :global command to operate on only a portion of the file?
:[range]g/pattern/command
The :global command accepts an optional line range prefix that restricts which lines it even considers matching.
category:
command-line
tags:
#command-line
#global
#ex-commands
#editing
How do I write an Ex range where the second address is evaluated relative to the first match instead of the cursor?
In Vim's range notation, a semicolon (;) between two addresses makes the second address relative to the line the first address matched, not to the current curso
category:
command-line
tags:
#command-line
#ex-commands
#search
#ranges
How do I populate the argument list with a glob pattern to work across multiple files?
The :args command sets Vim's argument list to all files matching a glob pattern.
category:
command-line
tags:
#command-line
#buffers
#ex-commands
#editing