65 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 ...
Martin Tournoij's user avatar
22 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....
statox's user avatar
  • 49.6k
21 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 ...
dotancohen's user avatar
20 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 ...
Sukima's user avatar
  • 1,212
19 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' ...
user9433424's user avatar
  • 6,118
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. ...
Antony's user avatar
  • 2,560
14 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 ...
muru's user avatar
  • 24.8k
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 ...
adelarsq's user avatar
  • 604
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 ...
surendra nath's user avatar
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 ...
Hotschke's user avatar
  • 4,740
10 votes
Accepted

Cycle through autocomplete menu using tab

Put the following insert-mode mapping (see :h mapmode-i) in your vimrc: inoremap <expr> <TAB> pumvisible() ? "\<C-n>" : "\<TAB>" inoremap <expr> <S-TAB> pumvisible(...
3N4N's user avatar
  • 5,624
10 votes

Vertical WildMenu in Vim

Patch 8.2.4325 added the vertical wildmenu support to Vim.
Yegappan Lakshmanan's user avatar
9 votes

How to insert a file path with tab- or autocompletion relative to the current file's dir?

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 ...
EvergreenTree's user avatar
9 votes

How to get intelligent C++ auto-completion?

One option (what I currently use) I don't use YouCompleteMe anymore. coc-clangd is much better and simpler. Today I use coc.nvim + coc-clangd instead. Another option (what I used to use) YouCompleteMe ...
oblitum's user avatar
  • 276
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,...
hippunk's user avatar
  • 301
8 votes

Easiest way to switch git branches

You should embrace your terminal. If you use CTRL-Z, it will background Vim (or whichever process you are currently running), then you can run any commands you want, the fg to bring the process back ...
65-e9-7e-17's user avatar
8 votes

How to create my own autocomplete function?

Sometimes you want a custom auto-completion that doesn't interfere with any of the built-in or user-defined autocompletions at all. This is especially useful for scripts or plugins that are intended ...
Martin Tournoij's user avatar
8 votes
Accepted

File name completion relative to currently edited file

You can :cd in Vim to change the current directory: :cd xml Or more generally, if you want to set it sometimes: nnoremap gp :cd %:p:h<CR> Or if you want to always be in the current file's ...
nobe4's user avatar
  • 16k
8 votes

set completeopt=noinsert fails

The noinsert option became available with Vim version 7.4.775. Your Vim on the raspberry pi is (probably) older. You can check with :version.
Karl Yngve Lervåg's user avatar
8 votes
Accepted

When using the dictionary feature in vim, can you make dashes a matching part of a word?

The option iskeyword defines which characters should be considered as part of a word. This option uses the += and -= syntax to add or remove some characters. Thus the following line will add the ...
statox's user avatar
  • 49.6k
8 votes
Accepted

Neovim: Select an autocomplete option with <tab> instead of <return>

You need this map: inoremap <expr> <TAB> pumvisible() ? "<C-y>" : "<TAB>" If PUM (complete menu) is visible, then execute <C-y> (which selects an ...
Diego Somar's user avatar
7 votes

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

If you want proper documentation, the plugin in saginaw's comment seems to cover your C++ needs. I don't know of a generic one but you can probably find alternatives for other languages on vim.org. ...
romainl's user avatar
  • 40k
7 votes

Easiest way to switch git branches

The fugitive Git checkout <branch> has a downside that it doesn't autocomplete the branch name. Using fzf.vim I've created this command: function! s:changebranch(branch) execute 'Git ...
kubek2k's user avatar
  • 171
7 votes
Accepted

Vim filename/path completion

As @muru mentioned, there are no options to configure the directory from which to complete path and file names. It always uses the working directory of the window. I've written a couple of functions ...
tommcdo's user avatar
  • 7,680
7 votes
Accepted

Disable case sensitive auto-completion, while "smartcase" search is enabled?

Update: I created a plugin named vim-idetools that implements this feature along with a bunch of related refactoring tools. Feel free to try it out. Original answer: Well, I figured out a way to do ...
Luke Davis's user avatar
  • 1,397
7 votes
Accepted

Change keybinding for up/down when in vim popup

You can't "directly" map keys in the pop-up menu, you'll have to use expression mappings and the pumvisible() function to check if the popup menu is visible. inoremap <expr> <C-j> ...
Martin Tournoij's user avatar
7 votes
Accepted

Is it possible to put the cursor on the first item on auto-completion?

If you use the noinsert flag in completeopt in combination with menu, the first item will be selected (but not inserted into the buffer). set completeopt=menu,noinsert
Mass's user avatar
  • 14k
6 votes

Autocompletion with NodeJS, Visual Studio style

Ok, after years of trying many things, I finally found a viable solution! And the winner is: COC "It's a completion framework and language server client which supports extension features of ...
godot's user avatar
  • 256
6 votes
Accepted

Confirm selection among options

The behavior you are describing is controlled by the wildmenu option (:h 'wildmenu') While the "wildmenu" is active the following keys have special meanings: <Left> <Right> - ...
statox's user avatar
  • 49.6k
6 votes
Accepted

What is the difference between set complete+=t and set complete+=k in vim?

From :h 'complete': k scan the files given with the 'dictionary' option ] tag completion t same as "]" The tag k allows you to specify a file containing some words you want to use for ...
statox's user avatar
  • 49.6k

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