Format your CSS using CSSfmt inside Vim.
This plugin is heavily inspired by vim-esformatter.
First you need to install CSSfmt (make sure you have Node.js installed):
npm install -g cssfmt
Then install the plugin:
- Manual installation:
- Copy the files to your
.vim/plugin
directory
- Copy the files to your
- Pathogen
cd ~/.vim/bundle && git clone git://github.com/kewah/vim-cssfmt.git
- Vundle
- Add
Bundle 'kewah/vim-cssfmt'
to.vimrc
- Run
:BundleInstall
- Add
- NeoBundle
- Add
NeoBundle 'kewah/vim-cssfmt'
to.vimrc
- Run
:NeoBundleInstall
- Add
- vim-plug
- Add
Plug 'kewah/vim-cssfmt'
to.vimrc
- Run
:PlugInstall
- Add
In normal mode:
:Cssfmt
: format the whole buffer.
In Visual mode:
:'<,'>CssfmtVisual
: format the selected block.
Or by mapping the commands in your .vimrc
:
nnoremap <silent> <leader>cs :Cssfmt<CR>
vnoremap <silent> <leader>cs :CssfmtVisual<CR>
Released under the wtfpl license