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
63
votes
5answers
96k 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 ...
38
votes
3answers
56k 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 ...
28
votes
3answers
6k 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.
27
votes
6answers
18k 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'...
24
votes
6answers
10k 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-...
22
votes
1answer
9k 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.
21
votes
7answers
19k 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 ...
17
votes
1answer
4k 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 ...
17
votes
1answer
845 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
1answer
1k 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 ...
15
votes
1answer
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 ...
13
votes
2answers
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 \...
13
votes
1answer
735 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
1answer
518 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(...
11
votes
1answer
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-...
11
votes
2answers
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 /...
11
votes
1answer
5k 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 ...
11
votes
2answers
135 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
1answer
773 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
1answer
7k 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 ...
10
votes
2answers
124 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 ...
10
votes
2answers
284 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 ...
9
votes
1answer
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 ...
9
votes
2answers
268 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
1answer
274 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 ...
9
votes
1answer
698 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 ...
8
votes
1answer
6k 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 ...
8
votes
2answers
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
2answers
256 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 ...
8
votes
2answers
1k 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 ...
8
votes
1answer
741 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
1answer
263 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=...
7
votes
1answer
171 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 ...
7
votes
1answer
707 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. ...
7
votes
3answers
272 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
3answers
852 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 ...
7
votes
1answer
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 ...
6
votes
2answers
290 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 ...
6
votes
2answers
264 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 ...
6
votes
1answer
76 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 ...
5
votes
2answers
97 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 ...
5
votes
2answers
139 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 ...
5
votes
2answers
4k views

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

I use YouCompleteMe and it works great (after some setting up woes) for both C/C++ and Python code. However, it tries to complete things in text files such as ReStructured text, markdown, etc... The ...
5
votes
1answer
245 views

How to make `C-x C-k` dictionary completion respect case?

Vim has excellent inbuilt autocompletions. I've noticed that using C-x C-k (see :h i_CTRL-X_CTRL-K for more) for dictionary completion will not respect the case by default. For instance, if I type ...
5
votes
1answer
2k 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.
5
votes
4answers
907 views

How do I make dictionary completion look in a different file if triggered after the @ sign?

I have been using Vim as a research database, and I use tags in the form of @tag for each note, written in the second line after the title. I might have more than one tag. How can I make dictionary ...
5
votes
1answer
802 views

Including dictionary terms with spaces

We can use dictionaries to help us complete keywords. To set a new dictionary you can use set dictionary+=path/to/dict. This way you will be able to complete from a dictionary by typing <C-x><...
5
votes
1answer
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 &...
5
votes
2answers
65 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 ...
5
votes
2answers
751 views

How to enable “on-the-fly” autocompletion?

How can I make it so that no command or extra keystroke is required for the autocompletion menu to pop up? i.e. what I want is the menu to be always present while in insert mode and to be constantly ...

1
2 3 4 5 6