How do I remove accidental Enter keystrokes from a recorded macro?
:let @q = substitute(@q, '\n', '', 'g')
A common macro failure mode is accidentally hitting while recording.
:let @q = substitute(@q, '\n', '', 'g')
A common macro failure mode is accidentally hitting while recording.
:debug normal @q
Recorded macros are powerful, but when one keystroke goes wrong they can fail fast and leave confusing state behind.
:verbose autocmd BufWritePre
When a save hook starts behaving unexpectedly, the hard part is usually finding who defined it.
:put =strtrans(@q)<CR>
Macro failures are often caused by hidden control keys like , , or tabs that are hard to see in raw register output.
:echo getreg('a', 1, 1)
For advanced register debugging and macro tooling, plain getreg('a') is often not enough.
:packadd termdebug | Termdebug ./a.out
If you only debug occasionally, loading termdebug on demand keeps startup lean while still giving you an in-editor GDB workflow.
:verbose nmap <lhs>
When key behavior is inconsistent, the root cause is usually mapping precedence.
command-line #command-line #mappings #debugging #config #normal-mode
:packadd termdebug | Termdebug
For quick debugging without leaving Vim, the built-in termdebug plugin wires a GDB session directly into your editing workflow.
:echo string(getreg('q'))
Macros can fail for subtle reasons: hidden control keys, extra whitespace, or unexpected register contents.
registers #registers #macros #debugging #automation #command-line
:redir @a | messages | redir END<CR>
When debugging a session or building repeatable edits, it is useful to turn command output into editable text.
vim.print()
vim.
:lua = {expression}
In Neovim, :lua = expr is a shorthand that evaluates a Lua expression and pretty-prints the result using vim.
:checkhealth {module}
:checkhealth {module} runs the health check only for the specified module, making it much faster than the full :checkhealth which interrogates every registered
command-line #neovim #diagnostics #debugging #plugins #health
: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.
:reg {name}
The :reg {name} command displays the current contents of one or more named registers in a formatted listing.
:LspInfo
The :LspInfo command, provided by the nvim-lspconfig plugin, opens a diagnostic floating window showing every active LSP client and its configuration for the cu
:put =execute('messages')
Vim's :messages command shows recent output — error messages, echo'd values, and diagnostic information — but the display is ephemeral and hard to search.
:debug
The :debug command prefix puts Vim into its built-in interactive debugger before executing the given command.
command-line #ex-commands #debugging #command-line #vimscript
:set {option}&
Append & to any :set command to reset that option to its compiled-in default value — the value Vim shipped with before any vimrc or plugin changed it.
:InspectTree
Opens an interactive split window showing the treesitter parse tree for the current buffer.