Ⅰ. 插件描述
A vim plugin for csscomb.jsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'danhodos/vim-comb'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'danhodos/vim-comb'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'danhodos/vim-comb'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/danhodos/vim-comb
Ⅳ. 文档说明
# vim-comb
vim-comb is a vim bridge to csscomb.js, a coding style formatter for CSS (and its various pre-processors). csscomb.js replaces the deprecated csscomb.
Requirements
You will need csscomb.js installed, which is a node.js package. On Mac OS X with homebrew installed, you can get set up with:
brew install node
npm install -g csscombInstallation
With vim-plug
Add this to .vimrc:
Plug 'danhodos/vim-comb'and run :PlugInstall
With Pathogen
cd ~/.vim/bundle
git clone https://github.com/danhodos/vim-comb.gitUsage
Because vim-comb is implemented using a formatexpr that is set for CSS (and CSS-like files, e.g. SCSS), you can use the standard gq with a motion (or after making a visual selection) to format your code through csscomb.js.
If csscomb.js returns an error (say, for instance, if you encounter this problem), then the error will be displayed without changing the contents of the buffer.
Configuration
vim-comb will look for a file named .csscomb.json in your project directory. If it cannot find one, it will use a stock pre-defined configuration file.
The format of the .csscomb.json file is documented on the CSScomb site.
Acknowledgments
The vim portion of this plugin was originally based on that of vim-csscomb.