FAQ
Why add nvim-dap-view
as a dependency for nvim-dap
?
By default, when launching a new session, nvim-dap
’s terminal window takes half the screen. As a saner default, nvim-dap-view
hijacks the terminal window (even if not invoked), making the split take only 12 lines (a setting which is of course, configurable). See this related issue (from nvim-dap-ui
). Of course, this workaround only works if nvim-dap-view
is loaded when a session starts.
-- Your nvim-dap config
return {
{
"mfussenegger/nvim-dap",
dependencies = {
{ "igorlfs/nvim-dap-view", opts = {} },
...,
},
...,
},
}
DapViewWatch
isn’t adding the whole variable
In normal mode, :DapViewWatch
expands the <cexpr>
under the cursor (see :h <cexpr>
). By default, this setting works really well for C-like languages, but it can be cumbersome for other languages. To handle that, you can tweak the value for the 'iskeyword'
option (see :h 'iskeyword'
). For instance, with PHP, you can use set iskeyword+=$
.
How to control which window will be used when jumping to a breakpoint or a call in the stack?
nvim-dap-view
ships its own switchbuf
(see :h 'switchbuf'
), which supports a subset of neovim’s built-in options: newtab
, useopen
, usetab
and uselast
. You can customize it with:
return {
switchbuf = "useopen",
}
You can use a commas to define fallback behavior (e.g., "useopen,newtab"
creates a new tab if the buffer is not found).
nvim-dap
is overriding one of the nvim-dap-view
’s windows on stop
When windows.terminal.position
is right
the views window may be used to display the current frame, because nvim-dap
has its own internal switchbuf
setting (see :h 'switchbuf'
), which defaults to the global switchbuf
option. A common solution is to set nvim-dap
’s switchbuf
to another value. For instance:
-- Don't change focus if the window is visible, otherwise jump to the first window (from any tab) containing the buffer
-- If no window contains the buffer, create a new tab
require("dap").defaults.fallback.switchbuf = "usevisible,usetab,newtab" -- See :h dap-defaults to learn more