Ⅰ. 插件描述
Vim text objects for CSS, Sass, etc.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'jasonlong/vim-textobj-css'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'jasonlong/vim-textobj-css'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'jasonlong/vim-textobj-css'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/jasonlong/vim-textobj-css
Ⅳ. 文档说明
# vim-textobj-css
Text objects in Vim are very useful. They allow you to modify text by word, sentence, paragraph, HTML tag, and more. vim-textobj-user is a Vim plugin that lets you define your own text objects and this project builds on that one to let you work with CSS blocks more easily.

Usage
vicVisually select inner CSS (inner rules)vacViscually select "all" CSS (entire block w/ selector(s))cicChange inner CSScacChange "all" CSSdicDelete inner CSSdacDelete "all" CSS
It's often handy to visually select a nested CSS block with vac and then type ac again to expand the selection to the parent block. This is shown in the above GIF.
:warning: Warning if you use vim-gitgutter :warning:
vim-gitgutter supplies some text objects for dealing with hunks and these conflict with vim-textobj-css. As the vim-gitgutter README describes, you can override those settings with something like:
omap ih <Plug>GitGutterTextObjectInnerPending
omap ah <Plug>GitGutterTextObjectOuterPending
xmap ih <Plug>GitGutterTextObjectInnerVisual
xmap ah <Plug>GitGutterTextObjectOuterVisualInstallation
This plugin requires vim-textobj-user. Use your favorite plugin manager to add these lines.
vim-plug
Plug 'kana/vim-textobj-user'
Plug 'jasonlong/vim-textobj-css'NeoBundle
NeoBundle 'kana/vim-textobj-user'
NeoBundle 'jasonlong/vim-textobj-css'Vundle
Plugin 'kana/vim-textobj-user'
Plugin 'jasonlong/vim-textobj-css'