matlab.nvim provides debugging support using MATLAB's native debugging commands. The plugin integrates MATLAB's debugger with Neovim through tmux.
- Backend: MATLAB's built-in debugger (
dbstop,dbcont,dbstep, etc.) - Interface: Neovim signs, commands, and debug sidebar
- Execution: All debug operations run in the tmux MATLAB pane
- Visual indicators: Red circle (●) for breakpoints, blue arrow (▶) for current line
- Interactive toggling: Set/clear breakpoints with
<Leader>mdb - Persistence: Breakpoints maintained within session
- Synchronization: Neovim breakpoints sync with MATLAB debugger
- Start/Stop:
<Leader>mds/<Leader>mdq - Stepping: Step over (
<Leader>mdn), into (<Leader>mdi), out (<Leader>mdo) - Continue: Run to next breakpoint with
<Leader>mdc - Global F-keys: During debugging, F5/F10/F11/F12 work from ANY buffer
- Toggle:
:MatlabDebugUIor<Leader>mdu - Shows: Variables, call stack, and breakpoints
- Navigation: Press
<CR>on stack frames or breakpoints to jump to location - Refresh: Press
rto refresh,wto update workspace
- Open MATLAB file in Neovim (inside tmux)
- Start MATLAB server:
:MatlabStartServer - Set breakpoints:
<Leader>mdbon desired lines - Start debugging:
<Leader>mdsorF5 - Step through code:
F10(over) /F11(into) /F12(out) - Inspect state via debug sidebar:
<Leader>mdu - Stop debugging:
Shift+F5or<Leader>mdq
Use MATLAB's native commands directly in the tmux pane:
dbstop in myfile at 22 if x > 5
dbstop in myfile at 33 if strcmp(status, 'error')| Mapping | Command | Description |
|---|---|---|
<Leader>mds |
:MatlabDebugStart |
Start debugging session |
<Leader>mdq |
:MatlabDebugStop |
Stop debugging session |
<Leader>mdc |
:MatlabDebugContinue |
Continue to next breakpoint |
<Leader>mdn |
:MatlabDebugStepOver |
Step over (next line) |
<Leader>mdi |
:MatlabDebugStepInto |
Step into function |
<Leader>mdo |
:MatlabDebugStepOut |
Step out of function |
<Leader>mdb |
:MatlabDebugToggleBreakpoint |
Toggle breakpoint |
<Leader>mdB |
:MatlabDebugClearBreakpoints |
Clear all breakpoints |
<Leader>mde |
:MatlabDebugEval |
Evaluate expression |
<Leader>mdu |
:MatlabDebugUI |
Toggle debug sidebar |
| Key | Action |
|---|---|
F5 |
Continue (or Start) |
F10 |
Step Over |
F11 |
Step Into |
F12 |
Step Out |
Shift+F5 |
Stop Debug |
| Key | Action |
|---|---|
q |
Close sidebar |
r |
Refresh display |
w |
Update workspace from MATLAB |
<CR> |
Jump to location under cursor |
The plugin sends these commands to MATLAB:
dbstop in file at line- Set breakpointdbclear file at line- Clear specific breakpointdbclear all- Clear all breakpointsdbcont- Continue executiondbstep- Step overdbstep in- Step into functiondbstep out- Step out of functiondbstack- Show call stackdbstatus- Show all breakpointsdbquit- Exit debug modewhos- Show workspace variables
- No conditional breakpoints via UI (use MATLAB commands directly)
- No watch expressions
- Requires tmux environment
Breakpoints not working: Ensure line contains executable code (not comments/empty)
Commands fail: Verify MATLAB server is running (:MatlabStartServer)
Debug line not updating: Run :MatlabDebugUpdateLine to manually refresh