This is getting really irritating and I can't seem to figure out how to disable this feature. I notice that if I use a [ in a line and then press enter and then close an if statement with }, it will automatically indent to the same column as the [ in the previous line. Is there any way to disable this feature?
Yes. Go to the View menu and select Code View Options and then disable Auto Indent.
Related
I have a problem that when I use my mouse to focus on my vim window, I often end up in Visual mode. However, I like many of the mouse functions such as resizing windows and selecting tabs.
Is there any way to leave mouse mode enabled, but disable the mouse's ability to enter Visual mode when accidentally selecting text?
Try this in your $HOME/.vimrc configuration.
set mouse=nicr
Or if you want to use on the fly in vim , try with command mode :set mouse=nicr
For some user's set mouse-=a also works, but that is not working for me.
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.
While coding Python, I like Vim's omnicompletion function, but I don't want Scratch Window to pop up at top.
How can I disable it?
(I'm using gVim 7.3)
This behavior is defined by the presence of preview in the value of the 'completeopt' option.
The default value is:
menu,preview
To remove preview, simply add this line to your ~/.vimrc or modify an existing completeopt line:
set completeopt-=preview
If you don't mind the preview window too much, but want to easily close it, you can use the :pclose command or CTRL-W z keyboard combination see :help :pclose.
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.
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.