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 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. :-)
@@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.
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!
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.
@@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 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.
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?
@@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 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.
@@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
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?
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.
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
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.
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.
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...
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.
@@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.
@@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.
@@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.
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? :/
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!!!
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?
@@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 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!
@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() ? "" : ""
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.
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.
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?
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
@@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?
@@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.
@@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.
@@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.
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.
@@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.)
@@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.
@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
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 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.
@@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.
@@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
@@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?
@@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?
@@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.
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.
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.
@@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.