Vim: SnipMate + HAML - vim

I've recently configured SnipMate to work alongside autocomplete for Rails development. I've bound both SnipMate and autocomplete to Tab, which works beautifully.
However, when dealing with Haml files, Tab isn't behaving as expected. Instead of inserting tabs (when no autocomplete or snippet is available), it's moving my cursor to the next blank line in the document.
Disabling SnipMate resolves the issue, but then I have no SnipMate.
Does anyone know where I might look to fix this?
Cheers,
-W

Use ctrl+tab to disable SnipMate tab behavior

install the supertab plugin and config it to use both.

Related

delimitMate not working on vim installed with Pathogen

I'm trying to install delimitMate on vim version 7.3. I am using Pathogen. My other pathogen bundles work, so it is not a problem with my setup.
In fact, I've also tried auto-pairs and ClosePairs plugins too, and none of them work. I don't know why? Am I using it wrong? Shouldn't a matching paren simply follow when I put an opening paren (similar to sublime Text?)
The commands :DelimitMateTest and :h delimitemate works, so the script is being executed. It's just not actually autoclosing any parens, and I can't figure out why.
Here's the output file for :DelimitMateTest: http://pastebin.com/2WtHVZJL
Any ideas as to why I can't get paren completion from any plugin?
Thanks!
For those of you who come across this problem in the future:
I had set paste in my .vimrc. This permanently disables several other features, and it was messing up key mappings. Simply remove it from your .vimrc and you should fix your problem.

How can I use the Tab key to indent in vim with SuperTab enabled?

I've just enabled SuperTab in vim, and if I try to indent a blank line, SuperTab is attempting to insert strings. What I'd like, I guess, would be to have SuperTab offer completions only if there is non-whitespace to the left of the cursor.
I don't want to have to use Ctrl-V or Ctrl-Q or anything.
This could be caused by an old version of snipmate, update to the forked version maintained by Gargas.
It has quite a few dependencies so I'd recommend using Vundle if you're not already using it.
See comments to OP for more information.
msanders/snipmate.vim conflicts with supertab.
you can use ultisnips instead of Snipmate
https://github.com/SirVer/ultisnips

Syntastic not working with MiniBufExplorer vim plugin

First off I'm a windows user using VIM and vundle to manage my plugins.
I have the Syntastic vim plugin (https://github.com/scrooloose/syntastic) and it works great highlighting any syntax errors for the first javascript file I open and save.
I also have the minibufexplorer plugin (https://github.com/sontek/minibufexpl.vim). Once I open a second file the MiniBufExplorer window appears allowing me to navigate between previously opened files via :b1, :b2, etc. I've noticed when this happens Syntastic stops working.
If I remove the minibufexplorer plugin then Syntastic always works. I'd really like to get both working together, does anyone have a solution for this? I would gladly use an alternative to minibufexplorer if it works with Syntastic.
I'm using pathogen to organize my installed plugins. I have syntastic and minibufexplorer and they work well together for me.
I have done no configuration at all to any of thees plugins. But to handle bufferswitching in an easy way (also works without minibufexplorer) I use this in my .vimrc:
map § :bnext^M
map ½ :bprevious^M
Its the key just below the Esc-key. It makes it very easy to just hit the § key to cycle through all open buffers.
Here is a good place to start your configuration.
Since I'm open to alternatives I will be removing the MiniBufExplorer plugin and using the :ls vim command to view the buffer list when desired. It's not as convenient as using the MiniBufExplorer plugin but I find syntax highlighting more important and am satisfied with this workaround.

Autocompletion in Vim

I'm having trouble with autocompletion. How can I get a code suggestion while I'm typing?
I usually develop in PHP, Ruby, HTML, C and CSS.
Use Ctrl-N to get a list of word suggestions while in insert mode. Type :help i_CTRL-N to see Vim's documentation on this functionality.
Here is an example of importing the Python dictionary into Vim.
You can use a plugin like AutoComplPop to get automatic code completion as you type.
2015 Edit: I personally use YouCompleteMe now.
If you are using VIM version 8+, just type Ctrl + n or Ctrl + p.
You can start from built-in omnifunc setting.
Just put:
filetype plugin on
au FileType php setl ofu=phpcomplete#CompletePHP
au FileType ruby,eruby setl ofu=rubycomplete#Complete
au FileType html,xhtml setl ofu=htmlcomplete#CompleteTags
au FileType c setl ofu=ccomplete#CompleteCpp
au FileType css setl ofu=csscomplete#CompleteCSS
on the bottom of your .vimrc, then type <Ctrl-X><Ctrl-O> in insert mode.
I always rely on this CSS completion.
There is also https://github.com/Valloric/YouCompleteMe and it includes things like Jedi and also has fuzzy match. So far I found YCM to be the fastest among what I have tried.
Edit: There also exists some new ones like https://github.com/maralla/completor.vim
Another option is coc.nvim.
It's really fast and the completion is great as it uses intellisense the same autocompletion as VScode has.
It also has linting capabilities. So it shows you were you might have a bug.
It supports a multitude of languages.
It might take a bit to set up and configure but I think it is the best autocompletion engine for vim out there.
I've used neocomplcache for about half a year. It is a plugin that collects a cache of words in all your buffers and then provides them for you to auto-complete with.
There is an array of screenshots on the project page in the previous link. Neocomplcache also has a ton of configuration options, of which there are basic examples on the project page as well.
If you need more depth, you can look at the relevant section in my vimrc - just search for the word neocomplcache.
Here is link! for PHP.
press the Ctrl + x followed by Ctrl + o keys while writing some PHP functions.
Thanks to Oseems Solutions for the tutorial
If you only wanna auto-completion from cache of your current buffers, supertab is easier to install than neocomplete, can work on Mac pre-installed vim out of box without the need of MacVim.
You can check other alternatives at vim awesome.
For PHP, Padawan with Deoplete are great solutions for having a robust PHP autocompletion in Neovim. I tried a lot of things and Padawan work like a charm!
For Vim you can use Neocomplete instead of Deoplete.
I wrote an article how to make a Vim PHP IDE if somebody is interested. Of course Padawan is part of it.
I recently discovered a project called OniVim, which is an electron-based front-end for NeoVim that comes with very nice autocomplete for several languages out of the box, and since it's basically just a wrapper around NeoVim, you have the full power of vim at your disposal if the GUI doesn't meet your needs. It's still in early development, but it is rapidly improving and there is a really active community around it. I have been using vim for over 10 years and started giving Oni a test drive a few weeks ago, and while it does have some bugs here and there it hasn't gotten in my way. I would strongly recommend it to new vim users who are still getting their vim-fingers!
OniVim: https://www.onivim.io/

Vim: SnipMate Plugin: how i can change a .snippet and update it on the fly?

does anyone know how to edit a dot snippet file and reload into (g)vim without closing and re-open the program? it would be great to do that with this excellent plugin.
greetings
If you have the latest version of snipmate you can use the following command from vim to reload all the snippets :call ReloadAllSnippets() or better you can map it to a key
I am currently on a promoting tour for UltiSnips on StackOverflow. UltiSnips will watch your snippet files for change, so all you have to do is save your .snippets file and the changes are immediately available in Vim. There is also a handy :UltiSnipsEdit command that will open the correct snippets file right away.
A conversion script for snipMate snippets is shipped with UltiSnips, so switching is easy.
Have a look at the following discussion

Resources