Run a command in debugging mode
Example
Normal 0 / 3Command-line 1 / 3Debug 2 / 3Debug 3 / 3Run a command in debugging mode.
Loaded legacy function
function! Twice(n) abort return a:n * 2 endfunction
Command entered · ready to apply
Loaded legacy function
function! Twice(n) abort return a:n * 2 endfunction
Command line
- Typed text
:debug call Twice(3)- Insertion offset
20
Stop before call Twice(3). The function has not been entered; use step to enter it.
Loaded legacy function
function! Twice(n) abort return a:n * 2 endfunction
Debugger
- Context
before calling Twice- Next command
call Twice(3)- Prompt
>
Step into Twice and stop before return; a:n is now 3.
Loaded legacy function
function! Twice(n) abort return a:n * 2 endfunction
Debugger
- Context
function Twice- Next command
return a:n * 2- a:n
3- Prompt
>
Before & after
Before
Loaded legacy function
function! Twice(n) abort return a:n * 2 endfunction
After
Loaded legacy function
function! Twice(n) abort return a:n * 2 endfunction
Debugger
- Context
function Twice- Next command
return a:n * 2- a:n
3- Prompt
>
Documentation-backed illustration. Twice is loaded with the shown body; :debug and +eval are available. Stop before call Twice(3). The function has not been entered; use step to enter it. Primary help: :debug.
alpha
beta
gammaCursor on line 1, column 1Details & Vim help
Run a command in debugging mode. This Ex reference uses the full command name; the alphabetical index omits arguments. Supply the ranges, arguments, flags and prerequisite state documented in the linked help. Press Enter to submit a complete command. The index spelling :deb[ug] puts the optional abbreviation suffix in square brackets; those brackets are not typed. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.