Questions tagged [autocompletion]

For questions about the several commands to complete part of a keyword or line that has been typed.

Filter by
Sorted by
Tagged with
71 votes
7 answers
110k views

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

Many IDEs automatically complete function names, variables, method names, etc. as the user types. The best ones complete the names based both on the language's built-in library as well as what has ...
  • 2,888
45 votes
3 answers
72k views

How to get intelligent C++ auto-completion

Some editors (such as visual studio on windows) do C++ autocompletion which understand C++. For example, given: #include <vector> int main(void) { std::vector<int> v; v.i In visual ...
35 votes
1 answer
16k views

Is there any way to change the popup menu color?

Is there any way to change the background color of the popup menu in gvim? The default background color is pink, which is a little weird to me.
  • 453
31 votes
3 answers
8k views

How to create my own autocomplete function?

How do I create my own list of auto-completion for certain filetypes? For example I would like css and html to autocomplete from the list of css classes in FontAwesome.
  • 2,252
30 votes
7 answers
13k views

Easiest way to switch git branches

Right now I'm using fugitive to manage almost everything git related, but I can't find a good workflow to quickly visualize and switch between available branches. I can do :Git checkout <branch-...
29 votes
6 answers
19k views

Vim Code Completion for Python 3

I am running Debian Jessie and use the current vim-nox (with +python -python3). I am having a hard time trying to program in Python 3, as I struggle with Python 3 code completion. YouCompleteMe doesn'...
  • 351
28 votes
7 answers
26k views

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

Most editors have a feature like when you press some keys by placing caret over a function, it pops the documentation of that function along with number and type of arguments that function takes. I ...
  • 381
19 votes
1 answer
5k views

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

I'm brushing up on my vim skills and fiddling with completion using the Ctrl-n command. I'm programming in Perl. When I am in insert mode and hit Ctrl-n, I get a message that it is "Scanning included ...
  • 1,277
18 votes
1 answer
2k views

Bash-like partial tab-complete for filenames in Vim

In Bash, when there are several files with the same prefix and I type part of the prefix and hit Tab, it completes the common prefix and allows me to continue typing to differentiate among the ...
  • 8,112
18 votes
1 answer
1k views

Filename Completion for Remote Files

My friend showed me a cool trick on Emacs some days ago where he could just open a file on a remote server and I instantly thought "there should be a way to do that in vim too" and it was true. I ...
16 votes
1 answer
2k views

How do I exclude certain file extensions from completion?

Is there a way to configure vim regarding what file types it considers "suitable" for opening? Let me clarify by an example. Imagine you are working on a latex document. Once you build your file, you ...
  • 549
14 votes
2 answers
3k views

How can I lookup LaTeX symbols in Vim?

Can I integrate some form of symbol completion to Vim? Dedicated TeX editors like TeXMaker provide a list of symbols for completion (for example, \al shows a list with \alpha, \la shows \lambda and \...
  • 24k
13 votes
1 answer
940 views

Ins-completion of WORDs

<C-p> and <C-n> allow the completion of words found within the current document. I am taking some notes and writing say {0,1}^n and (E,D) many times. These are WORDs constituted by ...
12 votes
2 answers
2k views

Zsh-like tab completion of partial paths

Related to Bash-like partial tab-complete for filenames in Vim One of the truly fantastic features of zsh is that you can type, for example, ls /u/s/m/m/who.1, press Tab and have it complete to ls /...
  • 24k
12 votes
1 answer
6k views

Vim filename/path completion

I know I can complete filenames/paths from the current directory using ctrl+x, ctrl+f (compl-filename). That works great in combination with set autochdir, which changes updates the current directory ...
12 votes
1 answer
615 views

Dynamic completion

I'm trying to enhance an old completion function. I'd like it to update the choices displayed in the popup menu as I type new characters My completion function is function! lh#icomplete#ecm(...
  • 16.2k
11 votes
1 answer
2k views

cancel complete

Usually insert mode completion (<C-n>) inserts the right word the first time I press <C-n>, but not always. Therefore, I would like Vim to insert the match it deems best when I press <C-...
  • 932
11 votes
2 answers
169 views

How can Vim help me remember the trailing commas in BibTeX files?

I edit quite a few BibTeX files, and I regularly forget the trailing commas: For example: @Book{cooke2015british, author = {Cooke, Lez}, title = {British Television Drama}, publisher = {...
11 votes
1 answer
1k views

How can I use insert mode completion in a macro?

I'm trying to define a macro which quickly generates a list of random-ish words. I want the macro to turn this into a list like a b c d e into this arezzo bywords czars détente eyrie What I have ...
10 votes
1 answer
8k views

Why doesn't YouCompleteMe complete function paramters?

I'd like to use YouCompleteMe with C++ semantic completion, but after hours of trying, I can't find why it doesn't work as expected. Everything seems to be working but I can't complete function ...
  • 191
10 votes
2 answers
156 views

Auto completion for option values on the cmdline

I cannot count the number of times I have tried to do this: :set foldmethod=syn^I It seems that completion doesn't work on option values! In some cases options are complex strings where completion ...
  • 3,492
10 votes
2 answers
331 views

Share completions between running vim instances

I use tmux for the most part instead of using vim tabs and splits. Does vim have the ability to share completions (via Ctrln and Ctrlp) between running instances? Is there a way to set it up where ...
  • 1,653
9 votes
3 answers
9k views

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

I'm wanting to learn Vim, but think it's probably too daunting. I imagine learning enough to become powerful with it, then forgetting 99% after I'm on a computerless project for a while. I know just ...
  • 347
9 votes
4 answers
2k views

Vertical WildMenu in Vim

One thing that really bothers me in vim (probably the only thing), is the wildmenu. In neovim, the wildmenu is vertical and looks as following: However, in vim, it is horizontal and looks like this: ...
9 votes
2 answers
301 views

How can I make vim stop splitting my words into chunks?

English language users probably don't have this trouble, but vim is pretty dumb when it comes to regular expressions. In my case most letters in the Turkish alphabet outside the EN alphabet don't seem ...
  • 2,165
9 votes
1 answer
4k views

Argument completion for python

Is there a way to get argument completion for python? I am currently using a combination of ctags, python-mode and YouCompleteMe, but I am missing a function to autocomplete the arguments of a ...
  • 93
9 votes
2 answers
338 views

Is there a way to disable the foldexpr during autocomplete?

I've noticed that vim's fold method affects the efficiency of autocomplete, e.g. C-N is slow, and C-X L is hideously slow in medium sized files with relatively expensive foldexprs. I can't see the ...
9 votes
1 answer
302 views

Smart word completion when in the middle of a word

Consider a file with the following two lines: someLongFunction someFunction When I am in the insert mode in the middle of the second word some|Function and I press Ctrl-n, I get ...
  • 519
9 votes
2 answers
3k views

How to select a matched autocompletion item

I want to select the 6th item (here readImage) in the auto-completion items. The normal way i knew is pressing ctrln for 6 times until the matched word is selected and then press enter. I tried ...
  • 870
9 votes
1 answer
779 views

How can I limit number of suggestions when using YouCompleteMe?

I'm working on fairly large php codebase (~1.3 mil lines of code). I have generated tags and now when I'm typing something like $data-> YouCompleteMe lags really hard and basically freezes Vim ...
  • 569
8 votes
2 answers
1k views

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

I'm having the following CSS class structure .mAIcon .mAIcon-reject .mAIcon-edit .mAIcon-accept .event and so on. Inside my HTML files I want to autocomplete these class names. But when I type &...
8 votes
1 answer
210 views

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

The dictionary feature in vim allows you to use a file (for instance /usr/share/dict/words) and set multiple paths within the dict option to search on. Now the file I'm searching on has several ...
  • 3,153
8 votes
1 answer
818 views

File name completion relative to currently edited file

If I open a file that isn't in the current directly, when I used Vim to autocomplete a filename, Vim provides files relative to the location where I launched Vim, not the currently edited file. ...
8 votes
1 answer
1k views

Filename Completion with Spaces

I have a lot of files that have spaces in their names, and this is giving me problems. If I try to do command line completion for the find command, and one of these files come up, Vim will find it, ...
8 votes
1 answer
321 views

Autocomplete for make

If I set a custom make program, is there any way to provide a list of tab completion options that would get activated when I type :make+Space+Tab? With custom commands I can do f.i.: command! -nargs=...
  • 275
7 votes
3 answers
368 views

Return from command autocomplete

If I type :e foo/**/foo*.js and hit tab then vim replaces the *s with all possible suggestions in the filepath. What if I realized that I wasn't specific enough (there are too many results in ...
7 votes
3 answers
897 views

How to set up tags for Ruby, SASS, Slim and Coffescript?

I am developing main in Rails using SASS, Slim and Coffeescript. I have Exuberant Ctags installed and using tpope's setup It kind of works so at least I can move around my ruby code. But I would ...
  • 2,252
7 votes
1 answer
2k views

Python imports autocompletion

I'm trying to configure vim for python development. Right now I'm working on code autocompletion feature. I'm using YouCompleteMe plugin and it seems to be working great but only when I've already ...
  • 171
7 votes
0 answers
819 views

Can I give YouCompleteMe a static list of completions?

I am using the Julia programming language, and as of right now, there are no good syntax-completer for VIM. I am working on one, but haven't fully got my head around how to hook into ycmd. Til I ...
6 votes
2 answers
156 views

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

Occasionally, when writing shell scripts and such, I have entries of the form: foo=/bar/baz To get filename completion (<C-x> <C-f>) to work, I have to put a space after the =, and then ...
  • 24k
6 votes
2 answers
390 views

imap beginning with <C-o> interferes with omnicomplete

I added the following key mappings: inoremap <silent> <Up> <C-o>gk inoremap <silent> <Down> <C-o>gj The goal was that j/k would still work the way that I was ...
  • 535
6 votes
1 answer
2k views

Cycle through autocomplete menu using tab

I am activating my autocomplete menu in vim using: inoremap <C-@> <C-n> and after it opened and only when it opened I would like to use the "tab" key to cycle through the menu. But when ...
6 votes
2 answers
300 views

Shell scripting: A more elegant way to complete then...fi, do...done, case...esac pairs?

The problem In shell scripting, conditionals and loops don't use curly braces to indicate blocks, but rather special keywords: if [ ... ]; then statements close with fi, while [ ... ]; do statements ...
  • 165
6 votes
2 answers
488 views

Convert absolute path to one relative to another absolute one

Context I’m working on an 'omnifunc' function for Markdown editing. It’s supposed to help me link to other Markdown files while I’m typing a link – based on file content though, not file name. Suppose ...
  • 163
6 votes
1 answer
3k views

Completion suggestions while typing

I use Vim a lot for writing tasks and I used ^p for completions. However, is there a plugin that suggests you completions while typing like in Andriod-smartphones ? Thanks.
6 votes
1 answer
835 views

Add closing parenthesis when completing function (omnicomplete)

I can complete functions with omnicomplete using c-x c-o but it only adds the opening parenthesis, is it possible to make it add the closing parenthesis and put my cursor between them? Seems ...
6 votes
1 answer
2k views

Triggering UltiSnips with enter

Is there any possible way to do expand trigger in UltiSnips with enter? I've tried <Enter>, <Return>, and <CR>. It works to trigger but doesn't work for new line. And I've tried to &...
  • 507
6 votes
1 answer
83 views

Tab to complete filenames with :find at an arbitrary depth

Notes: I have set path=$PWD/** in my .vimrc I am using Vim 7.3 Often times, I am sitting with Vim open at the root of my project and I enter :find somef<Tab> to find and open a file at an ...
's user avatar
5 votes
2 answers
102 views

How can I go into a directory in filename completion?

Consider a directory structure like this: topdir/ file1 file2 foo/ bar1 bar2 Say I want to open some file in foo/ in a new tab. I would first write :tabe topdir/, and then keep hitting ...
  • 2,557
5 votes
2 answers
1k views

Easiest way to insert LaTeX matrix?

Recently I found myself in a situation that need to type in quite a number of matrices to LaTeX by hand, so I was wondering if there are some tools that can help me to save some keystrokes. The ...

1
2 3 4 5
7