jyp / boon

Ergonomic Command Mode for Emacs
GNU General Public License v3.0
323 stars 34 forks source link

boon-select-content? #101

Closed subsetpark closed 3 years ago

subsetpark commented 3 years ago

I'm trying to piece together a full understanding of all the different boon functionality, and the region selectors are the most mysterious to me.

One that's not touched on at all in the tutorial is boon-select-content, and the docstring for that function is a bit hard to parse.

Since it shows up in the keymap PDFs, I assume it's designed for general consumption.

Could you say a few words about its behaviour, and maybe give an example of how it's used?

jyp commented 3 years ago

boon-select-content is perhaps the least useful region selector. I barely ever use it. So let's talk about boon-select-borders first, which is explained in the tutorial (it is bound to 'a' below, but call boon-tutorial to see it adapted to your keybindings)

It is also possible to remove enclosures with the ’a’ operator, which
transforms a region argument to its enclosure (the first and last characters).

Just delete the parentheses:

>> Move the cursor inside this (sexp).

>> Type ’t a x’.

Or delete the whole expression:

>> Move the cursor inside this (sexp).

>> Type ’t x’.

The ’a’ operator is especially useful when applied to ’x’, ’n’
and ’o’ --- but it works on any region.

So, boon-select-borders is an operator that transforms a region to its borders. boon-select-content is the dual of boon-select-borders: it transforms a region to its 'insides', by removing the 'borders'. Again, I find it next to useless.

subsetpark commented 3 years ago

@jyp thank you for that clarification! From my understanding, I think I can see why it would be included, as it's the dual of select-borders, and also why it wouldn't be very useful :)

Just to test my understanding: it seems to me that it would be much more useful if we didn't already have select-inside-pairs, is that right?

Given a line like

foo(bar)

I can remove bar by t z x - but I can also remove bar by t c.

evandromurilo commented 3 years ago

@jyp Hello! Thanks for the package, I'm having great fun with it.

I can't figure out how to do something that I think is related to this issue. Given I have the following text (^ is where the cursor is located): class="btn ^btn-sm"

How would I go around replacing the text inside ""? In VIM, for instance, I would type: ci" text.

jyp commented 3 years ago

@evandromurilo I had implemented the "quotes" selector in terms of the extend-region package, but did not bind it. I just pushed the commit which binds it to ". (3dd9669d01e48860bb7ea12be8c764a4bc6808ea) You can try rz" using the colemak bindings. With qwerty it is sz" I think.

evandromurilo commented 3 years ago

@jyp Worked great. Thanks.