debuggingneovimlazyvim

How to switch stack frames when debugging with LazyVim with dap?


How do I switch stack frames and jump to the corresponding source file in NeoVim's dap provided by LazyVim? I want something like shown in this video around 3:25 but I don't know which key should I press. I tried pressing enter, but it doesn't work.


Solution

  • Switching frames in the nvim-dap-ui Stacks panel uses the nvim-dap-ui "open" keybind, which is o by default. Enter is the "expand" keybind, which shows/hides anything with an ▸ expander, but doesn't focus it.

    If you don't like that you can change the keybindings specifically for the stacks panel (since v2.2.0): for example,

    element_mappings = {
        stacks = {
            open = "<CR>",
            expand = "o",
        }
    },
    

    in the nvim-dap-ui config will swap those two keys so that enter focuses a stack frame and "o" toggles the expander open/closed. Or you can do whatever you want.