Тёмный

Using Vim's Built in Complete Menu for Autocompleting Words 

Nick Janetakis
Подписаться 21 тыс.
Просмотров 74 тыс.
50% 1

Опубликовано:

 

24 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 127   
@totheknee
@totheknee 4 года назад
Really clear video, no BS. I wish the entire interwebs followed your lead. We would have world peace by week's end.
@NickJanetakis
@NickJanetakis 4 года назад
Thanks a lot!
@hiidihyah
@hiidihyah 4 года назад
The only autocomplete plugin that works out of the box.
@0x007A
@0x007A 3 года назад
Finally, a video explaining exactly how to configure vim to support auto-completion (without any plug-ins). Your .vimrc file helped clarify a few questions as well. Thank you.
@NickJanetakis
@NickJanetakis 3 года назад
No problem, happy to hear it helped. Which questions did you have btw? Maybe I can make future videos about some bits in my vimrc.
@0x007A
@0x007A 3 года назад
@@NickJanetakis the most pressing question was auto-completion without any plug-ins. Solved with your video. With autocompletion implemented without any plug-ins, how do I enable programming language specific "hints" such as Python's methods and parameters? .vimrc is a perpetual work-in-progress. :-)
@NickJanetakis
@NickJanetakis 3 года назад
@@0x007A Language specific hints starts to get in LSP (language server protocol) territory, there's a few options such as CoC but personally I don't use them, but a lot folks do.
@josemembreno4996
@josemembreno4996 2 года назад
I watched the whole video, understood everything, & will definitely use this plugin! Thank you for this type of content! :D
@NickJanetakis
@NickJanetakis 2 года назад
No problem, thanks for watching.
@PabloAndresDealbera
@PabloAndresDealbera 4 года назад
Excelent video, straight forward, explains the config options and gives his opinion.
@NickJanetakis
@NickJanetakis 4 года назад
Thanks! Time stamps are in the description too.
@Zen-lz1hc
@Zen-lz1hc Год назад
Wow, that is soo cool. Thanks man for sharing this with us. I imagine it took a ton of time and energy to get this knowledge together to make it work so nicely. Thank you for sharing this! Really thank you!
@NickJanetakis
@NickJanetakis Год назад
No problem, thanks a lot for watching.
@stefanosstamatiadis740
@stefanosstamatiadis740 4 года назад
Nice. Working in older machines that won't support remote Visual Studio Code (e.g. CentOS6) vim is a nice alternative and autocomplete is nice to make sure you don't have any typos.
@TheSuperUser
@TheSuperUser 4 года назад
Another great vid on your journey learning vim.
@iron-man1
@iron-man1 4 года назад
man your like's show your wellness thank your so much finally my .vimrc is complete :)
@NickJanetakis
@NickJanetakis 4 года назад
No problem. Thanks a lot for watching, enjoy!
@manucaouette
@manucaouette 4 года назад
Great video. Thank you! Also, I tried replacing with on autocomplete and it works just fine for me: inoremap pumvisible() ? "" : ""
@NickJanetakis
@NickJanetakis 4 года назад
No problem. Do you also have ultisnips installed with a Tab trigger?
@manucaouette
@manucaouette 4 года назад
Yes, but it throws an error everytime I load it. Maybe it's because I'm on Windows...
@danielschreck9083
@danielschreck9083 3 года назад
tab binding for completion: github.com/ervandew/supertab
@bonfireatnight3998
@bonfireatnight3998 3 года назад
This comments should receive more thumbs up. This is probably exactly what most people are looking for.
@mr_o47
@mr_o47 3 года назад
Nick I can’t thank you enough This is very useful
@NickJanetakis
@NickJanetakis 3 года назад
No problem, thanks for watching.
@mr_o47
@mr_o47 3 года назад
@@NickJanetakis can you make a video explaining your vimrc that would be great
@NickJanetakis
@NickJanetakis 3 года назад
@@mr_o47 Hi, do you have anything specific in mind? I've done a few videos about a few components of it (spellcheck, plug, fern, a couple of mappings, etc.).
@mr_o47
@mr_o47 3 года назад
@@NickJanetakis would love if you cover coc plug-in
@NickJanetakis
@NickJanetakis 3 года назад
@@mr_o47 Thanks, but I haven't used it first hand. I really only make videos about the tools I use on a regular basis. Maybe one day I'll try it out tho and then I'll for sure make a video on it.
@sharpitstudio2951
@sharpitstudio2951 Год назад
Cool... but how you manage to get completion suggestion from different file ? Can i make a setting to have comepleteion from one specific file ?
@tanmaysahoo398
@tanmaysahoo398 Год назад
I have the same doubt. I have been searching for a solution but so far haven't found any
@fuseteam
@fuseteam 4 года назад
for tab to work you need to add "set wildcharm="
@NickJanetakis
@NickJanetakis 4 года назад
When I set that and press tab with the menu open, it doesn't do anything differently than not having wildcharm set. Does this depend on something else to work?
@fuseteam
@fuseteam 4 года назад
@@NickJanetakis weird i am able to select am able to set tab to select an option from what i can see i only need to add set wildcharm= inoremap pumvisible() ? "" : "`^" you can see my vimrc on github.com/fuseteam/dotfiles if it helps, i'll do a push later one difference i do notice is that in my case it doesn't select one of the options but i don't think that's related
@fuseteam
@fuseteam 4 года назад
@@NickJanetakis ah i found something, it may or may not be related to the "supertab" plugin as i did install the supertab plugin
@NickJanetakis
@NickJanetakis 4 года назад
@@fuseteam Ah. Yeah I tried that one, and also the "mucomplete" plugin but neither of them seemed to handle tab in a way that felt natural when it comes to pressing tab with ultisnips, the complete menu or a regular tab key press.
@fuseteam
@fuseteam 4 года назад
@@NickJanetakis wait how would you combine all three with tab? i mean i could see two of 'em with this pumvisible function but i would expect one to interfer with regular tab
@lpanebr
@lpanebr 4 года назад
Nice video. Especially because it does not require a huge plugin like you said. I did not quite understand however, how did you get the suggestions for the class methods.. is that language aware?
@NickJanetakis
@NickJanetakis 4 года назад
It completes based off keywords it finds in either the open buffer that's visible or a buffer that you have open but happens to be hidden in the background somewhere. It's not language aware. But in practice it's super handy because you're probably opening a bunch of buffers as you develop, and then you can pick up on completing words from those files.
@rahulkande330
@rahulkande330 Год назад
how do I the same autocomplete when I am typing vim commands? like if I want to do find and replace but I don't want to write the entire variable names
@mahipalsingh9361
@mahipalsingh9361 2 года назад
Very good stuff. What is the plugin that you are using that shows + in front of edited line.
@mahipalsingh9361
@mahipalsingh9361 2 года назад
Great video I subscribed and liked the video
@NickJanetakis
@NickJanetakis 2 года назад
Thank, it's called github.com/mhinz/vim-signify, all of the plugins I use are in my dotfiles at github.com/nickjj/dotfiles/blob/master/.vimrc.
@gamaarachchi9035
@gamaarachchi9035 3 года назад
thank you it's really helps
@aharonweinstein6742
@aharonweinstein6742 3 года назад
I have everything working (even the tab setting), except for the auto-suggestions with spellcheck. For some reason, the menu does not auto-open when I have spellcheck on.
@NickJanetakis
@NickJanetakis 3 года назад
Hi, you mean having it automatically come up with typo suggestions? In the video that was invoked manually for typos. I never looked into having that come up automatically but I think it would be too distracting, but maybe there's a setting for it.
@aharonweinstein6742
@aharonweinstein6742 3 года назад
@@NickJanetakis Ahh, that explains it. I'll probably look into it, would be neat to have vim give me auto-suggestions and auto-completions at once :3
@fan_juggler
@fan_juggler 3 года назад
Nice, I've even disabled YCM in favor of this method. One thing I am missing is completion of file path. I know that we can do that with ctr-x ctr-f sequence, but would be nice to have it as a part of automatic dropdown menu. Any ideas? Maybe it's in "set complete" or something...
@NickJanetakis
@NickJanetakis 3 года назад
Hmm, on my end here file paths come up semi-automatically. For example if I start typing ~/ , it will start filling in file names into the auto-complete menu as a type. But if I were in my home directory, typing .ba won't auto-complete my .bashrc. I'm not sure what would trigger that offhand but personally I would find it maybe too distracting, similar to having it try to auto-complete every English word by default.
@fan_juggler
@fan_juggler 3 года назад
@@NickJanetakis interesting! Indeed vim understands that you type a path when it is obvious (~/) but for files in current directory we should use ctr-x ctr-f to trigger a "path mode" so to say. I guess I'd still like it on by default, but it's okay. Another thing I can't get used to, is this special treatment of the first suggestion in the list. I mean, first item is selected by default, so to complete with the first item in the list we must hit enter, but to complete others we must ctr-n and it will auto-fill as you go through the list. Would be more logical if the first item was not selected by default and would auto-fill after ctr-n, like all other items. I guess there is a setting but whatever I do with completeopt doesn't change this... Anyways, thank you for the video and for responding.
@NickJanetakis
@NickJanetakis 3 года назад
@@fan_juggler With the binds I have set up I use the arrow keys to select the items btw. With completeopt have you tried removing menuone and longest? That might not select anything by default.
@fan_juggler
@fan_juggler 3 года назад
@@NickJanetakis I realized that in my case completeopt settings actually were not working at all, even explicit 'noselect' option. Anyways, it turned out that this was an issue with AutoComplPop plugin. In their pull request section, there is a patch that adds a possibility to remove selection of the first item.
@azegaspa6918
@azegaspa6918 3 года назад
Hey Nick. Great video, thank you! I am facing one problem though. After installing AutoComplPop plugin, the autocomletio works as expected. After adding "set complete+=kspell", the autocompletion for random english wordds doesnt work like you showed in 4:33 example. If I want to write "president" for example, I type pres then click ctrl+p and I get an error - Keyword completion (^N^P) Pattern not found. Why is that? :/
@azegaspa6918
@azegaspa6918 3 года назад
oh jeez... I was going crazy over this small issue. Finally found the solution... :set spell (to check spelling mistakes?) has to be on... then if I type presi then ctrl+p, I get a list of words that start with presi..... yussss!!!
@NickJanetakis
@NickJanetakis 3 года назад
Hi, you might have a conflicting plugin, it's hard to say. Have you tried with my exact vimrc file as a reference just to reverse what might be happening?
@azegaspa6918
@azegaspa6918 3 года назад
@@NickJanetakis I did try it and it didn't work then. Even if I have no plugins installed, only AutoComplPop, and set complete+=kspell enabled, it wouldn't do what I want :/
@NickJanetakis
@NickJanetakis 3 года назад
@@azegaspa6918 Does regular spell check work? Maybe you need to install a spell check dictionary.
@azegaspa6918
@azegaspa6918 3 года назад
@@NickJanetakis Thank you for your patience and help! I just learned about spellcheck and I thought its the coolest thing. Found out that my blog posts are full of typing mistakes.. I also found a function that allows me to toggle spell check on and off, so I put it in my .vimrc and that was causing the problem... as I commented that function out, everything works just like in your video. Silly me. Learning stuff the hard way. Have a nice rest f the day!
@itspandapo
@itspandapo Год назад
How to connect AutoComplPop with snipmate ?
@igormorgado
@igormorgado 3 года назад
@10:52 Is that what he wants? " Use tab to change item in pop up menu inoremap pumvisible() ? "" : "" or this? " Use tab to confirm the selected item in popup menu inoremap pumvisible() ? "" : ""
@NickJanetakis
@NickJanetakis 3 года назад
Nope, that has no effect when you press tab when you use ultisnips.
@pawebakiewicz6786
@pawebakiewicz6786 4 года назад
Great video. But I'm still stuck on the fact that for me omnicomplete completes only stuff from standard library. Cannot find any completions for Flask/Django objects not to mention objects from project I'm working on. Do I need to import them to $PYTHONPATH or something? I've been stuck on this for second day now. Any help on that would be greatly appreciated.
@NickJanetakis
@NickJanetakis 4 года назад
That is a different use case. If you want more intelligent auto complete based on libraries you have installed for a specific language you'll want to set up a language server for Python. There's the "coc" plugin for that.
@jimshtepa5423
@jimshtepa5423 3 года назад
befor adding "Plug 'vim-scripts/AutoComplPop' do I have to install AutoComplPop separately? do I need anything else to be installed such as python runtime?
@NickJanetakis
@NickJanetakis 3 года назад
Hi, Python isn't necessary. AutoComplPop is purely written in Vimscript. The Plug command is what installs AutoComplPop but you will need to install Plug first which is a general plugin manager for Vim. I have a video on installing Plug here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Wek8lE8fRSk.html
@jimshtepa5423
@jimshtepa5423 3 года назад
@@NickJanetakis Nick, thank you for quick response. Do I understand it correct in that AutoComplPop is good for html/css/python/ruby but not good for javascript?
@NickJanetakis
@NickJanetakis 3 года назад
@@jimshtepa5423 It works for everything because it doesn't depend on any specific language. It depends on what you're currently working with, and it uses that as a basis.
@jimshtepa5423
@jimshtepa5423 3 года назад
@@NickJanetakis OOhh I see. This seems to be the reason why it suggests words from the buffer (may be not buffer but those words I have used so far). I was expecting it to behave as VSCode autocompletion feature. Thank you for clarifying.
@NickJanetakis
@NickJanetakis 3 года назад
@@jimshtepa5423 VSCode uses various language servers (LSP). It's a trade off of wanting better autocomplete at the cost of having to install and configuring a bunch of language servers. With Vim you can use CoC to get similar autocomplete as VSCode. There's options too. I have no experience with any of them btw.
@bhaveshverma8629
@bhaveshverma8629 3 года назад
Hello sir it does not works with PHP extensions
@eddurguti
@eddurguti 4 года назад
Great video, any reason why you gave up vscode/sublime?
@NickJanetakis
@NickJanetakis 4 года назад
For Sublime to VSCode it was mainly drinking the VSCode kool-aid and being impressed at the liveliness of the extension ecosystem. It seemed like a natural progression. But around a year ago I was dealing with a 300k+ word markdown file and VSCode tanked when writing into the file by having silly amounts of CPU load, but as of today they've fixed the performance issues around large files. Honestly all 3 editors are really good and I wouldn't be unhappy using any of them. I stick with terminal Vim (specifically terminal Vim) because it really meshes well with tmux. It's very fast and easy to swap between my editor and a terminal, I made another video on my workflow of that here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-hbs7tuwpgZA.html. With that said, supposedly VSCode's Vim emulation is pretty good (I never tried it), so if you were really into VSCode but still wanted Vim's editing style that could be an option too, especially if you didn't care much about hopping between the terminal and tmux sessions.
@totheknee
@totheknee 4 года назад
@@NickJanetakis Vim is also light-years ahead of VSCode in terms of input lag. (Depending on the terminal/gui used of course, but the option exists unlike with Electron.)
@NickJanetakis
@NickJanetakis 4 года назад
@@totheknee It used to be pretty bad but honestly it's not horrible anymore. xterm on native Linux feels amazing tho, and wsltty with WSL feels good too.
@wulymammoth
@wulymammoth 4 года назад
@stillFLiP as mentioned in other comments, CoC (conquer of completion) plugin is REALLY good. If you're using Neovim, the nightly with LSP support you don't even need CoC. LSP is going to be in 0.5 (currently 0.4). I like to keep things minimal (including plugin dependency and default key bindings). Here's a video on all the neat native auto-completion features in Vim/Neovim that I believe the plugin suggest here basically layers upon: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-3TX3kV3TICU.html
@iFunktion
@iFunktion 9 месяцев назад
Not sure what I'm doing wrong, but I can't get the plugin to load. I've tried to install plug.vim as on the git repo, but they are not working for some reason. Any idea what I might be doing wrong?
@NickJanetakis
@NickJanetakis 9 месяцев назад
When you say it's not working, what issue are you having? Is it throwing an error?
@iFunktion
@iFunktion 9 месяцев назад
@@NickJanetakis No it's just not working as I type. I can use ctrl - P and it all pops up, but outof the box it's not working. I'm not sure if Plug is working and I dont' know how to test if that is the issue as this is my first venture into plugins for Vim well neovim actually.
@NickJanetakis
@NickJanetakis 9 месяцев назад
@@iFunktion Oh. Is it possible to temporarily use Vim to see if the same thing applies? I haven't used Neovim and maybe there's a setting that conflicts with it.
@iFunktion
@iFunktion 9 месяцев назад
@@NickJanetakis Yes certainly, I will do it this evening and get back to you. Would be good to figure it out, thanks for your quick replying by the way
@iFunktion
@iFunktion 9 месяцев назад
@@NickJanetakis Ok just tried it in vim and it doesn't work either, the .vimrc file just has the plugin call no other settings in this file.
@mikesa7719
@mikesa7719 4 года назад
strange!? menuone in my plane vim is not built in
@6cylbmw
@6cylbmw 4 года назад
I've done all the changes yet still I can't get autocompletion popping to work. :(
@NickJanetakis
@NickJanetakis 4 года назад
Do you have any plugins that I don't have? It's possible another plugin is overriding the mappings I've set.
@6cylbmw
@6cylbmw 4 года назад
@@NickJanetakis The bindings work, just that I do not get the autocomplete prompt automatically. I thought the same and tried to disable a few/ switch order in vimrc but no results. Could I share my vimrc with you?
@NickJanetakis
@NickJanetakis 4 года назад
@@6cylbmw I think it would be easier to use my vimrc and see what happens and if it works then you can cross examine the differences. It should pop up as long as you have the auto popup plugin installed. Maybe you didn't install it with :PlugInstall?
@jantoth4699
@jantoth4699 3 года назад
@@NickJanetakis I had the same issue for months and I finally figure out why autocomplete ain't work. When you have "set paste" in your .vimrc
@NickJanetakis
@NickJanetakis 3 года назад
@@jantoth4699 Nice work. I'll make a note of that.
@SayfSentinel
@SayfSentinel 4 года назад
Does that apply to neovim as well ?
@NickJanetakis
@NickJanetakis 4 года назад
I haven't tried it personally but I imagine it will work no problem with neovim.
@dbarcene
@dbarcene 2 года назад
Can I use this with GNU Octave?
@NickJanetakis
@NickJanetakis 2 года назад
I haven't used that before, I would Google around for that.
@bhavinmoriya9216
@bhavinmoriya9216 3 года назад
How do I install AutoComplete plugin?
@NickJanetakis
@NickJanetakis 3 года назад
That's covered at 2:59. You can plug install it. Exact instructions depend on which plugin manager you use.
@bhavinmoriya9216
@bhavinmoriya9216 3 года назад
@@NickJanetakis Thanks Nick:)
@siepwooland3832
@siepwooland3832 4 года назад
you didn't show how to install the plugin :(
@NickJanetakis
@NickJanetakis 4 года назад
There is no plugin to install. It's all built into vim. And for the auto-popup plugin the installation of it is covered at 3:00.
@siepwooland3832
@siepwooland3832 4 года назад
@@NickJanetakis LOL 13:00 stops the video
@NickJanetakis
@NickJanetakis 4 года назад
@@siepwooland3832 Hah sorry, I meant 3:00. I updated my comment to reflect that. It's just a 1 liner you add to your Plug config. Then you would reload your vim config and run :PlugInstall to install it. If you don't know what Plug is or how to use it, I made a video about it at ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Wek8lE8fRSk.html.
@siepwooland3832
@siepwooland3832 4 года назад
@@NickJanetakis Great!
@markpi2350
@markpi2350 4 года назад
thanks
@badem
@badem 4 года назад
If possible try (and if possible make a video of) coc.vim. It has a funny name but its supper powerful.
@NickJanetakis
@NickJanetakis 4 года назад
The reason I try to avoid coc is because all of my web apps are running within Docker. I have things like Python, Elixir and Ruby in Docker images for each project. coc doesn't know how to read information from that.
@badem
@badem 4 года назад
@@NickJanetakis I really like to see your workflow now. That would make a good video. ;)
@NickJanetakis
@NickJanetakis 4 года назад
@@badem Sure, I can do something like that. Maybe some type of live coding session.
@cnervip
@cnervip 4 года назад
5:15 shift+k
@DblDTheThird
@DblDTheThird 4 года назад
Cringe what rock did you crawl under like awesomeness
@NickJanetakis
@NickJanetakis 4 года назад
Thanks?!
@radio_electronics4047
@radio_electronics4047 8 месяцев назад
Title says "vim's builtin complete menu", but you are using plugins...
@NickJanetakis
@NickJanetakis 8 месяцев назад
It is using Vim's built in menu to populate and display the autocomplete. The only plugin used is if you want it to be automatically shown without needing to hit a hotkey but that's optional.
@radio_electronics4047
@radio_electronics4047 8 месяцев назад
@@NickJanetakis You can put this in your vimscripts: set dictionary+=~/.vim/after/syntax/dict/c.dict set complete+=k and then just put keywords into c.dict. Then use the normal ctrl + n.
@donniehdea9281
@donniehdea9281 2 года назад
think this video may be out of date
@NickJanetakis
@NickJanetakis 2 года назад
Hi, it's not out of date, everything still works the same today and my config hasn't changed in a way that's related to this video.
@walterdiaz2003
@walterdiaz2003 Год назад
?
Далее
NAH UH
00:17
Просмотров 1,8 млн
Vim Tips You Probably Never Heard of
12:11
Просмотров 121 тыс.
Advanced Vim Workflows
10:41
Просмотров 84 тыс.
10 Advanced Vim Features (You Probably Didn't Know)
21:47
50+  Vim Tips and Tricks from Beginner to Expert
42:37
Learning Vim in a Week
23:51
Просмотров 465 тыс.
My Favorite Vim Tricks
14:39
Просмотров 183 тыс.
Mastering the Vim Language
36:20
Просмотров 614 тыс.
Setup Neovim like an IDE
10:16
Просмотров 288 тыс.