问题
Just starting with Vim and I wondered – given a Sass block like this:
.thing {
width: 100%;
color: $color1;
.nested {
height: 1rem;
}
}
If my cursor is at the 'd' within 'width', what's the quickest way to visually select the entire rule set, selector, braces and all?
At present I am using 'Shift+}' to jump to the next blank line and then 'v' for visual and 'Shift+{' to select the prior block. Any better way?
回答1:
You're close. As you're already using the { and } motions to the borders of the current paragraph, just use the related text object: Vip, where V starts (linewise, but you can also use v as this text object forces this) visual mode, and ip selects the inner paragraph.
来源:https://stackoverflow.com/questions/24636276/quickest-way-to-select-an-entire-sass-ruleset-in-vim