DEBUG in Neovim. Like a BOSS.
HTML-код
- Опубликовано: 1 июн 2024
- Neovim is an amazing environment but it always had one major "flaw" is it was aiming for a place among other IDEs - a debugging functionality.
Since in its core, Vim is a text editor, every other functionality is provided by plugins. But it's not all that difficult! With a small set of plugins we can run a debugging session, with nice visualization and expression console right in Neovim!
LINKS AND TOOLS MENTIONED
▶ Lex Friedman / John Carmack interview: • John Carmack: Best pro...
▶ DAP: github.com/mfussenegger/nvim-dap
▶ DAP Virtual Text: github.com/theHamsta/nvim-dap...
▶ Adapter for Golang: github.com/leoluz/nvim-dap-go
MY FAVOURITE GEAR
* If you enjoy my content, using the links below will help me with a small commission, so thank you!
⌨️ My keyboard is the wonderful HHKB: amzn.to/3HwJG60
🔗 The HHKB is wired with a high quality coiled cable: amzn.to/3DCA87d
⌨️ Backup keyboard (for traveling mainly) - Nuphy Air60: amzn.to/3R3M7jz
🖥️ My ultra wide 49" monitor: amzn.to/3JbVThC
🎙️ Microphone - Shure MV7X: amzn.to/3kA7tZZ
🦾 Boom Arm - amzn.to/3ZmQgln
🎤 Audio Interface (for XLR microphones) - Focusrite Scarlett Solo: amzn.to/3Z3fBkQ
🦾 Heavy Duty Monitor Arm: amzn.to/3kKp7tS
🖱️ Mouse - MX Master 3: amzn.to/3DiZmaj
📷 Camera - ZVE10: amzn.to/3I1jfVS
🎥 Lens - Sigma 1.4 16mm: amzn.to/3BfFN15
CONSIDER SUPPORTING THIS CHANNEL
☕ Buy me a coffee: www.buymeacoffee.com/omerxx
🎷 60 day free Epidemic Music!: share.epidemicsound.com/w6zfxo
MY KEY LINKS
🍿 Subscribe: www.youtube.com/@devopstoolbo...
🌍 My website: omerxx.com
🗞️ Dev & Ops tools Telegram channel: t.me/espressops
🎙️ DevOps Topeaks Podcast: topeaks.buzzsprout.com
⏱ Timestamps
00:00 - Intro
01:00 - What it looks like
02:45 - Debugging terminology explained
03:45 - Using the UI
04:55 - Configuration
06:12 - Example debug session
08:16 - Customization
09:00 - Final words
#neovim #debug #debugtips #devops #ops #productivity #dev #terminal #tmux #system #sysadmin #cloud #cli #ops #ricing #linux #macos #commandline #typing #keyboard #tutorial #beginner - Наука
Bro taking the opportunity to flex his forearms
😂
I have to get rid of them. They’re too big
switching to Neovim was one of the best decisions i made and i mostly work in web dev and a little python and rust for my side projects.
Vscode could be regarded as the best experience especially if you are working in web dev but what most people forget is that installing 10 plugins to provide info and utilities is only going to help not make you a better programmer and most of the essential plugins are already available in neovim.
For me atleast neovim provided a much much better experience and feels way more like an IDE after setting it up rather than VScode's impersonation of an IDE and switching actually made it more clear how much of a memory hog VScode is.(aka i can run 2 environments due to FullStack development and my laptop does not die completely on running).
Anyone that is still in doubt take some time to learn neovim and using terminals like kitty or tmux in tandem and i promise it will be a far better experience.
This is a wholesome comment 🫶
Thanks for taking the feedback and explaining a setup for a language other than TypeScript! Great video!
Love your videos about vim and other terminal staff ! Thanks.
Really great content. Thanks a lot for this one. It was really useful for me to see the setup of debugger in Neovim. I have used Neovim for more than 1 year now but with no debugger at all. Now I'll try these plugins that you mentioned since I am using go as well 😃
Yes!! Let me know how it goes!
As always another amazing content. Thank you for sharing your knowledge
You've got the best thumbnails in all of vimspace!
Haha thanks! I’m trying 😅
Thank you!! Was waiting for this one for a while! Great surprise for today and will try this during the weekend :)
Yes! Let me know how it goes!!
Used this as a basis for setting up with C++. Thanks very much! Great video.
🙏🏽
Incredible video, amazing quality. Thanks!
Thanks buddy! 🙏🏽
Hey, thanks for an amazing video!
Awesome video content!
I loved your NeoVim background with that texture and transparency!
Can you explain how you achieve that effect?
Thanks! TBH this used to be my setup with Wezterm transparency, but this is just a visual editing effect 😅
@@devopstoolbox cool! 😄
Great content man!
Amazing! Very helpful
😉
Nice vid. Using dap as well. I used intellij ide with the same results. I was wondering if you could see value of a parameter in a pop-up when you are on the variable. That is sometimes handy when dealing with arrays
Hmmm 🤔 definitely interesting !
Sounds like this would require some lua and can be VERY helpful. At the end of the day , the UI is a bunch of buffers, that you can open wherever you choose, I don’t see a reason why you couldn’t.
BTW, you could switch you main screen the variable console buffer for quick investigation and then scroll it back
Hey love your vids. They are really making me excited about code and neovim! A couple of questions. How did you get the Red Dot in your config file? Sorry if this is easy and I dont know it. Also, how did you get Telescope and other pop ups to be so nicely styled? I am using capucino and mine does not look so vibrant. I know not substantive... but really curious how you got yours looking so cool!
Hello mate! Thanks for the kind words:)
The red breaking point is just a configuration of the plugin where I replaced the icons. Checkout my dotfiles here: dotfiles.omerxx.com
Let me know if you don’t find what you’re looking for!
@@devopstoolbox Hey rock star... I got the char to show by adding some fonts that
@@devopstoolbox Hey rock star. I found a little more info. I needed to install the font that had U1F534 in it. Then the dot shows up. In windows or linux it will always be the set foreground colour and will on linux have lines through it. Android and Macs will show it as a big red circle. Even as a greed dot.... it totally serves the purpose. Thanks for the great vids and I will look forward to many more!
Really nice video, what's the name of the plugin that autocompletes commands that you used for PackerSync ?
I’ve moved from Packer to Lazy since:) but vim should be aware of exposed methods for different plugins. Is that not something you get trying to run tab completions?
Great video! How are you highlighting the line that you are currently breaked on?
Hey! Thanks!
So break line is just a feature of DAP, which you can match to whatever you want as a key map, and the sign is also controlable (in my case - a big red dot), the line is auto marked by DAP when you're in a debug session. I didn't make any special changes there but you're more than welcome to check my dotfiles: dotfiles.omerxx.com
Is DapUiToggle command removed from the nvim-dap plugin? I am not seeing it after plugin install.
When I set the keymap for the debugger I have an error saying that telescope can’t be found. I’ve verified and telescope is not using any of the keymaps I use for the debugger. Any keymap gives me the error. Do you have an idea on what’s happening?
Hard for me to say TBH. Try following my dotfiles, although these have changed quite a lot since.
@@devopstoolbox thanks so much for your reply. I’m using lazyVim and on their website they have the setup for DAP. It works fine now
I would very much like to know if there's a way to set up run configurations in the DAP, like PyCharm has, so that I can define a custom command, with custom environment variables and other settings, and then debug using the normal DAP process. That's the only feature left that I have in PyCharm but not Neovim.
Trying to follow: are you referring to changing code *while* debugging or something else?
@@devopstoolbox I'm trying to have a config file, similar to launch.json in VSCode or the run configs in PyCharm that contains all the environment variables, command and parameters, etc that I need to run my code (the one I'm working on now is an AWS lambda so it is more complicated than just running the python file) and then once it runs that code I need to be able to step though it with my existing breakpoints.
I have gotten as far as learning how to get the local sam container running entirely from the command line, and set up with a debug port open, but I'm not sure how to get nvim-dap to attach to that port and communicating with the aws lambda function within so I can debug using neovim.
I find vscode debugger for my django apps really slow (startup and repl dev cycle takes a ~minute)
But my golang debugger in code is pretty fast.
Maybe neovim based debugger will fix my django debugging experience.
I subscribed, thanks!
Thank you! I feel like it’s more about the debugger server rather than vscode but do let me know what you find!
Please do you have a video of your config? Looks so cool.
ruclips.net/video/aeQn9MRTjxc/видео.html
This is a video of what I got, the config is in my dotfiles repo (omerxx/dotfiles) and a video is coming up soon enough :)
Niiiice !! Finally someone talking about this in a detailed way.
Amazig video! I'm using golang all the time so this works perfect! I was wondering if you have something similar for python
Nice! Let me know how it goes!
TBH most of my work these days is purely Go, but Python should work exactly the same only with another debugger backend. You should be able to use the UI and DAP exactly the same
Thanks for the cool video. I didn't see anything mentioning about that you have to have dlv installed as prerequisite if anybody wonders why it's not working on his/her machine.
If I missed that you’re absolutely right. And while we’re at it it’s important to add that you’d have to use the debug server that matches the language you’re working with
how can i inspect memory in c? like the stack, heap and registers?
I’m guessing your going to need a similar profiler built for C
I tried using it on my M2 Mac Air and can't debug go, but python does, I don't know if DLV is not compatible with Arm's macOS
Interesting. Is there an m2 specific release? I used an m1 and went ok. To be sure maybe build from source?
what if i want to use DAP for java do i need a JAVA adapeter for DAP, like wise javascript adapter for JAVASCRIPT? C adapter for DAP in case of C/C++ language ?
Any ways this is the unique video i am looking for.. thankyou
Hi! Yes, exactly, here's a list of available adapters: microsoft.github.io/debug-adapter-protocol/implementors/adapters/
And specifically for Java: github.com/Microsoft/vscode-java-debug
I always wanted to have some fzf CMd searching and triggering ability. Vim built-in `:` can only strictly match what user is typing and can only use arrow keys or tab to switch cmds
You can achieve that with telescope for pretty much anything. What would you like to have it for ? Literally commands you type? As in the command history like you have in your terminal?
@@devopstoolbox LintaoAmons/easy-commands.nvim
I want to have VSCODE/IDEA like command fzf search and trigger function~ Right now I am using fzf-lua to achieve this
Please post a video about setting up DAP with C language
Hi! While I’m not coding in C I don’t think it would be any different. Only instead of using the last bit here that’s basically a go-delve server, you’d use a C debugger!
I have done it by reading nvim-dap docs. Anyway thanks for your immediate response
@@ragulr1566 🤩
I like neovim but i prefer classical gui based ide's, because i had always the expierience that vim/neovim is a neverending story for me. I'm to impatient for it, to come to a point where i'm very happy with it.
I get it. But you’ve got lazy nvChad and the likes or simply kickstarter.nvim
And, if at the end of the day you don’t want to configure anything, checkout Helix!
@@devopstoolbox does one of them support dotnet?
@@devopstoolbox i tried nvChad and it's not as userfriendly as any other modern gui based ide or texteditor. First you have to know which key is the leader key in the base dir. Then you must know how to change the working dir in nvimtree. All things you have to look up. These are all things that you get for free in an modern editor, because you can use a mouse pointer and context menü's. I dislike neovim and will stay at jetbrains products, because they work out of the box fine!
nvim-dap-ui is bugged. for instance lua output's goes into REPL pane instead of console pane.
I don't remember seeing that... but yeah it can get clunky. It's usually my go to but I'm wondering whether its clunkiness is what's stopping others from taking it on
5:51
Is working for you?
Are you also a climber?
I am :)
What gave it away?
@@devopstoolbox haha you made a comment in one of your git videos about climbing and then someone below mentioned your forearms. I also climb too. Anyway I appreciate your content!
@@_fellow_ Haha hilarious, I thought it was the one thing I managed to hide 😂
Neovim is PDE.. not IDE
Yes, I agree. However referring to it as “just a text editor” isn’t doing justice IMO
@@devopstoolbox 🙃 i would argue it's just a text editor without plugins... so i use it with -U=NONE flag in my scripts, like as a pager for manpages
because it has nothing for a ide without plugins... compared vscode (yes, an ide), which has lot of stuff build in like a git integration and project management and complete intelinse for javascript without any plugin
@@vaisakhkm783 let me put it like that: you’re right. And the main reason I use vim is not because of its IDE capabilities that I can easily get with a bunch of plugins, but for its text editing features! So you’re point is made, but I take productivity of writing as the top priority and the rest comes next. Since I get everything - lsp, git, debugger etc (yea with plugins) where I can customize and play with the env, it’s a no brained for me
@@devopstoolbox yes yes... XD...
- it's a text editor for those don't know about plugins...
- it's a IDE for those nvim distribution users who doesn't customize anything...
- it's a PDE for those who configure more than actually code (which is me XD)
Odd starting off with John Carmack who uses jetbrains in a vim video
Like a good dev, I cherry picked 🤣
What’s odd is a comment that assumes a non-vim user (John Carmack) couldn’t possibly say something relevant for vim users.
@@cpplain 😅
Every programmer deserves a better debugger.
Use an IDE and get rid of this suffering 🤮
Neovim IS an IDE 😉