Skip to content

Commit 56c651a

Browse files
committed
feat: tweak docs, simplify auto toggle setup
1 parent 6fe523b commit 56c651a

File tree

14 files changed

+57
-46
lines changed

14 files changed

+57
-46
lines changed

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> minimalistic [nvim-dap-ui](https://github.com/rcarriga/nvim-dap-ui) alternative
44
5-
<https://github.com/user-attachments/assets/f75bf535-1d9e-4070-8c7b-96026c343b47>
5+
<https://github.com/user-attachments/assets/e7d428f2-8361-4407-a4d0-5f3c4f97332e>
66

77
## Installation
88

@@ -27,13 +27,18 @@ return {
2727
- Watch expressions
2828
- Manipulate breakpoints
2929
- Navigate in the call stack
30-
- Convenient wrapper around `nvim-dap` widgets (scopes) + REPL
30+
- Inspect all variables in scope[^1]
31+
- REPL
3132

3233
All of that in a unified, unintrusive window.
3334

34-
## Documentation
35+
## Getting Started
3536

36-
Visit the full documentation on the [website](https://igorlfs.github.io/nvim-dap-view/home).
37+
Start a regular debugging session. When desired, you can use `:DapViewOpen` to start the plugin. You can switch to another section using the letter outlined in the `'winbar'` (e.g., `B` for "Breakpoints"). Explore what you can do each section by using `g?` to inspect the keymaps.
38+
39+
Once you're done debugging, you can close the plugin with `:DapViewClose` and then terminate your session as usual.
40+
41+
There's a lot more you can do: `nvim-dap-view` is highly customizable. To learn all the options, commands, tips and tricks, visit the full documentation on the [website](https://igorlfs.github.io/nvim-dap-view/home).
3742

3843
## Contributing
3944

@@ -43,3 +48,5 @@ You can contribute in many ways:
4348
- If something isn't working, create a [bug report](https://github.com/igorlfs/nvim-dap-view/issues/new?template=bug_report.yml).
4449
- If you have an idea, file a [feature request](https://github.com/igorlfs/nvim-dap-view/issues/new?template=feature_request.yml). You can also go ahead and implement it yourself with a [PR](https://github.com/igorlfs/nvim-dap-view/compare).
4550
- If you have some spare bucks, consider [sponsoring](https://github.com/sponsors/igorlfs).
51+
52+
[^1]: using nvim-dap's widgets

docs/src/posts/acknowlegdgements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
title: Acknowledgements
33
---
44

5-
- [nvim-dap-ui](https://github.com/rcarriga/nvim-dap-ui) is obviously a huge inspiration!
5+
- [nvim-dap-ui](https://github.com/rcarriga/nvim-dap-ui) is obviously a huge inspiration!
66
- Code to inject treesitter highlights into line is taken from [quicker.nvim](https://github.com/stevearc/quicker.nvim)
7-
- [lucaSartore](https://github.com/lucaSartore/nvim-dap-exception-breakpoints) for the inspiration for handling exceptions breakpoint
7+
- [lucaSartore](https://github.com/lucaSartore/nvim-dap-exception-breakpoints) for the inspiration for the handling of exception breakpoints
88
- [Kulala](https://github.com/mistweaverco/kulala.nvim) for the creative usage of neovim's `'winbar'` to handle multiple "views"
99
- [blink.cmp](https://github.com/Saghen/blink.cmp/blob/main/lua/blink/cmp/config/utils.lua) for the config validation (which is partially taken from a PR to [indent-blankline](https://github.com/lukas-reineke/indent-blankline.nvim/pull/934/files#diff-09ebcaa8c75cd1e92d25640e377ab261cfecaf8351c9689173fd36c2d0c23d94R16))

docs/src/posts/automatic-toggle.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/src/posts/basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Getting started with `nvim-dap` is easier than it sounds! This guide aims to exp
77

88
First things first: what is the DAP? Much like the LSP, the DAP is a protocol created to solve a scalability problem: it used to be the case that each text editor had to have a custom integration for each debugger they wanted to support. That means handling the communication was a nightmare: each debugger has its own way of defining breakpoints, or evaluating expressions and whatnot. What DAP brings to the table is a standardization for this communication, massively simplifying the implementation.
99

10-
To accomplish its goal, the DAP introduces the concept of **debug adapters**: programs that make debuggers comply with the protocol (in fact, many debuggers actually support the protocol natively, such as `gdb`). The first step (after installing the plugin) to setup `nvim-dap` is choosing an adapter, which will depend on the language you're using. You can install an adapter with your system's package manager (or, most likely, using [mason.nvim](https://github.com/mason-org/mason.nvim)). To give some concrete examples, this guides picks `codelldb`: [a powerful adapter](https://github.com/vadimcn/codelldb) which can be used for C, C++ and Rust. Under the hood, `codelldb` (the adapter) uses `lldb` (the debugger). To configure `codelldb` (or any adapter, for that matter) refer to `nvim-dap`'s [wiki](https://codeberg.org/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation). There, we can find a [snippet](https://codeberg.org/mfussenegger/nvim-dap/wiki/C-C---Rust-(via--codelldb)#1-11-0-and-later) to define `codelldb`:
10+
To accomplish its goal, the DAP introduces the concept of **debug adapters**: programs that make debuggers comply with the protocol (in fact, many debuggers actually support the protocol natively, such as `gdb`). The first step (after installing the plugin) to setup `nvim-dap` is choosing an adapter, which will depend on the language you're using. You can install an adapter with your system's package manager (or using [mason.nvim](https://github.com/mason-org/mason.nvim)). To give some concrete examples, this guides picks `codelldb`: [a powerful adapter](https://github.com/vadimcn/codelldb) which can be used for C, C++ and Rust (and other low level languages). Under the hood, `codelldb` (the adapter) uses `lldb` (the debugger). To configure `codelldb` (or any adapter, for that matter) refer to `nvim-dap`'s [wiki](https://codeberg.org/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation). There, we can find a [snippet](https://codeberg.org/mfussenegger/nvim-dap/wiki/C-C---Rust-(via--codelldb)#1-11-0-and-later) to define `codelldb`:
1111

1212
```lua
1313
require("dap").adapters.codelldb = {

docs/src/posts/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ These are the default options from `nvim-dap-view`. You can use them as referenc
88

99
```lua
1010
return {
11+
auto_toggle = false,
1112
winbar = {
1213
show = true,
1314
-- You can add a "console" section to merge the terminal with the other views

docs/src/posts/control-bar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Control Bar
44

55
The control bar is disabled by default. It can be enabled by setting `winbar.controls.enable`.
66

7-
<img src="https://i.ibb.co/Hf6V22Hw/dapview-control-bar.png" alt="control bar">
7+
<img src="https://i.ibb.co/wNbqBnyN/image.png" alt="control bar">
88

99
## Options
1010

docs/src/posts/faq.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: FAQ
44

55
## Why add `nvim-dap-view` as a dependency for `nvim-dap`?
66

7-
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](https://github.com/rcarriga/nvim-dap-ui/issues/407) related issue (from `nvim-dap-ui`). Of course, this workaround only works if `nvim-dap-view` is loaded when a session starts.
7+
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](https://github.com/rcarriga/nvim-dap-ui/issues/407) related issue (from `nvim-dap-ui`). Of course, for this workaround to work, `nvim-dap-view` has to load before a session starts.
88

99
```lua
1010
-- Your nvim-dap config
@@ -20,6 +20,10 @@ return {
2020
}
2121
```
2222

23+
## How can I see value of an expression under cursor (hover)?
24+
25+
You can use `nvim-dap` built-in hover widget by calling `require("dap.ui.widgets").hover()`. See `:h dap-widgets` for details.
26+
2327
## `DapViewWatch` isn't adding the whole variable
2428

2529
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+=$`.
@@ -36,7 +40,7 @@ return {
3640

3741
You can use a commas to define fallback behavior (e.g., `"useopen,newtab"` creates a new tab if the buffer is not found).
3842

39-
## `nvim-dap` is overriding one of the `nvim-dap-view`'s windows on stop
43+
## `nvim-dap` is overriding one of the `nvim-dap-view`'s windows when the program stops
4044

4145
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:
4246

docs/src/posts/hide-terminal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ return {
1818

1919
## Anchoring
2020

21-
In some scenarios, it's useful to use another window as if it was `nvim-dap-view`'s terminal. One such scenario is when using the `delve` adapter for Go (more specifically, coupled with an `attach` request): the window with the terminal that launched `dlv` can act as if it was the `nvim-dap-view`'s terminal window. By doing that, `nvim-dap-view`'s main window will "follow" `delve`'s window (i.e., `nvim-dap-view`'s main window will open by the side of `delve`'s window). Watch this [video](https://github.com/user-attachments/assets/5dce4b3d-fc01-4be6-9a72-b0f969e34b14) for context.
21+
In some scenarios, it's useful to use another window as if it was `nvim-dap-view`'s terminal. One such scenario is when using the `delve` adapter for Go (more specifically, when using an `attach` request): the window with the terminal that launched `dlv` can act as if it was the `nvim-dap-view`'s terminal window. By doing that, `nvim-dap-view`'s main window will "follow" `delve`'s window. Watch this [video](https://github.com/user-attachments/assets/5dce4b3d-fc01-4be6-9a72-b0f969e34b14) to see what it looks like.
2222

2323
To achieve that, in addition to hidding the terminal for `delve` (see above), you have to create your own `anchor` function that returns a window number (or `nil`). If `nil` is returned, there's a fallback to the default behavior. Here's a simple function you can use:
2424

docs/src/posts/home.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ title: NVIM DAP View
55
> Modern, minimalistic debugging UI for neovim
66
77
<video controls width="100%">
8-
<!-- TODO: update video -->
9-
<source src="https://github.com/user-attachments/assets/01c461f7-b77b-4232-bed5-4630f3e7c039" type="video/webm" />
8+
<source src="videos/dv-demo.mp4" type="video/mp4" />
109
<track kind="captions">
1110
</video>
1211

@@ -89,11 +88,11 @@ The console's default height is resized to match your `nvim-dap-view` configurat
8988

9089
`nvim-dap-view` also provides a "non view" component: the control bar, which exposes some clickable buttons to control your session. It's disabled by default. See details on how to enable and configure it [here](control-bar).
9190

92-
<img src="https://i.ibb.co/Hf6V22Hw/dapview-control-bar.png" alt="control bar">
91+
<img src="https://i.ibb.co/wNbqBnyN/image.png" alt="control bar">
9392

9493
## Usage
9594

96-
Learn about `nvim-dap-view`'s [commands](commands) and [keymaps](keymaps) to get started. If it's your first time setting up `nvim-dap`, start [here](basics). By default, `nvim-dap-view` **is not launched automatically** (i.e., when initializing a new session), you have to use the commands or the API. To configure this behavior, visit the [automatic toggle](automatic-toggle) guide.
95+
Learn about `nvim-dap-view`'s [commands](commands) and [keymaps](keymaps) to get started. If it's your first time setting up `nvim-dap`, start [here](basics). By default, `nvim-dap-view` **is not launched automatically** (i.e., when initializing a new session), you have to use the commands or the API. To change this behavior, enable the `auto_toggle` option.
9796

9897
## Customization
9998

docs/src/posts/known-issues.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ title: Known Issues
88
- Isn't updated when there's no active session
99

1010
These are limitations with the current API from `nvim-dap`. A new API is [planned](https://github.com/mfussenegger/nvim-dap/issues/1388).
11+
12+
## The terminal buffer is cleared right after a session finishes
13+
14+
Due to a limitation in the way multisession support is currently implemented, it's necessary to eagerly close buffers. Read [this](https://github.com/mfussenegger/nvim-dap/discussions/1523) discussion for details.

0 commit comments

Comments
 (0)