All Projects → jasonlong → vim-textobj-css

jasonlong / vim-textobj-css

Licence: Unlicense license
Vim text objects for CSS, Sass, etc.

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to vim-textobj-css

vim-textobj-sentence
Improving on Vim's native sentence text object and motion
Stars: ✭ 92 (+170.59%)
Mutual labels:  vim-textobj-user
vim-textobj-quote
Use ‘curly’ quote characters in Vim
Stars: ✭ 112 (+229.41%)
Mutual labels:  vim-textobj-user

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.

demo

Usage

  • vic Visually select inner CSS (inner rules)
  • vac Viscually select "all" CSS (entire block w/ selector(s))
  • cic Change inner CSS
  • cac Change "all" CSS
  • dic Delete inner CSS
  • dac Delete "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 if you use vim-gitgutter ⚠️

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>GitGutterTextObjectOuterVisual

Installation

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'
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].