Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.
49 votes
Accepted

Is it possible to have vim auto-complete function names, variables, etc. when using it to program?

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 ...
user avatar
47 votes
Accepted

Is there any way to change the popup menu color?

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 ...
user avatar
37 votes

Is it possible to have vim auto-complete function names, variables, etc. when using it to program?

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 ...
user avatar
  • 1,101
34 votes
Accepted

How to get intelligent C++ auto-completion

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 ...
user avatar
  • 5,766
24 votes

How to create my own autocomplete function?

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 ...
user avatar
  • 32.6k
22 votes

Is it possible to have vim auto-complete function names, variables, etc. when using it to program?

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 ...
user avatar
  • 5,145
21 votes
Accepted

How do I exclude certain file extensions from completion?

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 ...
user avatar
  • 1,207
20 votes

How to create my own autocomplete function?

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 ...
user avatar
  • 45.9k
19 votes
Accepted

Easiest way to switch git branches

To summarize the answers, here are the ways to accomplish this: Vanilla Terminal Vim in a shell with job control Press CTRL-Z in normal mode will drop you back in to the shell and suspend Vim. After ...
user avatar
  • 1,142
18 votes
Accepted

Vim Code Completion for Python 3

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 &&...
user avatar
  • 5,766
18 votes
Accepted

Bash-like partial tab-complete for filenames in Vim

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 ...
user avatar
18 votes
Accepted

Ctrl-n completion takes a long time for “scanning included file”

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' ...
user avatar
  • 5,868
17 votes
Accepted

cancel complete

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. ...
user avatar
  • 2,480
17 votes
Accepted

Is there a version of Vim or plugin with a Command Mode auto completion?

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....
user avatar
  • 45.9k
16 votes

How can I get Vim to show documentation of a C/C++ function?

For C, pressing K on the keyword will pull up the built-in manpage directly. For instance, place the cursor on the printf keyword: printf("Hello, %s!", foo); Now press K (upper case K) and the ...
user avatar
13 votes

Easiest way to switch git branches

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 ...
user avatar
  • 584
13 votes

How can I get Vim to show documentation of a C/C++ function?

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 ...
user avatar
  • 23.7k
12 votes

Is it possible to have vim auto-complete function names, variables, etc. when using it to program?

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 ...
user avatar
12 votes
Accepted

How do I get filename completion to ignore a leading `=`?

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,/,\,.,-,...
user avatar
  • 23.7k
11 votes
Accepted

Pop up auto-complete suggestion automatically?

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 ...
user avatar
  • 16.6k
10 votes
Accepted

How can I lookup LaTeX symbols in Vim?

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."/...
user avatar
  • 728
10 votes
Accepted

Argument completion for python

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. ...
user avatar
  • 5,766
10 votes
Accepted

imap beginning with <C-o> interferes with omnicomplete

You can use the more powerful "expression mappings": :inoremap <expr> <silent> <Up> pumvisible() ? "\<Up>" : "\<C-o>gk" :inoremap <expr> <silent> <Down&...
user avatar
10 votes

How to Autocomplete CSS class names that include a minus character?

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 ...
user avatar
  • 32.6k
10 votes

Easiest way to insert LaTeX matrix?

Honza's UltiSnips Snippet gentbl<number>x<number> available in the repository https://github.com/honza/vim-snippets/blob/master/UltiSnips/tex.snippets Using this snippet which uses the ...
user avatar
  • 3,970
9 votes

Is it possible to have vim auto-complete function names, variables, etc. when using it to program?

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 ...
user avatar
  • 579
9 votes

Why doesn't YouCompleteMe complete function paramters?

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,...
user avatar
  • 191
8 votes
Accepted

YouCompleteMe in non-code files yields -- User defined completion (^U^N^P) Pattern not found

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. ...
user avatar
8 votes

How can I go into a directory in filename completion?

I prefer to type / because extra/////slashes///are//ignored. Also, the arrow keys are poison. :)
user avatar
  • 631
8 votes
Accepted

How can I go into a directory in filename completion?

Simply press the right arrow key.
user avatar
  • 13.6k

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