Is there a way to leave code completion menu without selecting any option? (after pressing <C-x><C-o>)
I am looking for something equivalent for pressing <Esc> in VisualStudio Intellisense menu.
You can use ctrl+E. See docs for further information.
Related
In vim, when using an autocomplete plugin (or just vim's built-in omnifunc), a window will pop up next to the cursor with completion suggestions:
Vim tries to be smart about where to put this menu, putting it below the cursor most of the time, but above the cursor if you're near the bottom of the window and don't have space to see the window.
I recently updated to a new version of vim (and YouCompleteMe, the autocomplete plugin that I use), and it seems that vim (or YCM, not sure which is responsible) is now overly aggressive in putting things above the cursor instead of below, where basically if you're in the top half of the window, the popup menu is below the cursor, while if you're in the bottom half, the popup menu is always above the cursor.
My question is, how do I control this behavior? It seems like it's probably a vim setting, but in all of my searching I couldn't find anything that would hint at how vim decides whether to put the popup menu above or below the cursor.
The only completion-related options are 'complete' and 'completeopt'. The placement of the complete popup menu is hard-coded in Vim's source code.
If you think this has changed for the worse in a recent Vim version, please open an issue at the bug tracker, or directly discuss this on the vim_dev mailing list.
I have been googling for a way to use vim bindings inside normal text fields in chrome. I've tried vmium and cVim but I can't figure out whether they have the functionality I'm looking for.
An example is this exact text area in which I'm typing my question. I'd like to be able to press Esc and go to vim command mode in here, and start deleting a line pressing dd.
Would that be possible? Or those plugins are just for navigation shortcuts?
Here's the answer!
Those plugins are for navigation only. If you want a Vi-like
experience in Chrome's textareas, try Wasavi. – #romainl
The cVim plugin allows for keyboard shortcuts to manipulate text inside text boxes. However, the shortcuts are not the same as vim and there are not as many. After installing the extension type ":help" to see the list of shortcuts.
I'm using MacVim with YouCompleteMe plugin. Everything is awesome, but I have a small problem: pressing escape only closes the autocomplete popup without returning to normal mode - it stays in insert mode. For me, this behaviour is a bit weird - I always expect Esc to mean normal mode, hence my question: Can I force Vim to close the popup menu and go to normal mode on Esc? And how?
Thank you,
t.
It is mostly something conflicting in your setup. Take a look at github.com/Valloric/YouCompleteMe/issues/9.
If you have the AutoClose plugin remove it and replace it with delimitMate
https://github.com/Valloric/YouCompleteMe#nasty-bugs-happen-if-i-have-the-vim-autoclose-plugin-installed
I'm currently using superTab for completions in Vim. However, I'd like the completions to be more like bash. For example, if I'm typing
st
and the possible completions are
struct, string
I'd like it to be completed to
str
if I press tab, and ideally display a menu of possible completions.
Plugins are OK.
EDIT: completeopt+=menu, longest does most of what I want, but after the menu pops up and I narrow it down some, pressing tab again does a full completion instead of giving the next longest common prefix.
:set completeopt+=longest
should do the trick.
A great resource for tweaking the completion is Make Vim completion popup menu work just like in an IDE.
Omnicompletion is working, but it automatically inserts the first result.
What I'd like to do is open the omnicomplete menu, then be able to type to narrow down the results, then hit enter or tab or space or something to insert the selected menu item.
Is this possible?
The command you are looking for is:
:set completeopt+=longest
It will insert the longest common prefix of all the suggestions, then you can type and delete to narrow down or expand results.
set wildmenu
set wildmode=list:longest,full
Found here.
There is also a great plugin for all of your completion needs called SuperTab continued.
This plugin might do what you are after: autocomplpop
Or you can try and make Vim completion popup menu work just like in an IDE.
This is the general Vim completion behaviour. For a complete overview, you can do
:he compl-current
But for your specific case (which you require the completion to be in state 2 or 3 (described in the document above). You can simply use Backspace, or Control-H to jump from state one to state two. In state 2 you can narrow the search by typing regular characters. So to complete completion with narrowing:
compl<C-X><C-P><BS>letion
It is totally backwards, I know, but that's how it works.
Edit: You can use the Down arrow key too isntead of Control-H or Backspace, and it has the benefit of not deleting a character.