-
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
Implement motions and operators #92
Comments
I agree to this. We should spec out what will be needed, such as movements, countables, text objects. If we have a complete specification then it will be easier to design and implement, and no refactoring needed in the future. |
Just some thoughts while they bubble up. This is pretty stream-of-consciousness, so sorry if it's too rambling. On parallels to vimText object selection (
|
Just a heads up: I edited the above comment a couple of times, so read on Github rather than in the email. |
Thank you for this thorough discussion of movement verbs. The way I see it, the three most useful tags when it comes to movement are I'm curious about how the data model for keyboard input would look. Right now, there is no concept of countables nor movement, only direct binding to a specific command. I propose that we take a look of how we could represent a text input sequence in memory before deciding. Lastly, I fully support your planned pull request. It adds some of this functionality without losing sight of the big picture. |
Absolutely. When I used the word "artist" I was taking a more high-level perspective. Yes, the implementation should certainly use I'm using that --
This is tricky. So if we start with just one example, I think vim only has What I'm getting at here is that the command So I think I've made up my mind that the two separate schemes are the way to go. The Seem OK to you?
No idea! I think the first step could be to get modal bindings implemented. For example, we'd need
Great. I'll do this at some point soon. |
|
Starting to doubt these names now. Help! I think The only things I can think of which are more accurate are kind of long, like
|
Suggest |
I tried to work a bit on the data model yesterday, here's what I have at the moment. It's not ready for a pull request yet. Just trying to dump what's in my head for further discussion. The thought here is that every time the user presses a key, the statement is updated accordingly. If there is an invalid sequence (e.g., Using this approach it's possible to remove many of the explicit bindings. I guess that in order to support this way of interpreting the input, we would either have to hard-code the motion keys, or provide contextual bindings. So, for instance:
I think the actual
|
OK. |
It'd help my understanding a lot if you gave a couple of examples which used the various pieces of the Quick nitpick on nomenclature: "operators" need a visual selection or movement or text object, "commands" run immediately. ( I'm also going to suggest "motion" rather than "movement" -- they appear to mean the same in the vim documentation but "motion" seems to be preferred. I'm going to edit the title of this issue. "motions" are commands, but can also be used on a pending operator. ( MotionsMotion bindings take effect in normal or visual modes or when an operator is pending. They can be preceded by a count. If used in normal or visual modes, the cursor is moved according to the motion. If used when an operator is pending, the range to be operated on is the range starting with the cursor's position before the movement and the cursor's position after the movement. After operation, the cursor ends up at the top of the range. Something which comes to mind is that motions in PMS would all be "inclusive". ( I wonder if these should be bound a few times (
ObjectsObjects can be entered in visual mode to move the selection to the object, or when an operator is pending. Objects start (by convention I guess?) with a and i. Setting them up is similar to vim's
OperatorsOperators expect a visual selection (and then operate immediately), or to be followed by a motion or an object.
Some things I haven't through through too much yet:
|
It'd be great to have a further-implemented "delete" verb (this is the main one I can think of; add would be useful too), and movements for it to act over.
For example dG should delete to the end of the current list, dgg should delete to the beginning of the current list, d] should delete to the next album (assuming ] is set up as such).
Perhaps getting ahead of myself here but an equivalent of vim's text objects would be great too, like daa (or dia) might delete everything surrounding the cursor with the same album, daA (or diA) might work the same way but for an artist, and so on.
The text was updated successfully, but these errors were encountered: