Prevent vim from autofolding when typing - vim

Every time i use snippets in vim while coding in Python i get a problem which i desire to get rid off.
Here is the sequence of steps which leads to my problem:
type fun and hit Tab to trigger snippets of a new function
start typing to define its name.
On the last step i get all the body of my new function folded and i even don't see my cursor at the place i am currently typing.
Info:
I am using python-mode plugin which defines foldingmethod
here
I am also using ultisnips and vim-snippets.
Here is my
vimrc, which contains nothing criminal as seems to me.
How could i fix such an issue?

I had a similar issue with PHP code completion. It would automatically fold anything above a return statement as I typed.
I likewise narrowed the issue to the YCM plugin; I disabled all other plugins and set YCM options to defaults.
The issue went away when I set foldmethod to manual in my vimrc:
set foldmethod=manual

Related

Neocomplete does not work with vim files

I just installed Neocomplete and tried it for C files, ruby and python and it works perfectly.
I have problems with vim files as I don't get any omnicompletion at all. I tried C-x C-o and got omnifunc is not set error
What am I doing wrong? I thought this would work from scratch.
You aren't doing anything wrong. It isn't neocomplete's job to provide omnifunc.
Neocomplete does work well with omni completion: it uses omnifunc to provide good candidates for completion, along with other completions provided by vim. However, neocomplete itself does not provide or set omnifunc for differnt filetypes. That's why its configuration example has multiple lines with set omnifunc=...
It works with python etc. because the corresponding functions are provided by vim runtime files (e.g. /usr/local/share/vim/vim74/autoload/pythoncomplete.vim) or other plugins (like jedi-vim), and the omnifunc options are set accordingly (If you want to know where, try :verbose set omnifunc?).
Sadly, no function for omni completion for Vim script is provided by default, so you'll need to i) find one and ii) set omnifunc=(that function). After that, neocomplete will be able to use that function to provide omni completion.
Edit: as #Martin Macak pointed out, neocomplete-vim's github page does show something like omni-completion. After some digging, it seems these completions come from Shougo/neco-vim, mentioned briefly in the doc. i_CTRL-X_CTRL-V mentioned there is also worth trying.

Neovim + rainbow

Asking a question here worked before about this type of issue, so I will try again.
I'm trying to use the rainbow plugin (https://github.com/luochen1990/rainbow) while learning clojure.
I do have TERM=xterm-256color set in my shell (zsh, if it matters).
I've also tried running nvim as COLORTERM=xterm-256color TERM=xterm-256color nvim
Here are my results:
vim:
nvim:
If anyone has any advice or settings to try, I'd be extremely obliged. Thanks very much!
Seems your not the only one to notice https://github.com/luochen1990/rainbow/issues/31
It looks like something doesn't work properly to activate the plugin in neovim. Adding the following to your nvimrc
let g:rainbow_active = 1
autocmd VimEnter * RainbowToggle
makes the plugin work for me.
The autocmd just forces the plugin to start. If the plugin gets updated this might make it stop working since it could toggle it off.
Second answer
After more digging it appears you only need to put the following into your nvimrc.
syntax on
let g:rainbow_active = 1
The auto command gets fired on syntax on assuming g:rainbow_active is in your nvimrc.

How can I enable SCSS snippets for Vim's SnipMate?

I have installed garbas’s snipMate fork and honza’s snippet repository for Vim 7.3. I’m running OS X Lion 10.7.5.
I’m able to get everything working properly, as expected — my problem occurs when trying to add scss.snippets (I have tried to do so both as a plugin and manually into the snippets folder, with the same results). I know my new snippet file is recognized, because I tested it by adding CSS snippets to the newly-created scss.snippets file. I knew this would cause a collision, and it did in fact bring up the collision prompt (as outlined in the snipmate docs).
The specific problem: Typing a trigger and then Tab deletes the trigger and doesn’t return the expanded snippet.
I have tried setting the filetype and also the scope.alias solution proposed in Vim and snipMate (plugin) - adding new snippet won't work and in the docs, but I get the same results. Lastly, I tried eliminating all potential n00b mistakes by trying the above solutions against a clean .vimrc file. Again, I get the same results.
10 million virtual high-fives for anyone who can help me — until then, I’ll be bouncing my head off my desk awaiting my salvation... or perhaps reinstalling TextMate. Thanks in advance.
It's probably the snippets you used are not indented correctly or there's some mistakes in the syntax of those snippets which Snipmate then fails to autocomplete
Try looking at that particular snippets file and see if it's highlighted in some way.
it's just probably a wrong indentation of the source code.
Because i reproduced the problem on my scss.snippets file by reindenting or using improper syntax on the snippet files.
NOTE: the snippets use tabs instead of spaces so be sure to disable expandtab
:set noet or :set noexpandtab
I myself, don't know the reason behind this.

Not able to hide <# and #> with parameters for clang_snippets=1 with clang_complete

I've set this on my .vimrc:
let g:clang_snippets=1
let g:clang_snippets_engine='clang_complete'
let g:clang_conceal_snippets=1
set conceallevel=2 concealcursor=inv
I don't know how conceal is expected to work, maybe the clang_complete's docs should have a tip for a specific setting to hide the snippets adorns.
How do I hide it? I'm using MacVim built with +conceal, but it's not working. This is my messy .vimrc by now.
NOTE:
I'm sticking with g:clang_snippets_engine='clang_complete' because it seems to be more smart than the snipMate parameter completion, switching to NORMAL mode is a wiser choice to navigate between parameters since I can use SuperTab completion for params in INSERT mode while being able to navigate through them with the same tab at NORMAL mode. snipMate engine was acting weird to me sometimes too, sometimes it switched to a parameter after a completion, sometimes not.
Also, I'm missing a final tab to go after the last parameter, right after the function call (snipMate does that), so I can just insert ; and hit Enter.
Disclaimer: This question is related with the issue at https://github.com/Rip-Rip/clang_complete/issues/176.
EDIT:
My problem was with this line at my .vimrc:
au BufNewFile,BufRead *.cpp set syntax=cpp11
I'm using C++11 Syntax Support and #xaizek has discovered and pointed it out as the problem in the comments bellow in the accepted response, it seems the root cause is the use of the syntax clear command in it.
According to :help 'concealcursor':
Sets the modes in which text in the cursor line can also be concealed.
When the current mode is listed then concealing happens just like in
other lines.
n Normal mode
v Visual mode
i Insert mode
c Command line editing, for 'incsearch'
So with concealcursor=iv you asked Vim to hide concealed text in insert and visual modes, but show it in normal mode. So just do:
:set concealcursor=inv

Vim clears tags after failed omnicompletion

I am using Vim 7.3 with a great deal of plugins, mainly for PHP development. The omnicompletion works well, apart from a small glitch I've come across. I'm trying to work out whether this is a bug in Vim or a problem with my set up, so here's the situation:
I use set tags=<files> to specify the ctags files that I'm using.
:set tags=/home/jon/.vimtags.php,/home/jon/project/.vimtags.php
If I then print the contents of tags, I get what I expect to:
:set tags?
tags=/home/jon/.vimtags.php,/home/jon/project/.vimtags.php
I can also use omnicomplete as usual, with <C-x> <C-o>. This is, until I try and complete with something that doesn't exist (i.e. an unknown tag that returns no results). I get the "Pattern not found" error message and then, bizarrely, my tags file list is cleared. If I print the contents of tags straight after, I get:
:set tags?
tags=
I've done a great deal of grepping on the Vim plugins that I'm using but, as far as I can see, none of them are setting the tags files anywhere.
Can anyone tell me whether this is due to something in my set-up or a bug in Vim itself? Or even whether anyone else finds the same issue?
I can confirm that this isn't default Vim behaviour - it was being caused by the indexer plugin. For some reason, there was a function that reset tags when the omnicomplete failed. I'm going to contact the developer about this, and see if he can come up with a solution.

Resources