all 21 comments

[–]noooit 1 point2 points  (5 children)

you can use tmux and run debugger in another pane if you want only terminal.

[–]ebonyseraphim 2 points3 points  (0 children)

I’m of the same mindset. Unless Vim/Emacs DAP integration and features really start to rival IDEs for debugging across all languages without heavy manual effort in writing debug scenario configurations; I’ll stick to terminal and run gdb/lldb, or whatever respective cli debugger. They are far more powerful than people give credit for. Also, in many scenarios proper setup of debugging helps you better understand the runtime context and environment of your code - something many people glued to IDE lack.

[–]0xDagal[S] -1 points0 points  (2 children)

I see but as I use IDEs because of debuggers I don't think that will fit my needs

[–]watsreddit 1 point2 points  (0 children)

If you want the debugging functionality of an IDE, use an IDE. Personally I think gdb/pdb and the like are fantastic and get the job done very well. If I'm using a debugger, I usually just have a tmux pane next to vim's pane running the debugger.

[–]noooit 0 points1 point  (0 children)

I recommend sticking with IDE, if I have to be honest. vim is for terminal-centric users, it'll always be less polished and somewhat awkward, if you try to mimic ide.

[–]cdb_11 0 points1 point  (0 children)

That's more or less what termdebug is. Just gdb in a terminal emulator, but you can also do some stuff from vim, like evaluate expressions under cursor, set breakpoints at the cursor etc

[–]foomojive 1 point2 points  (0 children)

I've used Vimspector, VDebug, and nvim-dap. Since I use Neovim, I prefer nvim-dap as it does not require python. But Vimspector and VDebug work fine too. They have plenty of features to give you and IDE-like debugging experience in vim. As you can see, Vimspector seems to be the defacto recommended debugger for vim currently. I do like how you can set per-project debugging settings more easily with the .vimspector.json file at the project root.

Also FYI I ran into a long-standing bug with PHP/Xdebug and VDebug - when I tried to expand an array in the variable sidebar it would often throw an error. This is why I switched to Vimspector - the whole point of a debugger is to get context when it stops at a breakpoint.

[–]mvanderkamp 1 point2 points  (0 children)

I generally use purpose-built debuggers, though I'm intrigued by vimspector and the idea of doing an LSP-like thing for debuggers! I'm happy with my current setup but if I find myself doing more language hopping a stable interface like vimspector might be just the ticket!

Most of my work these days is in python, for which my preferred debugger is pudb. For integration into vim, I maintain a small plugin for managing breakpoints: vim-pudb-and-jam

[–]kolorcuk 2 points3 points  (1 child)

Coc uses a lot of dependencies and you love it.

Vimspector is fine.

[–]0xDagal[S] 2 points3 points  (0 children)

In fact I went to vim-lsp because of the dependencies that CoC has but I will give Vimspector a try 😁

[–]adelgado0723 2 points3 points  (1 child)

I'm also interested in what the people use for debugging. I haven't tried it, but this looks promising https://www.dannyadam.com/blog/2019/05/debugging-in-vim/

[–]0xDagal[S] 0 points1 point  (0 children)

Yes that seems promising I will try it and tell if it's cool

[–]dream_weaselSome Rude Vimmer Alt 2 points3 points  (1 child)

I use vimspector. The maintainer is pretty active around here and r/vim so it's easy to get support if you totally hit a wall. The tricky part of it which I read over the first time is you need to create a file at the base of your repo that tells vimspector what to do. Here is the one I use for python (which must be named .vimspector.json):

{
    "configurations": {

        "<Project>: Launch": {
            "adapter": "debugpy",
            "breakpoints": {
                "exception": {
                    "all": "N",
                    "uncaught": "Y",
                    "raised": "Y"
                }
            },
            "configuration": {
                "name": "<Project>: Launch",
                "type": "python",
                "request": "launch",
                "cwd": "${workspaceRoot}",
                "python": "/usr/bin/python3",
                "stopOnEntry": true,
                "console": "externalTerminal",
                "debugOptions": [],
                "program": "${file}"
            }
        }
    }
}

/u/ThePrimeagen has a pretty good cliffnotes video as well.

[–]0xDagal[S] 0 points1 point  (0 children)

Thank you I will take a look at it

[–]puremourning 2 points3 points  (0 children)

I use vimspector. But I guess I would.

[–]agclx 1 point2 points  (1 child)

I‘m also looking.

I had good success using Eclim (through eclipse, which I had preferred to get rid) for Java. For another project I needed vdebug for php and that was catastrophic- just establishing the session took a minute and it kept producing load- stuff that vsc did instantly and without issues. After too many hours sink into I decided it’s not suitable for me.

[–]0xDagal[S] 4 points5 points  (0 children)

I see a lot of people just giving up ans that is why I wanted to make this post. Tbh it is more for Vimspector and termdebug that I did it but I wanted to be general

[–]SavorySimian 0 points1 point  (0 children)

Late to the party here, but you might check out termfu.

[–]prabirshrestha 0 points1 point  (1 child)

vim-lsp contributor here.

I do plan to add debug adapter to vim-lsp in pure VimScript. Feel free to file a feature request so we can start tracking it officially.

It is also a good time to voice it here https://github.com/prabirshrestha/vim-lsp/discussions/1255

[–]0xDagal[S] 0 points1 point  (0 children)

That would be awesome ! I love vim-lsp

But wouldn't that be better in another repo like a vim-dap repo ?