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

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.

Related

vim-javacomplete2 - Don't write first suggestion to line

I recently installed the plugin vim-javacomplete2 via vim-plug into Vim 7.4. Overall, I am happy with it but there is one thing that bugs me. When i initiate it with <C-x><C-o> it writes the first suggestion to the line like so.
Is there anyway to have it list the suggestions without writing the first one to the line like this?
I see it done on the plugin's GitHub page but i am unable to figure out how.
Since it says it uses the vim omnicompletion, i bet it works with the normal completopt settings: :set completeopt+=noinsert see :help completeopt for more information

cannot get SASS (indent style!) syntax highlighting to work in VIM 8

VIM VERSION: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May 2 2017 03:55:34)
I'm using a number of plugins with vim in order to make things work. I install them via the package manager Vundle, my .vimrc can be found in my dotfiles repository on github
Today, I tried to edit a SASS file with vim, however - the SASS file looks like a color-circus:
I've followed some steps from this answer which include:
Does enabling syntax explicitly fix your problem? :syntax enable
Is filetype detection on? :filetype
Does vim recognize this as a sass file? :set filetype?
Check to make sure your script directories are in the runtime path :set runtimepath?
Does manually loading the syntax file change anything? :runtime! vimfiles/syntax/sass.vim
Also check if syntax highlighting works for other filetypes.
The answers to each point are:
Nothing changed, syntax remains exactly the same.
running :filetype returns filetype detection:ON plugin:ON indent:ON
running :set filetype? returns filetype=sass
running :set runtimepath? returns a long list of ~/.vim/bundle/[PATH] entries of which none include sass in any form
running :runtime! ~/.vim/bundle/vim-haml/syntax/sass.vim also changes nothing
Syntax highlighting works for everything except SASS so far.
Additionally, I've tried adding some plugins from http://vimawesome.com/.
They all seem to be packages that either support a different package which should be supported by default or they do not support SASS (in addition to SCSS) highlighting.
This is, what I came up with in the end, still making no difference:
Plugin 'tpope/vim-haml'
Plugin 'JulesWang/css.vim'
Plugin 'hail2u/vim-css3-syntax'
The plugin tpope/vim-haml however, does have a sass.vim file with it's syntax rules, it's actually the only up-to-date one compared to the rest which all seem to hang at "last updated 5+ years ago".
I basically have two questions, which I hope, more experienced vimologists will be able to answer, or point me in the right direction of fixing it myself:
Is there any known properly updated SASS (indent syntax) plugin that I missed?
If the above question is "no", then how could I get the tpope/vim-haml sass syntax file loaded for all my sass files?
I'm using SASS since, coming from Atom, it is less typing. I would prefer to keep the sass syntax if possible! (I am aware of conversion plugins but for the sake of my colleagues I would like to refrain from using any)
Thanks in advance!
Answer
It was the colorscheme I was using, it caused severe formatting issues for my SASS files.
TLDR;
I was using roosta/srcery and just tried an alternate colorscheme to test if the sass file would look more "sane", it now looks like this (using a random colorscheme):
What we see here is still not perfect, but at least "sane" (I can understand why CSS3 flex properties aren't highlighted yet for instance), I'm simply going to try inform the author of the (really nice nonetheless) colorscheme to see if he is interested in improving it for SASS.
My lesson here, is that one should look at every aspect, I was thinking in the wrong direction and kept on going for too long as a result. When #romainl pointed out it looked fine using just regular-builtin-vim I started expecting a Plugin (a colorscheme) to be the suspect which solved my issue :)

Julia syntax highlighting in julia-vim

I use gvim with julia-vim for editing julia code. I am using julia 0.5 on a mac and installed julia-vim with vundle.
My problem is that files with the .jl extension do not have appropriate highlighting. For example, if is highlighted but for is not. Any solution for this?
.jl files are sometimes recognized as lisp files by default, (blame Sawfish) so that's probably the syntax highlighting you're getting. (type defun and progn and etc and see if the pretty colors pop up)
You were close when you said the correct solution was :set syntax=julia, what you need is to set filetype plus some autocmd magicks to make that happen every time you open a .jl file.
Put something like this in some file (e.g. jl.vim) in your ftdetect directory:
autocmd BufRead,BufNewFile *.jl :set filetype=julia
And that should do it.
Addendum 1: Changing filetype instead of syntax may be required to trigger additional features like the LaTeX expansions depending on the root of your problem, so that's what I am using.
Addendum 2: Note that this should've been handled by the julia-vim plugin, but conflicts with other scripts can mess with that. You can use :scriptnames to see what scripts have been loaded and in what order, and try to debug what could be causing the conflict, if you think that's worth the trouble.
Addendum 3: Also related is that Vundle has some specific configurations that need to be made when it comes to filetypes, so that could also be causing this. However, I've seen this and similar problems happen outside Vundle for any number of reasons so I still believe that the solution at the top is the best one, and will possibly prevent some future headaches.
After testing julia-vim I think the issue is likely with the color scheme you are using.
Try using a different one.
:colorscheme desert
I tried it with the built-in desert and both if and for were highlighted (see below).
I found that the instructions here worked a treat. Namely
git clone https://github.com/JuliaEditorSupport/julia-vim.git
mkdir -p ~/.vim
cp -R julia-vim/* ~/.vim
Note: I realise that the OP claims to have already installed Julia-Vim using Vundle, but I came to this question because Vim was automatically using LISP syntax highlighting for me, and the above was enough for me. So I am sharing in case anyone comes from the same boat as me (i.e. the problem is not Vundle related) :)

Prevent vim from autofolding when typing

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

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