Cannot get SASS syntax highlighting (indent style!) For working in VIM 8

VIM VERSION: VIM - Vi IMproved 8.0 (2016 September 12, compiled May 2, 2017 03:55:34)

I use several plugins with vim to make everything work. I install them through the Vundle package manager, my .vimrc can be found in my dotfiles repository on github

Today I tried to modify the SASS file with vim, however the SASS file looks like a circus color:

vim broken sass highlighting

I followed a few steps from this answer , which include:

  • Does the syntax explicitly support the problem? :syntax enable
  • Is file detection detected? :filetype
  • Does vim define this as a sass file? :set filetype?
  • Make sure your script directories are in the execution path :set runtimepath?
  • Does manual loading of the syntax file do anything? :runtime! vimfiles/syntax/sass.vim
  • Also check to see if syntax highlighting works for other file types.

Answers to each point:

  • Nothing has changed, the syntax remains 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 :runtime! ~/.vim/bundle/vim-haml/syntax/sass.vim doesn't change anything either
  • Syntax highlighting works for everything except SASS.

In addition, I tried to add some plugins from http://vimawesome.com/ . They all seem to be packages that support another package, which should be supported by default, or they do not support SASS highlighting (in addition to SCSS).

This is what I came up with, after all, it still doesn't matter:

 Plugin 'tpope/vim-haml' Plugin 'JulesWang/css.vim' Plugin 'hail2u/vim-css3-syntax' 

However, in the tpope/vim-haml there is a sass.vim file with its syntax rules, it is actually the only one compared to the others, which all seem to hang during the "last update 5+ years ago".

I basically have two questions that, I hope, more experienced vimologists will be able to answer or point me in the right direction to fix it myself:

  • Is there any known correctly updated SASS plugin (syntax indent) that I skipped?
  • If the above question is no, then how can I get the sass tpope/vim-haml sass tpope/vim-haml file for all my sass files?

I use SASS because, based on Atom, this prints less. I would rather keep the sass syntax if possible! (I know about conversion plugins, but for the sake of my colleagues I would like to refrain from using any)

Thanks in advance!

0
source share
1 answer

Answer

It was the color scheme I used, it caused serious formatting problems for my SASS files.

TL; DR;

I used roosta / srcery and just tried an alternative color scheme to check if the sass file would look more β€œhealthy”, now it looks like this (using a random color scheme):

sane vim sass highlighting

What we see here is still not perfect, but at least β€œsane” (I can understand why CSS3 flex properties are not yet highlighted), I will just try to tell the author (really nice, though) colorscheme to find out if he is interested in improving it for SASS.

My lesson here is that you need to look at every aspect, I thought in the wrong direction and continued to walk too long as a result. When @romainl pointed out that it looked great using only regular-built-in vim, I began to expect the (Colors) plugin to become a suspect that solved my problem :)

+1
source

Source: https://habr.com/ru/post/1313423/


All Articles