无法在 VIM 8 中使用 SASS(缩进样式!)语法突出显示 [英] cannot get SASS (indent style!) syntax highlighting to work in VIM 8

查看:55
本文介绍了无法在 VIM 8 中使用 SASS(缩进样式!)语法突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VIM 版本:VIM - Vi 改进 8.0(2016 年 9 月 12 日,编译于 2017 年 5 月 2 日 03:55:34)

我在 vim 中使用了许多

我遵循了

我们在这里看到的仍然不完美,但至少理智"(例如,我可以理解为什么 CSS3 flex 属性尚未突出显示),我只是要尝试通知颜色方案的作者(虽然非常好),看看他是否有兴趣为 SASS 改进它.

我的教训是,应该从各个方面看,我的想法错了,结果坚持了太久.当@romainl 指出仅使用常规内置 vim 看起来不错时,我开始期待插件(一种颜色方案)成为解决我问题的嫌疑人 :)

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:

  1. Does enabling syntax explicitly fix your problem? :syntax enable
  2. Is filetype detection on? :filetype
  3. Does vim recognize this as a sass file? :set filetype?
  4. Check to make sure your script directories are in the runtime path :set runtimepath?
  5. Does manually loading the syntax file change anything? :runtime! vimfiles/syntax/sass.vim
  6. Also check if syntax highlighting works for other filetypes.

The answers to each point are:

  1. Nothing changed, syntax remains exactly the same.
  2. running :filetype returns filetype detection:ON plugin:ON indent:ON
  3. running :set filetype? returns filetype=sass
  4. running :set runtimepath? returns a long list of ~/.vim/bundle/[PATH] entries of which none include sass in any form
  5. running :runtime! ~/.vim/bundle/vim-haml/syntax/sass.vim also changes nothing
  6. 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 :)

这篇关于无法在 VIM 8 中使用 SASS(缩进样式!)语法突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆