41

There are many different flavors of autocomplete in vim. One way might be to use SuperTab. This provides a way to use tab-completion at more or less any time. This would enable you to hit Tab after you've partially typed the word to get a completion list. For instance, typing eatF followed by Tab to expand to eatFood. Please Note: these pictures all link to ...


26

I really like clang_complete for this. It does require clang, and you need to tell it where libclang resides in your system. After that, it works wonderfully. People might suggest YouCompleteMe, but to be honest, that plugin is hugely bloated for what it says it does, and it requires way too many steps to install. I also had it segfault Vim on multiple ...


23

Such functionality - i.e., searching the current file (and all open files) for auto-completion, should be enabled by default with Ctrl+P: You can go to the next suggestion with Ctrl+N, the previous suggestion with Ctrl+P and select it by typing any letter (which will be appended right after the suggestion).


21

Dictionary completion would be a cheap and non-intrusive solution: save fontawesome.txt somewhere on your machine, put this in after/ftplugin/css.vim (create the file if it doesn't exist): setlocal complete+=k setlocal dictionary+=/path/to/fontawesome.txt setlocal iskeyword+=- start a new session or do :e in a CSS buffer to forcefully source the file ...


20

Vim has support for completion natively. You can read about the various different completions that Vim supports at :h ins-completion. In general, for all purposes I have found, ins-completions are enough for my liking, however there are some completion plugins that add more value beyond what ins-completions offers. NeoComplete, YCM (YouCompleteMe) are a few ...


19

You can use wildignore, for example: set wildignore+=*.pdf,*.o,*.obj,*.jpg,*.png If you want to list them, but give low priority – list at end, one option is to use suffixes, for example with: set suffixes+=.pdf PDF files are going to be listed, but at the end of file list. Read up on :h suffixes with links for more detail.


17

The ideal way is to get Vim's source and compile it yourself. Step 1: For Debian-like systems, get the required packages: sudo apt-get build-dep vim Step 2: Clone Vim's source code: cd /tmp && git clone https://github.com/vim/vim.git && cd vim Step 3: Configure, Make, Install ./configure --with-features=huge --enable-multibyte --enable-...


15

You can use the wildmode option to control this. If you use :set wildmode=list:longest, you get behaviour similar to bash. I personally prefer to use :set wildmode=list:longest,full; this will list completions, but on the second Tab press, you can cycle between the entries (and Shift+Tab to cycle in the reverse). This applies to all completions done by ...


15

EDIT Thanks to romainl's comment I've edited my answer to show how to create a user-defined completion function. In the previous version I was overriding the buil-in omni-completion which wasn't good because the user would have loose the default completion which is pretty powerful. A vimscript solution One solution is to use vimscript and the fact that vim ...


15

You can use the following highlight groups: Pmenu – normal item PmenuSel – selected item PmenuSbar – scrollbar PmenuThumb – thumb of the scrollbar For example to set a grey background: :highlight Pmenu ctermbg=gray guibg=gray For Gvim you only need the guibg part (ctermbg is used when Vim is run in a terminal), but I find it useful to always define both. ...


13

From :h complete_CTRL-E: *complete_CTRL-E* When completion is active you can use CTRL-E to stop it and go back to the originally typed text. The CTRL-E will not be inserted. Also if you, say, type a then ^Pand you get a very long list, you can hit ^N to return to your original text with the ...


12

Use the vim-merginal plugin (fugitive extension). It offers interactive TUI for: Viewing the list of branches Checking out branches from that list Creating new branches Deleting branches Merging branches Rebasing branches Solving merge conflicts Interacting with remotes(pulling, pushing, fetching, tracking) Diffing against other branches Renaming branches ...


12

To culminate the answers here are the ways to accomplish this: Vanilla Terminal Vim Press CTRL-Z in normal mode will drop you back in to the shell and suspend Vim. After executing your git checkout [branchname] type the fg command to return to the suspended Vim which will also force Vim to refresh. Vanilla GUI Vim Some gvim implementations will have :...


10

Automatic completion suggestions aren't built into Vim; plugins (like YouCompleteMe) implement this via :autocmd CursorMovedI triggers. Another plugin is AutoComplPop; it purely implements the automatic suggestions. Unlike YCM, it doesn't offer additional completions or any other extensions, so that may be a good alternative to try if you don't want to ...


10

By default, (with a minimal vimrc, and no plugins installed), this is already possible. Vim ships with multiple filetype plugins and some of these plugins offer omni-completion right out of the box. For example, python comes with pythoncomplete.vim. If you use the default pythoncomplete.vim that ships with Vim, (i.e. no YouCompleteMe, no python-mode, no ...


10

You can use the more powerful "expression mappings": :inoremap <expr> <silent> <Up> pumvisible() ? "\<Up>" : "\<C-o>gk" :inoremap <expr> <silent> <Down> pumvisible() ? "\<Down>" : "\<C-o>gj" Note that we added the <expr> keyword here. Now Vim expects that the right-hand is some (valid) ...


10

Yes, you can define what characters are considered part of keywords with the 'iskeyword' option: setlocal iskeyword+=- You can add the following snippet to your vimrc to restrict that option to CSS and HTML files: augroup css autocmd! autocmd FileType css,html setlocal iskeyword+=- augroup END


10

By default, when you hit C-n or C-p, Vim looks inside various sources to find candidates which will populate the completion menu. These sources can be configured with the buffer-local 'complete' option. The value of this option is a comma-separated list of flags. Each flag has its own meaning described in :h 'cpt: . scan the current buffer ('wrapscan' ...


10

I really don't think that having autocompletion or not will help you learning how to use Vim. Your main problem in my opinion is to learn the basics of the editor and then learn more and more commands. Anyway Vim has a built-in auto completion feature for the command line it is controlled with the wildmenu and wildmode options. The first step is to create ...


9

To expand commands in LaTeX, I use a dictionary copied from latex-suite (in details, this one) and put it in ~/.vim/dictionaries and then using autocmd FileType * exec("setlocal dictionary+=".$HOME."/.vim/dictionaries/".expand('<amatch>')) set completeopt=menuone,longest,preview set complete+=k Idea from here. I use it with supertab; the dictionary ...


9

Yes, auto completion scripts for vim exist. The "best" choice is depending on your programming language. As your example code is Python I suggest to take a look at Jedi. Build on top of that You complete me exists, which also has support for other languages, but is sometimes seen as too big. For other languages you can browse through the long set on vim ...


9

The list of valid filename characters is given by the isfname variable. From :he 'isfname': 'isfname' 'isf' string (default for MS-DOS, Win32 and OS/2: "@,48-57,/,\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=" for AMIGA: "@,48-57,/,.,-,_,+,,,$,:" for VMS: "@,48-57,/,.,-,_,+,,,#,$,%,<,&...


8

The command g:ycm_filetype_whitelist was the one I needed! let g:ycm_filetype_whitelist = { 'cpp': 1, 'c': 1, 'python':1 } Finally, to get ride of this message altogether, the answer is in the FAQ. Basically, update to Vim 7.4.314 or later and it shall go away.


8

YouCompleteMe (Link) plugin has been work great for me. It uses libclang to generate the autocomplete feature, providing accurate completion. It has a lot of customization, specially when working with compilation flags. You can edit the "flag generator" editing a python script per project (Example). But, to me the main advantage is that it supports Clang ...


8

I prefer to type / because extra/////slashes///are//ignored. Also, the arrow keys are poison. :)


8

Simply press the right arrow key.


8

Finally found it! Completing parameters is not a part of the YCM behaviour. See this YCM issue. There's an old fork from oblitum which could grant this feature. That's what misled me. Unfortunately, this part of the fork seems unmaintained and after a few tries I couldn't make it work. So, I tried out clang_completer which has the parameter completion ...


7

In insert mode, type the first couple of characters of a word, then press: Ctrl-N to insert the next matching word; or Ctrl-P to insert the previous matching word. This is particularly useful when entering the names of variables in a program. The 'complete' option controls where the keywords are searched (include files, tag files, buffers, and more). ...


7

You can use vim's file name completion feature for this. To use it, press CTRL-xCTRL-f in insert mode. For more on this, see :help compl-filename. Do note that it isn't recursive, so you must complete the path level by level. (first app/, then poit/, etc.)


7

If you can set up YouCompleteMe, it supports C, C++, JavaScript, Go and some other languages. Here's it in action: It's a bit annoying to install, and once it's installed you need to configure it for C and C++ by creating a .ycm_extra_conf.py. I lifted one from this repo, and got this effect.


Only top voted, non community-wiki answers of a minimum length are eligible