-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Operating on regions (Visual mode) #53
Comments
Definitely, and other users have brought this up before as well. This falls under properly supporting Evil's "Visual mode" which is a Vim-like modal way to use regions. For now, you could use commands like I seem to recall I did initially try to add support for it a long time ago, but at the time I wasn't familiar with evil and wasn't able to get keybindings to be recognized in Visual state. Were I to attempt it now, I would try something like this:
Now in visual state we can already use Assuming all that works out, this would be quite a nice addition. |
Thank you for the detailed response! I might take a stab at this and open a pull request if I have something that seems interesting. Here's some of my initial thoughts: Regarding point 3, I think I'd expect the region to follow the point even when moving to deeper levels of nesting. So if I press Growing/shrinking the region could perhaps just use the default slurp/barf bindings in the visual mode? In that case, we don't need to consider which side of the expression the cursor is on. |
Ah, I think I understand now. We are describing two different paradigms here 🙂 The first is essentially a "point-free" paradigm, where we don't have a notion of the point/cursor position and it is entirely in relation to the current region as a whole. The second is a motion-oriented one where the point guides the boundaries of the region. To illustrate the difference, if we wanted to go from this selection:
to this one:
it would take 4 steps in the pointfree way, and 5 steps in the motion-oriented way (including the On the other hand, to go from:
to this:
With the barf/slurp (or "emit/capture" as they are called in symex) bindings, I assume this would do more than just go back and forward at the same level? That is, it would probably expand to larger and larger expressions when it hits a boundary at the present level? Then it would take 11 steps to reach the With My feeling is that the motion-oriented way is more general than the pointfree way, and it should be possible to implement the latter on top of it as a thin wrapper. That way, we could support both simple motions like Re: point 3, yeah I think you're right, and we should support entering expressions as long as we are able to avoid selecting things that are structurally invalid like
could yield
regardless of point location, while
(note point on the left end) could yield:
and
(point on the right end) could yield:
and that may avoid any weird cases of non-structural selection. |
Yep, it sounds like we're on the same page! I'll try to set aside some time this week to look closer at it 👍 |
Does this need to be tied to evil's visual mode? Could we just use region, simular to meow? |
@devcarbon-com You may be right that it would be better to use regions directly. The design discussed above does seem to introduce the idea of a "motion" in the Evil sense, but I'm not sure if it sufficiently fits into Evil's UI paradigm where it would be much easier to implement in evil vs doing it directly using regions. And of course, doing it with regions directly avoids increasing the dependency on evil. If we used regions directly though, we'd still need to ensure that it is "modal" in some way, so that e.g. pressing |
@chip2n, have you done any work on this? I'm considering giving this a go if I find time in the near future. |
I never got the time to do this unfortunately, so please go ahead! I think it would be a great addition to this package. |
I believe this is a leftover from when we used to use regions to "highlight" symexes. Nowadays we use an overlay for this, so there's no case I can think of (currently - in the future we may have selection of regions via drym-org#53) where the region would be active while in Symex mode.
I believe this is a leftover from when we used to use regions to "highlight" symexes. Nowadays we use an overlay for this, so there's no case I can think of (currently - in the future we may have selection of regions via drym-org#53) where the region would be active while in Symex mode.
One feature I'm missing since switching from lispy is the way you can operate on regions, in particular the way you can mark the current S-expression and then grow/shrink the region.
https://github.com/abo-abo/lispy#operating-on-regions
Is this in scope for the project?
The text was updated successfully, but these errors were encountered: