问题
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
returnsfiletype detection:ON plugin:ON indent:ON
- running
:set filetype?
returnsfiletype=sass
- running
:set runtimepath?
returns a long list of~/.vim/bundle/[PATH]
entries of which none includesass
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!
回答1:
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 :)
来源:https://stackoverflow.com/questions/43919929/cannot-get-sass-indent-style-syntax-highlighting-to-work-in-vim-8