-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add TIL neovim debugging buffer open
- Loading branch information
1 parent
1d176ac
commit 29a0364
Showing
4 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
Binary file modified
BIN
-1.03 KB
(100%)
...23-12-20-til-how-to-use-tailscale-to-connect-to-k3s-pi-cluster/images/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+360 KB
...-how-to-use-open-buffers-when-debugging-with-neovim-dap-plugin/images/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+396 KB
...ow-to-use-open-buffers-when-debugging-with-neovim-dap-plugin/images/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions
29
...2-24-til-how-to-use-open-buffers-when-debugging-with-neovim-dap-plugin/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
title: "TIL: How to Use Open Buffers When Debugging With Neovim's DAP Plugin" | ||
date: 2023-12-24 | ||
canonicalURL: https://haseebmajid.dev/posts/2023-12-24-til-how-to-use-open-buffers-when-debugging-with-neovim-dap-plugin | ||
tags: | ||
- DAP | ||
- neovim | ||
- nvim | ||
series: | ||
- TIL | ||
--- | ||
|
||
**TIL: How to Use Open Buffers When Debugging With Neovim's DAP Plugin** | ||
|
||
I had an issue that whilst debugging my Golang tests in Neovim, the buffer I was focusing on would always change to | ||
the breakpoint. Even when the buffer was open and visible already, say I had the code with the breakpoint on the left | ||
buffer and the tests I was starting the debugger from on the right buffer. | ||
|
||
You can see the example belows: | ||
|
||
![Example Setup](images/example.png) | ||
|
||
When I start the DAP debugger on the right hand side, by using it to debug the nearest tests, the buffer will change | ||
to the breakpointed line. However I want it to use the open buffer on the left because it is already open. | ||
|
||
To do this we need to update our Neovim options: `vim.o.switchbuf = "useopen,uselast"`. This will now behave as we | ||
want. Note `uselast`, here is the default value for this option. You can read more about by typing `:help 'switchbuf`. | ||
|
||
That's it! We can now debugger our code and keep the layout we have. |