The perfect Neovim setup for C++
Ғылым және технология
To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/DreamsofCode . The first 200 of you will get 20% off Brilliant’s annual premium subscription.
⚠️ NVChad has had some breaking changes, make sure to use the v2.0 branch if you're using this video. You can find the command below.
Commands:
NVChad Install line: git clone -b v2.0 github.com/NvChad/NvChad ~/.config/nvim --depth 1
Neovim has been the most loved editor for three years in a row, according to the stackoverflow developer survey.
In this video we look at setting up Neovim for C++ using NVChad, to create an editor experience worth loving.
This video was sponsored by Brilliant
Become a better developer in 4 minutes: bit.ly/45C7a29 👈
Join this channel to get access to perks:
/ @dreamsofcode
My socials:
Discord: / discord
Twitter: / dreamsofcode_io
My Equipment:
Coding: kit.co/dreamsofcode/coding
Audio: kit.co/dreamsofcode/voiceover
Video Links:
Final Config: github.com/dreamsofcode-io/ne...
NVChad: nvchad.com/
null-ls Sources: github.com/jose-elias-alvarez...
NVChad install line:
git clone github.com/NvChad/NvChad ~/.config/nvim --depth 1
00:00 Intro
00:15 Getting started
01:52 Autosuggestions
07:04 Autoformatting
10:31 Sponsor
11:50 Debugger
Пікірлер: 523
To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/DreamsofCode . The first 200 of you will get 20% off Brilliant’s annual premium subscription.
@fattoofittoo7907
6 ай бұрын
could you create Neovim setup for C?
@michaelmueller9635
6 ай бұрын
Is there a way to get the value of vectors/objects while debugging? I got the feeling, that - except for primitive data types - it's really hard to use the debugger.
@0xcoffee427
6 ай бұрын
@@fattoofittoo7907 for c also same or different ?
Thank you very much for this in-depth explanation of how to setup NvChad for C++ development 🙂I am looking forward to the CMake setup!
@thartanian
25 күн бұрын
Was there ever a video on nvim plugin for cmake/makefile? If not anybody have a setup for those?
Just when I was about to resume my old c++ project from a hiatus, you dropped this! What a great timing.
@dreamsofcode
11 ай бұрын
I hope it helps!
Thanks mate, my VSC died and couldn't run C++ earlier, I've always wanted to switch to NVIM and now I have done it finally, Thanks a lot again.
Thanks you for all your work and dedication! I really wanted to use nvim as my IDE for a long time, but any configuration really convinced me or worked for me until I found your NVChad series. It would be fantastic if you could also do a video making a Java setup :)
HUGE value in this video, just getting into nvim plus c++, this is the video I needed :)
Awesome video! I got into Neovim thanks to you and I'm absolutely loving it. Thank you for the amazing content 😊
Thank you for all your work, there was no other guide that was as thorough as this.
@dreamsofcode
7 ай бұрын
Glad it was helpful!
Amazing, as the whole series so far! thanks
I set up everything like was said in your video (which was great and really informative). Now I am just stuck on the build tools to save and update the build when learning. Please come out with that video as soon as possible!
This video can't be better. Thank you soooooooo much!
thank you for this video working exactly as you told in my own neovim configuration
You are awesome man !!! I also use arch and neovim. The quality content you provide are very consise and really helpful. You are really underrated !!
@dreamsofcode
11 ай бұрын
Thank you for the feedback! I appreciate it and am very glad you like the content!
@scraped_2454
11 ай бұрын
You forgot the "btw"
@roshanpaudel6352
11 ай бұрын
@@scraped_2454 😂 aww man !!
@joshuarose20
11 ай бұрын
guys, this guy uses arch linux btw
@scraped_2454
11 ай бұрын
@@roshanpaudel6352 Game is the game
This video is superb. I love your explanation and how you go through every single step. Very helpful! Thanks so much.
@dreamsofcode
11 ай бұрын
Thank you so much. I really appreciate that feedback!
you are a life saver, your video is just clear, easy to follow
Thank you! much appreciated for this!
This is an awesome series ! And it'd be cool if u could do a video for configuring neovim for java
Thanks for the config files in the description.
The video I was waiting for, thanks dreams!
@dreamsofcode
11 ай бұрын
I hope it helped!
Awesome video edition!!
Great effort thank you so much We need Front-End tools video
Really like your videos dude! Please keep it up.
Awesome! I am waiting for web development setup such as html/css/javascript on next video 👍
This is an awesome video. Thank you for explaining step by step how to proceed. However, I am a bit reluctant to go down the route suggested by you as null-ls is now deprecated. Do you have any thoughts on this?
I requested and you delivered. Thank you!
@dreamsofcode
11 ай бұрын
You're very welcome. I hope you like it!
For those who have problems in the last part when executing the "space nr" command. Make sure to include: event = "VeryLazy", after rcarriga/nvim-dap-ui and jay-babu/mason-nvim-dap.nvim in your lua/custom/plugins.lua file. The same thing happened to me and that's what I realized, in the video it shows it very fast at frame 13:20.
You read my mind! I have a setup for C but it's not perfect. Going to try your setup. Thanks!
Good job! thanks for this amazing video
I'd like to suggest Git for a future video. In particular tooling for resolving merge conflicts and navigating complicated branch structures. It's probably my favorite feature of Intellij and I don't know how to replicate it in Neovim.
@dreamsofcode
11 ай бұрын
This is a great idea!
@antoineleduc7611
11 ай бұрын
Lazygit
@jerrymann9332
9 ай бұрын
ironically, java is the only language I wouldn't use nvim for just because intelliJ is so goated. ideavim is a must though obviously
Great video - i would love if you could cover the promised Cmake/make integration within Nvim -
Great video man, the arch/nvim comunity most trully thanks and apreciate you
@dreamsofcode
11 ай бұрын
Thank you! I really appreciate that.
Nice video. I'd love to see stomething like this for the JavaScript and web development in general
@dreamsofcode
11 ай бұрын
I shall add it to the backlog, friend!
Great video exactly what I was looking for , can you please make a video/doc about the build plug-in you talk about thanks
@thartanian
25 күн бұрын
I don't see a video he made about that, do you have the setup tho?
I'd love one of these for C# as well!
Thanks mate! Amazing😊
Ik you probably won't read this, but I've been struggling for almost 5-6 hours to get the debugger to work for Neovim. I've done everything right, but never added --debug to the g++ compilation. Thank you.
This is great! Is there an easy way to have nvim configured for both Python and C++? How would you go about switching between both functionalities I watched your Python one and it really helped me get up and running quickly with nvim. I thought it was going to be an absolute nightmare trying to do it on my own. Thanks for these!
Would really appreciate that CMake video right about now
The configuration works fine, and It's pretty easy to understand. I just have one more question , if you could help me out. I do'nt know how if there's a built in configuration to see the outline of the buffer, I myself didn't find anyway. I also don't know how to set this up. Thanks for your job anyway.👏👏👏
Thanks a lot for the video. Is there similar instruction on how to add CMake support?
Thank you for the video. I followed all the steps and could add breakpoints with db but when I press dr I get "no configuration found for `cpp`. You need to add configs to `dap.configurations.cpp` (see `:h dap-configuration`)." Did I do something wrong?
@gregszalayofficial
3 ай бұрын
I had the same error. In my case I forgot the 'event = "VeryLazy"', line for the "jay-babu/mason-nvim-dap.nvim" plugin. Adding this fixed it.
Love this video. Please make a nvchad setup for unity development. Please 🙏
Perfect, exactly what I need❤
@dreamsofcode
11 ай бұрын
I hope it helps!
Thank you so much!!!!!!
great video thanks very much, can you point me in the right direction for the cmake addition? would love a method of building and running from inside nvim
Great video! Would you mind please share the setup of your terminal as well? thanks.
This is great, can you tell us what you use to create these amazing visuals in the video? What video editor and your configuration?
@dreamsofcode
11 ай бұрын
I'm using Davinci Resolve! I'm currently packaging up my custom effects in order to sell in the near future and will be doing tutorials on them on a new channel: @dreamsofmotion. I'll do a channel post when that drops!
Thanks for the tutorial. Was the video on how to invoke custom commands to build and jump to source code with errors ever created?
Thanks for your series! Would it be possible to add a CMake setup? I can't get neovim to resolve basic stuff like custom import directoy whenever I use a CMake based project.
thanks that was very helpfull
THank you so much for sharing!. Can you please make a tutorial o how to setup nvim for java application development.
Very consice and easy instructions to follow. I am learning NVim on windows and this is helping me set it up. Only one thing is that at 6:22 the suggestions and autocomplete are not as many as seen here. For me after 'std::' some functions only appear if I enter a character. I have installed Cpp-toolchain using MSYS so I have clang gcc cl compilers. But have set only gcc in the path. Is this the problem?
@Cyrsztof
Ай бұрын
Hi, sorry for digging your comment after few months, but did you find the solution to this problem? I'm having the exact same issue - most suggestions are missing for me. :/
Thank you very much!
@dreamsofcode
11 ай бұрын
You're welcome! Thank you for watching.
please make configuration for front end too, seems legit
i want to use it for c, everything working perfectly fine but when i trying to debug i got error. "No configuration found for 'c'. you need to add configs to 'dap.configurations.c'" any help?
@Kalasklister1337
3 ай бұрын
I assume you need to search which mason/nvim plugins you need for C DAP. DAP stands for debugger adapter protocol and it is seriously cool tech. You can even configure it so that you have your debugee on a server or a local docker container and debug without having any dependencies on your system. Just look around for C specific ways and you can get it to work
This video is awesome as I can get a good config without knowing much about neovim yet. I have a question that, sometime I make mistake in code and there is a message popped up: (fix available). How can I apply these fixes? Thank you.
Hi i just watched all videos of the playlist and i'm asking my self can i use all plugins at once (or a lot of them)? because for my work i need to code rust, python and c. So is it possible to use them at the same time? or do they interfear with each other?
I have a weird problem, see, mason is kind of not really that compatible with NixOs, so it's always a gamble if a package will work on my system or not. Now, there are workarounds, and I usually just install it using the package manager, however dap cannot automatically find and setup my debugger, and I am quite inexperienced when it comes to setting up debuggers in Neovim myself. Would you mind kind of explaining how to link lldb (cannot seem to find codelldb, and I am not sure if they are the same thing) or gdb with Neovim manually?
Noob question: is there a way to work with Markdown files (with tables, footnotes, etc.) with a rendered window on the right in Neovim? For note-taking purposes. I'm guessing no?
Nice content. What desktop environment do you use?
Thanks a lot! Can I just ask a question? how I can pass the argument to debug? for example, I want to run "gaussdb -D /opt/opengauss/pgdata", how to pass the -D .. etc to it? When I try to add it in the , it does not work. Thanks.
Cool 😎 thanks, any alternative for vim?
What I can do if I don't want to do the terminal command for compile every time?
Is there a way to get the value of vectors/objects while debugging? I got the feeling, that - except for primitive data types - it's really hard to use the debugger.
I have a problem in that I opened neovim after installing nvchad and instead of getting that example prompt I just get the regular neovim screen just in a different shade of gray and nothing happens.
thanks! this was really good. do you have any idea whether there's a method for nvim-dap configurations to remember the last executable file path? for example in my setup, i have a /src and a /build directory, and fixing the file path every time to point to ../build/myexecutable.exe is tedious. thank you again.
@CPSPD
11 ай бұрын
solution: - make a custom dap.configurations.c entry (i copied the example from nvim-dap github wiki) - make a local variable lastProgram outside the configurations entry - as the "program" element in the "Launch file" configuration i set lastProgram to vim.fn.input(...) from the wiki example - in a new configuration "Launch last file" i set "program" to return the lastProgram variable. anyway lol if anyone has a better idea then feel free to say :)
thank you very much but I have one question how I can input compile_commands.json to clangd in vim to go to definition and declaration. I have to do this a lot while coding
Great video. Could you please tell me what font you are using?
@dreamsofcode
Ай бұрын
JetBrainsMono Nerd Font!
One suggestion for C/C++ is the Neovim plugin Ouroboros, where you can switch between header and source files with a command. I then just created a custom mapping for it so I can switch between both of them quickly. And a follow up would be great to see how we can use include and library paths for different C++ libraries (such as Vulkan and OpenGL, OpenCL, Qt and Boost, just to name a few). I figured out how to do that within VS Code but I really wanna know how to do it in neovim, including setting build commands so the include and library paths are also used in the build command.
@dreamsofcode
11 ай бұрын
This is an awesome suggestion. I may do a dedicated video to this plugin!
@theglowpt3
11 ай бұрын
The clangd lsp already supports this via ClangdSwitchSourceHeader. I'm sure it's a cool plugin, unnecessary if you have lsp set up though
@conarius13
11 ай бұрын
@@theglowpt3The author of Ourboros explained why he made the plugin: All other implementations would either throw errors easily or you can only switch from header to source but not the other way round.
@conarius13
11 ай бұрын
@@dreamsofcodeOh and I have also looked into setting up neovim for other languages as well and found very interesting plugins and configs. If you want, I could show you some of them
@theglowpt3
11 ай бұрын
@@conarius13 Interesting, I'm able to switch both ways just fine, never had any errors or issues at all really
May I know which Neovim plugin offers us lightbulb/warning icon for Linter warnings in 5:19 ?
Hi, your video is really helpful. I have been following your tutorial and it worked great! However, I can't seem to get the feature of automatic header inclusion working like you showed in the video in your main.cpp file. My autocompletion for `std::` also does not work until I include the correct headers. I see you get all these completions for `std::` without any header files and you get `clangd` to automatically include the headers for you. Do you have any special setup to make that work? Thanks!
@user-gd6gq9qe2f
8 ай бұрын
I figured out that it is enabled by default in clang-16.
This is fantastic! As someone who is new to neovim and nvchad, what do I need to do to pass arguments to the C being debugged?
@liyuefu
Ай бұрын
Higuy, I got same question, have you got it fixed? :)
Thanks for this helpful video. I'm waiting to you share cmake plugin usage video which you mention at 16:00
Can u please make a video about configuring Java in nvim. Especially configuring LSP server from Eclipse is one big nightmare for me and can't figure it out :/ There're just few videos on YT about it. I watched them like 10 times and still it doesnt work for me
when is the cmake build video comming out?
What terminal do you use? I'm struggling to find one that works well with different tmux configs but also looks nice.
@dreamsofcode
10 ай бұрын
I use Alacritty and it's been great. If I ever work on Wayland however, I end up using foot instead.
thanks for this and for the golang configuration can u add a code runner plugin would be awesome
My breakpoints keep getting rejected, although the code executes successfully - any advice? I already tried using -glldb instead of --debug, but that didn't fix it. I'm using the latest macos with an m1 mac
@dn275
4 ай бұрын
I had to use cpptools instead of codelldb. cpptools can be installed using mason as well
Neovim I installed yesterday first time in my life. It's fun, liked it. But sadly for my language there are no quality plugins like there are in VSCode so I can't migrate.
Next php with xdebug, nice tutorial 👍
big big big thanks for video. please make video for cmake and make in neovim
isn't Clang-format already included with clangd? It's not working for me despite me retrying. I'll manually format my code for now.
What is the syntax for debugging with an executable that uses an inputfile?
Can you do the perfect neovim configuration for Java please. That would be amazing and most appreciated. :D
@dreamsofcode
11 ай бұрын
It's going to a vote for the next video!
@cprn.
11 ай бұрын
Honestly, it looks almost exactly the same - you just need to call `:Mason`, press , find "Java" on the list, type in filter number (it's 71), enter. Now you select an LSP, linter, formatter and debugger (press "I" for "install" on each). Add formatter and linter as source for `null-ls` and you're done. TreeSitter will instal syntax files next time you open Java code. Looks the same for every language.
@JesusCastilloBenito
10 ай бұрын
@@cprn. yeah, that's what i thought, but java-language-server seems to not work, so I personally don't know if I just have to go with jdtls or what :')
@cprn.
10 ай бұрын
@@JesusCastilloBenito Maybe it's something that should be brought up on that LSP's bug tracker (github or whatever they use). Most servers just work out of the box.
@Zeioth
9 ай бұрын
Get NormalNvim, it comes with formatter, debugger, and all the stuff preconfigured.
Is there a way to set the lspconfig to change the version of c++ it is using, e.g. c++13 instead of c++11?
looking forward to makefile video
Love your videos! great content and sick editing! What are you using to edit all these videos? your animation skills is 🔥
@dreamsofcode
11 ай бұрын
Thanks, dude! I use Davinci Resolve almost exclusively, with some After effects if I can't figure it out in DR. I'm planning on starting another channel for tutorials on motion graphics and am putting together an animation pack as well for some easy drag and drop effects that I use!
@adibhanna
11 ай бұрын
@@dreamsofcode That's cool! I didn't know DR can do so much! I mainly use Screenflow to record my videos. but I dont' have much editing experience. How do you record your screen with DR?
@dreamsofcode
11 ай бұрын
@@adibhanna I actually record with ffmpeg and use a stream deck for toggling it. I find it's the quickest way to do so for me. I have some custom scripts that also convert to ProRes and to a lossless compressed version as well. More tooling I eventually want to package up and share one day!
@adibhanna
11 ай бұрын
@@dreamsofcode that's such a unique idea! love it
Can I do something to use Allman code style by default, but without creating .clang-format file in each project directory?
Thank u so much, but… Can you help me? After last step (space+dr): “No configuration found for ‘cpp’. You need to add configs to ‘dap.configurations.cpp’ (See ‘:h dap-configuration’)”
@banpridev
3 ай бұрын
Were you able to fix it?
Hello, I followed exactly your instructions and it worked well for several months. But now suddenly I do not know what happend recently (I was not using c++ for some time) there is some error detecting standard header files. For example it says "'iostream' file not found". I am using mac os. Do you know what might be the problem?
Amazing video ! Can you did one about PHP ?
@dreamsofcode
10 ай бұрын
Absolutely! Added to the backlog
if i accidentally typed y when it asked "do you want to install example custom config" can i re do the proccess? i tried to delete the pluging and reinstall the neo vim and the pluggin but with no success
the debugger doesn't work for me, after I do dr a new tab opens up but it doesn't look like a debugging window like on your screen. It's just blank with the title [dap-terminal].. EDIT: I copied your config and it works, but honestly it's soo complicated
Any idea on what you're going to use going forward since null-ls is archived?
@dreamsofcode
11 ай бұрын
I'm working on a video about it! There's a couple of options moving forward, but I think it's going to be decided by what the community moves to.
@michrisoft
5 ай бұрын
You can just swap out the null-ls for "nvimtools/none-ls.nvim" in the plugins file and pretty much everything else is the same. You even leave require "null-ls" in the config file because none-ls was made to be a drop-in replacement.
Hi :), Everytime MasonInstallAll is executed clangd is getting downloaded, is there any way to avoid this if its already installed ?
null-ls is being archived soon. Look at another way of formatting. clangd comes with a formatter. You can use that with some keybindings or auto commands to set the formatting.
@dreamsofcode
11 ай бұрын
Yeah, I'm working on a video about it now. News dropped after I had uploaded and was waiting for review.
I always get this problem where i get no code completion like you do and js not found, but compiles just fine in the terminal
Hello, I am trying to connect cmake to nvchad. Can you please help?
great video but I cant get the lsp to work, i was able to get clangd installed once however the lsp did not work so i tried to run MasonInstallAll again but clangd fails to install with the " error rmrf: Could not remove directory ". i can manually delete the directory to install clang again but even then the lsp does not work any idea on how to fix this. im using windows btw
Hello, could you do a video on your tmux config? looks neat!
@dreamsofcode
7 ай бұрын
I have one already 😁