TakeTuesday E01: nvim-cmp
Ғылым және технология
In our first episode of #TakeTuesday, we explore the wonderful completion plugin "nvim-cmp". You'll learn how to configure, customize and even create your own sources for nvim-cmp.
CORRECTION:
Sorry, I set that cmp.setup.buffer ADDs to global setup, but it actually OVERRIDEs global setup. See github.com/hrsh7th/nvim-cmp/i... . Can be see at 12:30
Some important links:
Nvim-cmp: github.com/hrsh7th/nvim-cmp
My Dotfiles: github.com/tjdevries/config_m...
My nvim-cmp setup: github.com/tjdevries/config_m...
Github issues source: github.com/tjdevries/config_m...
Related plugins
- github.com/ms-jpq/coq_nvim
- github.com/neoclide/coc.nvim
Пікірлер: 255
Comment below with other plugins you'd like to see in this series or with any other feedback you have! Thanks for watching :)
@noblesavage149
2 жыл бұрын
Have you tried Olical/aniseed? Thoughts?
@teej_dv
2 жыл бұрын
@@noblesavage149 for some reason, it seems like yt keeps making my comments disappear. So sorry if you see three of them haha. But I have not tried it. I also don't know lisp, so I don't think I would be the right person to explore it.
@noblesavage149
2 жыл бұрын
@@teej_dv That's ok, my one seems to have disappeared also. I think yt is going down the proverbials at the moment!
@jmann277
2 жыл бұрын
nvim-dap pleeeease
@danymat
2 жыл бұрын
Neogen (it’s an annotation generator using treesitter) And Neorg
Nvim surprised me every single day, I can tell that I'm not an expert, (I'm learning how to setup Nvim for myself yet, btw) but things like this inspire me to go on with this beautiful code editor... Great video and job TJ, you're the best.
@teej_dv
2 жыл бұрын
What a really nice message! Thanks! I'm hoping to make a bunch more of these (over time haha, they take quite awhile)
Hey TJ. It's super nice idea for videos to take one plugin/component and become familiar with it.
@teej_dv
2 жыл бұрын
Glad to hear it! Glad you found it useful!
Awesome video. Looking forward to the future TakeTuesdays! Will be looking forward to the luasnip one. Thanks TJ.
This is such a useful video, no other video gives an intro to get things started and a background to what different sources do. Thanks!
THESE VIDEOS ARE AMAZING, PLEASE NEVER STOP THEM! Huge thanks to you Tj, I was so lost in regards to completion in neovim and this cleared up everything for me!
Absolutely amazing video. Entertaining, informative and really well laid out. This content is the bomb! Becoming exposed to the features of nvim by you & the rest of the community is greatly broadening my horizons with respect to developing software. I am greatly appreciative of the effort that you put into this video and your other content. You’re the man, TJ!
@teej_dv
2 жыл бұрын
Thank you so much :)
Awesome format, props for the effort it took to prepare this content. Definitely picked a couple of things that I will be taking to my setup. Look forward seeing the upcoming ones!
What a great idea TJ! This is the sort of trials and tribulations that us mere mortals go through so it is nice to see it from the eye of an experienced "insider" 😀👍
@teej_dv
2 жыл бұрын
Glad to hear it!
2 years later, this video still helping lost souls like me. Thanks teej :D
@teej_dv
2 ай бұрын
haha that's awesome!
Thanks so much for this, TJ - I learned a ton! A co-worker convinced me to watch this and make the switch from coc and it definitely worked. So happy with the result. Looking forward to more.
That's exactly what I need! How a proficient vim user setups his config and uses real world scenarios. And also kudos for warning about tab selection!
Sooo good. I love the well-paced and comprehensive walk-through.
@teej_dv
2 жыл бұрын
Glad the pacing was helpful. It's hard to find the right pace but not take 4 hours haha
I would say these videos are useful and fun to watch. I would watch them even if I knew most of the stuff, becoz there's always something I don't know. And you guys are the experts and I always enjoy going more deep which you did in this video. I hope videos like these keep coming! :)
Dude, seriously thank you for this video. I love how you go step by step explaining parts of the basic setup and configuration for the plugin (instead of simply copy this, paste that). My migration from completion-nvim to this one was long overdue and this video was just perfect, worked like a charm! Your "explain one plugin, install, setup, config and features" videos are great!
@teej_dv
2 жыл бұрын
So happy to hear :) I've got another one almost done!
Hey TJ, thanks for this great video, I really like the format! Best regards, David
To get the auto import going i had to update the capabilities with `require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())` and add them to the lsp servers capabilites in it's setup. Everything else works great thank's for the in depth explanation.
Thanks for your uploads TJ, they're really helpful!
@teej_dv
2 жыл бұрын
Excellent! So happy to hear that!
Just found these - great stuff! My complete wasn't working, turned out to be something unrelated of course, but getting a solid run through of what SHOULD be there and how it hands together really gave me a bunch of confidence with my autocomplete setup; so when it does flake out, I know it's something else I stuffed up in future (hopefully!)
Great tutorial in the 'insides' of neovim. Learned a lot. Please keep up the format as is, not too long and not just out of the help docs
Thank you! I've been using coc for a long time. This video and the one about LSP helped me so much in setting everything up.
I love this format, keep them coming
What an excellent video and series. Thanks for putting all the effort and coming with this greatly explained video. After this I am considering giving nvim-cmp a try for sure.
@teej_dv
2 жыл бұрын
ELYEZER YOU HAVE TO BE ON NVIM CMP OR YOU ARE GETTING BANNED FROM TWITCH KAPPA
Decided to watch this spontaneously. Just as good as the first time. Really miss TakeTuesday.
Really enjoyed this and look forward to more plugin walkthroughs
Seriously face melting stuff. Really enjoyed the format. Chock full of actionable items. Thanks TJ.
@teej_dv
2 жыл бұрын
Awesome! :) I will try to keep to that standard!
I loved this format TJ. Looking forward for more :D
@teej_dv
2 жыл бұрын
Thanks, had a bunch of stuff happen IRL but hope to get back to doing these soon!
This was amazing thank you. I’d love to see you go through your LSP setup, explaining what you do and why. I’m new to lua, so seeing someone explain what is happening makes it way simpler than code diving dot files.
@teej_dv
2 жыл бұрын
A builtin LSP video would probably be also be good for a simple setup of some of the features. Thanks for the idea!
This was really well explained TJ, thanks
Thank you. waiting for the lua snippets video
Very very thanks for all the efforts that you guys are putting make such valuable content, from which nvim users like me getting lots of benfits... Thanks you very much.. This is my first comment i am writing in youtube for any of channel.
@teej_dv
2 жыл бұрын
Wow! That's very kind of you! So glad you enjoyed it!
you nvim guys are absolute magicians
@teej_dv
2 жыл бұрын
haha thanks!
This is great. Made some changes to my setup based on the vid. Looking forward to more.
Thank you TJ for sharing this great content !
@teej_dv
2 жыл бұрын
My pleasure!
Amazing format buddy ✌🏽
@teej_dv
2 жыл бұрын
Thanks :) I am enjoying it!
Would love to see more Take Tuesdays! Learned a lot from this video already. Would also like to see an explanation on how your configurations in `after/plugin/*.lua` gets auto-loaded
@teej_dv
2 жыл бұрын
It's automatic now! Just get on a newer release and they get loaded.
Nice explanation. Thank you!
Fantastic content! Greatly appreciated.
Thank you TJ... great content!
nvim-dap. Never tried debugging in a text editor. It is the one thing preventing me from completely switching to nvim
@barower
2 жыл бұрын
This
@teej_dv
2 жыл бұрын
@@barower It's on the list :) A few plugins away but I will go over this plugin in the series hopefully
what I did in mappings was change for and for . So basically I can scroll words without move fingers almost, and to prevent tab use. ( and for Dvorak users)
Great content, great format, love it, I would love the same kind of walk-through into colorbuddy and your color setup.
@teej_dv
2 жыл бұрын
Ah! Colorbuddy would be fun to do :) I'd have to clean up some code for it I think, but it'd be a good one to revisit. Thanks, I am adding it to the list!
Looking forward to more of these 🙌
The GH Issues thing was very impressive! Really nice video :D
@teej_dv
2 жыл бұрын
Excellent!
Really good video thanks!
Thanks for this video. I found this helpful.
I really enjoyed this format and the content is excellent! I'll just ditch my prime's yt subscription and follow you now! 😂😂
@teej_dv
2 жыл бұрын
Don't leave Prime. He's the reason I stream!
Thank you so much for this video!
@teej_dv
2 жыл бұрын
So glad you liked it!
Great work👍👍, very helpful thanks
Really enjoyed that! Thanks 👏
very useful! Thank you
Thanks for making these videos
@teej_dv
2 жыл бұрын
Happy to do so :) more coming soon!
Awesome tutorial Tj
sweet vid tj
amazing video, very useful content
@teej_dv
2 жыл бұрын
Thanks :)
Don't even consider to become evil person! :) Keep sharing this superb stuff. Learning so much in every single minute!!! :) :) You have a true talent!
you are a great teacher،
What a great content! Thank you, TJ! Btw, it would be great to see something about the debugging in vim/neovim. Cheers!;)
@bramlo411
2 жыл бұрын
You could check out The Primagen's vid about Vimspector
@teej_dv
2 жыл бұрын
I think I will add doing nvim-dap to my list of things to do :) thanks for the suggestion!
First time watching a video from you (I knew about you, but I always thought your videos and explanations would be too advanced for me 😛) But, GREAT video! Very nice and detailed explanation. I subscribed and I hope I see more videos of this format 🙂
@teej_dv
2 жыл бұрын
Super glad to hear. I hope to keep making more in the TakeTuesday series.
@farzadmf
2 жыл бұрын
Looking forward to them 🙂
More Take Tuesday episodes pls!!
@teej_dv
2 жыл бұрын
Part 1 of LuaSnip will hopefully be done soon :)
so awesome! thanks!
@teej_dv
2 жыл бұрын
You are very welcome!
keep up such good content
great content. keep 'em coming plz! would love one about LuaSnip. thank you
@teej_dv
2 жыл бұрын
I have a video almost done for comment.nvim and then the next videos will be about LuaSnip!
@mikloscsepella2743
2 жыл бұрын
@@teej_dv thats exciting ty!
great video waiting for the LuaSnip
@teej_dv
2 жыл бұрын
Hopefully in the next few weeks :)
so nice.... this is so good...
Hey TJ, you are good at teaching! Thanks a lot. I'm looking forward to the next episodes. How about exploring some wiki plugins? (I saw you are not using vimwiki anymore)
@teej_dv
2 жыл бұрын
Yeah, maybe I will try out one or more of the org-mode plugin replacements. Perhaps vimwiki could be interesting as well.
Yes, do more of these
Ooo yeahhh!! Nvim dap!
Ok. This series is cool.
:h ins-completion - likely just changed the way that I will use completion. I appreciate the heads up. Soon to be former 'tab' user. Seems worth the immediate workflow hit that I'll take getting up to speed.
The gh_issues source is really cool! One thing I was thinking is if it would be possible to set the "kind" (or what it is called) to be the issue title? Such that you can see them all in the menu, instead of the generic "Text". Great video, already looking forward to the next :)
@teej_dv
2 жыл бұрын
Yeah! I didn't explore that part, but I think you can set the kind to be something else and that will change the "Text" thing you see.
this is really great sir . we also want a video on telescope.nvim
@teej_dv
2 жыл бұрын
hehe a bit too self promotion for the first one, but I will keep that in mind :)
Very interesting. thanks TJ. I was able to follow along and got the gh_issues plugin working too. It's interesting that it just shows all the numbers, and you still have to iterate them manually to visually inspect them. This makes me wonder if it might make sense to use telescope as a way to drill down to a single completion item, as it allows to search on keywords that are not part of the ultimate result (e.g. the issue body, which we don't want inserted as a completion), and allows fuzzy searching, of course...
@teej_dv
2 жыл бұрын
Yeah, you could make a telescope picker that just inserts the selected value and grab all the issues from github as well. It would not be super complicated to do if you already have the gh_issues plugin working!
Thanks!
Thank you, really helpful video. Next maybe nvim-dap, how to setup etc.?
@teej_dv
2 жыл бұрын
It's on the list!
Interesting stuff! Thanks for sharing.
@teej_dv
2 жыл бұрын
No problem!
Thank you TJ, I have been struggling to know what nvim-cmp and those following plugins does. and why it still need Ultisnips in my case. This video is a Godsend for me. Very understandable, explain what those plugins and config does. *chef kiss
Thanks for the video! What keys you are entering at 21:07 where the function arguments are added and you can jump between "k", "v" and the end of the function? I can't seem to replicate that behavior.
@teej_dv
2 жыл бұрын
After "accept"ing the solution (which is for me), I can move with which is my luasnip "jump-to-next" key.
Treesitter next! Btw, I’m curious as to how you get the invisible characters like newlines show up.
@teej_dv
2 жыл бұрын
Yes, good call for doing tree sitter. I will add that to the list. You are looking for "help listchars"
Hey TJ! Thank you for your work, I've learned a lot by watching videos you're created over these years. I have a question: How do I make nvim-cmp source dap on runtime (on debugging). Let's say I'm using python or query django object. So, I want my autocompletion suggest all dynamic fields containing in this object. nvim-dap has this info, but all autocompletion sources suggest only static data. I've tried rcarriga/cmp-dap with no luck. Before I start writing my completion source, can you give me a tip on a ready-to-use solution? Thanks!
Nice.
Hi, is there a way to call cmp.complete while typing? Just to have the same effect from coc.nvim
It's almost Tuesday :)
@teej_dv
2 жыл бұрын
Haha sorry for the delays. It's actually that we stream the content on tuesdays on stream and then I have to put together a video. That doesn't always get released on tuesday. I am almost done with one and plan on trying to pump out another this week.
Hey teej, Can you show you'd configure github copilot with this too?? Also you are really doing a great job! keep it up!!
Do Emacs next!
@teej_dv
2 жыл бұрын
Sorry, I don't review Operating Systems.
@nyxkrage
2 жыл бұрын
@@teej_dv Review evil-mode then, AS A NEOVIM CORE DEV
"When I type this *octothorp*..." 😆 TJ you're supposed to be a millenial, not a boomer 😛 that's "hashtag" to you haha Regardless, thanks as always TJ. I always learn a ton from your videos! This one in particular was *packed* to the brim with goodies about nvim-cmp, a plugin that I've used for a while but haven't explored the API of very much. I have several ideas now about how to make my Neovim experience even better with nvim-cmp after watching your video 😃. Your work in the Neovim community as always is much appreciated :)
@teej_dv
2 жыл бұрын
I will never give up octothorp. IT IS SO FUN TO SAY!!!!!
OG
What are your cmp select prev/next mappings? I tried default but it seems to break the cmp window.
@teej_dv
2 жыл бұрын
Just or . You don't need to prefix with to _move_ between the selections, that is to enter into a certain type of ins-completion mode.
How would you do something similar to "g:mucomplete#can_complete" (lifepillar/vim-mucomplete) with nvim-cmp?
@teej_dv
2 жыл бұрын
Hmmm, I'm not familiar with this. I don't know of good analogues. Sorry!
Hey TJ, how can you get cmp to work with npm libraries?
If you don't use TAB for completion, what do you use? Please refer me to past video that discuss your prefer method for triggering completion. Thanks.
@teej_dv
2 жыл бұрын
I use :help ins-completion for triggering completion when I need to, and let nvim-cmp do the rest in terms of auto-completing. I will try and make a video about it. It's 90% a joke anyway. You should do what makes you like Vim the most :)
Hey i've noticed that when u changed your config you run some tj#save_and_exec and that just reload your config, how can i reload with a keybind for lua config files?
@teej_dv
2 жыл бұрын
I re-run files by doing `:source %`, but it just checks to make sure it's a valid filetype to do so.
Hi TJ, great video. I'm using nvim-cmp as well and it is great. I use it for Rust. I wonder if there is a way for us to order the code completion suggestions, for example, I want to see variable names before I see method names?
@teej_dv
2 жыл бұрын
Yeah! You could create a new thing for comparators. See a plugin like this: github.com/lukas-reineke/cmp-under-comparator to show you how you could do that.
Hey TJ, great video!! I wanted to know a little more about on why is that you don't use and think is bad to use tab to autocomplete? Thanks!
@teej_dv
2 жыл бұрын
I'm mostly joking. Chatted a short bit about it here: www.reddit.com/r/neovim/comments/qdj7ir/comment/hhp4c27/?context=3
Pls could you point me where should I look to get similar status line with \-master\- and etc for neovim? Cool vid btw
@teej_dv
2 жыл бұрын
I use expressline, but I think there are a lot of new lua statuslines that are easier to use. I think just google "github neovim lua statusline" and pick one that looks good and has stars. I don't have a lot of great opinions on the matter.
How would anyone use the default config with = cmp.mapping.confirm and select = true? It makes you unable to insert new lines. Am I missing something obvious about completion or new lines or is noone using the default?
@teej_dv
2 жыл бұрын
I think it's only applicable when the completion menu is visible (so after it's not visible anymore, enter makes you do a new line)
Hi @TJ DeVries great content. I implemented some of your code but I had super TAB and I feel more easy to use it. Would be awesome if you could do a small video explaining with detail why you think using tab is not a good idea. Thanks!
@teej_dv
2 жыл бұрын
That's a good idea, I'll do it sometime :)
@nraw_
Жыл бұрын
@@teej_dv Are we there yet? I'd also be interested :)
Thanks for the video, I'll probs stick with coc for now because it's super easy to setup (imo)
@teej_dv
2 жыл бұрын
Cool, use what works for you!
@tobias-edwards
2 жыл бұрын
@@teej_dv 4 months later and I've rewrote my entire config in Lua and am using nvim-cmp! At times I did think about switching back to CoC but managed to get it all working with builtin LSP after a full week of debugging hallelujah
Would it be possible to enabled the gh completion for comments within file to allow referencing issue numbers in Todo comments for example?
@teej_dv
2 жыл бұрын
I think someone actually did that already on github! I It's like cmp-git or something like that.
@lpanebr
2 жыл бұрын
@@teej_dv thanks!!!
I am finding very difficult to add jump to next or previous placeholder. Help me Brother