简体   繁体   English

为背景颜色启用VIM至CSS自动完成功能:hsla和rgba

[英]Enable VIM to CSS autocomplete for background-color: hsla and rgba

I use VIM to edit CSS files. 我使用VIM编辑CSS文件。 offers language-specific keywords auto completion. 提供特定于语言的关键字自动完成功能。 For CSS background-color this list is offered: 对于CSS背景色,提供了以下列表:

transparent
rgb(
#

I mostly use hsla( and rgba(, how do I add these to the list? Can I edit the css.vim file for this? 我主要使用hsla(和rgba(,如何将它们添加到列表中?我可以为此编辑css.vim文件吗?

  1. Open the default completion script: 打开默认的完成脚本:

     :e $VIMRUNTIME/autoload/csscomplete.vim 
  2. Save and edit a local copy: 保存和编辑本地副本:

     :saveas ~/.vim/autoload/csscomplete.vim 
  3. Search for transparent : 搜索transparent

     /transp<CR> 
  4. Append the desired values: 附加所需的值:

     $i, "rgba(", "hsla("<Esc> 
  5. Repeat until you have edited all the relevant lines. 重复直到您编辑了所有相关行。

  6. Write the file and quit: 写入文件并退出:

     :x 
  7. Try it in a new session: 在新会话中尝试:

     $ vim foo.css 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM