Custom Views
You can write your own views. If you are a plugin author, this allows you to embed your plugin into nvim-dap-view.
If you are a regular user and you are missing a view, consider making a feature request instead of writing your own implementation.
Writing a custom view is similar to writing a custom button . A view consists of an ID and 5 fields:
- A
label, the string that will show up in the user's winbar - A
short_label, which is used when there's not enough space to display the whole winbar - An
actionfunction to render the component - A
keymap, which will trigger the action - A
bufferfunction that will create a new buffer and return itsbufnr
The logic after the action is triggered is not handled by nvim-dap-view.
Example
A bare bones view would consist of:
return {
winbar = {
custom_sections = {
my_new_view = { -- the ID
label = "My new view",
short_label = "mnv",
action = function()
vim.print("Hi from view")
end,
keymap = "M",
buffer = function()
return vim.api.nvim_create_buf(true, false)
end,
},
},
},
} To add a custom view to your config, just add it to the sections table as if it was a regular view:
return {
winbar = {
sections = {
"my_new_view",
-- ...
},
},
} Register View
If you are a plugin author, you can use the register_view function to ensure your view is loaded. By doing that, users don't have to create the custom view "manually". An example can be found here .