-
Notifications
You must be signed in to change notification settings - Fork 720
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
Change slightly how x
/X
works
#2590
Comments
BTW. If the above idea/paradigm of actions having a tiny bit (actually precisely one bit!) of memory is accepted, then it would make sense to improve This way all the Hmm... crazy idea... maybe if we follow the logical model of "full-line quasi-mode" that one enters after x-and-alikes, then even some existing keys/movements could do something similar to what they do right now, but in a line-oriented way. Eg. |
I'm trying to implement it here: https://github.com/dpc/kakoune/tree/line_editing |
Cross-linking threads: #2206 |
I think I've succeeded. https://github.com/dpc/kakoune/tree/line_editing This does not add any visual feedback, or implement any of the "extension" ideas. If I mange, I will try to implement it. |
I probably do a terrible job at it, but I'm trying out the more extreme ideas here: https://github.com/dpc/kakoune/tree/line_editing_bells_and_whistles . Please read commit logs for instructions. |
I tried I definitely recommend others who are reading this thread to try it for yourself. |
My "bells and whistles" is almost ready. I wish I could get the selection to change color after one enters "line selection mode" for both the "conservatie" and "bells and whistles" branch. Then it would all be obvious, and quite pretty IMO. |
I'm thinking about re-implementing your |
@maximbaz Better than nothing. :) . I still hope that after trying it out, more people will be convinced. |
I've tried it out for a few hours, but honestly I don't start linewise-
selecting on empty lines very often, and I've been using Vanilla
Kakoune for long enough that I've already internalised the workarounds.
Heck, I still do linewise selections with `xXXX` occasionally even
though that hasn't been necessary for months.
I'll keep using it for a while and see if I grow more attached to it.
|
Maybe because I wasn't using kakoune for very long yet, but with vanilla kakoune even though I understand the logic in how |
I would be guessing that long time users have internalized the current rules, and they just avoid pressing After a day with this change, the biggest problem with my Kakoune experience is totally gone, and line-wise I am always precise. I still feel that Note: I'm using my Now the last problem with getting used to kakoune is anchor vs cursor ordering. And I think I just need to modify the colorscheme to make the cursor more distinct vs the selection. That's also one part that I don't understand how to handle in |
I picked up using |
Looks like a glass half-empty/half-full issue, you'll prefer x or a-x depending on which you already use the most. The easiest thing to do is revert the two mappings in your user configuration, that works for everybody. |
@lenormf I thought like this at the beginning, but it doesn't solve anything. With my change you can predictably do You can think of my change as introducing a difference between "selecting all characters in a line" and "selecting a whole line". The first time you hit |
I'm thinking, right now when you select lines it looks like this
Where What if it looked like this:
This way when you first hit This way |
@Screwtapello Thank you! |
I've implemented it and pushed in |
Couple of things to polish:
Just to repeat : "line editing quasi-mode" is an extension to the core idea of changing how |
@dpc found a serious downside of this approach, with your branch it is impossible to make the following binding work (to make X always extend down), because
Pressing |
@maximbaz : |
@maximbaz I don't understand why would you need this mapping now, as But I've mentioned before that I think I |
I made a recording of how it looks: https://asciinema.org/a/213645 |
I'll reply in full later, but to explain you the need for this macro, try selecting with KKKK and then pressing X - I want this to continue expanding selection. |
@maximbaz If you did
So: I agree with your desired behavior, and this can be easily fixed. |
@maximbaz Like this? https://asciinema.org/a/213654 . I've pushed it in |
Maybe I'm from a different world, but I hack and slash my code left and right, with a speed of a machine gun, selecting, deleting, yanking, pasting stuff all the time, jumping between buffers left and right. There's always undo, or even
It doesn't matter there's a consistent explanation for it. What matters is if that's what the user naturally expects. Otherwise one could have any arbitrary rule like "selects full line if it's Saturday". Consistent? Consistent! Easy to understand? Yes! Can users keep track if it's Saturday? Of course they can: it's even easier, because days don't change every time you change the line! Does it give a great UX? Not really. |
Just had an another out of the box idea. Maybe there should be a Whaaaaa? you ask? Here's how it works. Column -1 is magical place where the cursor lands when the To visualize. Legend first:
Staring position:
After moving with
After first
after second
Benefits: expected behavior. the additional "state" (empty vs full line selected) is now visible and part of positioning system. The column does not have be really "wasted". If cursor shapes are available cursor on line -1 could be visualized as Variations of this idea exist. Column -1 could be used eg. to place the cursor, only if the cursor lands on an empty line, but haven't selected the |
My point is mostly that I dont see how the proposed change is a clear improvement on the current behaviour. In both cases we need to track an additional state ("is the line already fully selected" or "was the last command hitten in this client (Just saw that you posted a new proposal, I'll go through it when I get time, gotta go now). |
This state could be tracked per-client/script. I also thought about keeping that state only for interactive input from the terminal. This is especially the route I will take if there will be no consensus on making |
@mawww So, as we've talked on IRC - I just went ahead and implemented it in a text editor I hacked together in Rust: https://github.com/dpc/breeze . Obviously toons of stuff is missing there and there are probably many bugs in whatever is implemented, but I did implement |
Any progress here? Think alexherbo2/auto-pairs.kak#9 is waiting on this, would love to see resolution but I know this was somewhat contentious. Edit: Never mind, I was wrong about the dependency. Ignore this. |
Late to chime in, but I also wanted to say I love @dpc's suggestion. Regarding the discussion about "stateful vs stateless" behaviour - think of it this way - either it's implemented in a stateful way which may be less elegant etc, or the user has maintain state in their head ("I'm on an empty line, hold on, I shouldn't be pressing x, I need to press a-x to select it"). The more stateless the end-result is from user's perspective, the easier it is to train the muscle memory (e.g., "xd to delete a line, wherever you are located and whether it's empty or not"), and computers are arguably better at maintaining state than users' heads. |
I find it quite hard to do something like |
Possibly foolish question: why does the current behavior of
As a new user to Kakoune, I found the distinction between I'm going to be trying out the following mappings for my personal use:
|
@greneholt I have actually been thinking about the same thing recently, that we ought to be able to get rid of Still trying, I think Kakoune has too many normal mode commands at the moment so I'd be really happy to remove some redundant ones. |
As an observer with limited understanding (which has grown reading this). I did I did I wonder if it is (somewhat) safe to remap BTW I realize that I have a broken mental model and it doesn't match up with Kakoune. I don't think Kakoune should come pre-bent to my mental model, but at the moment I don't understand how to safely bend it. |
A new experimental branch has been started on the topic: 850c88c |
I think this can be closed now :) |
I'm waiting for NixOS to bring the latest version, but after reading the latest release notes, I think this one is indeed done. |
Correct me if I'm wrong but after using new vanilla version for a while it seems that no new state was actually introduced, so there's no way to differentiate between unselected empty line and selected empty line. That's why I guess back to my fork it is for me. |
technically there is, the state is the "target column" but it's not exposed explicitly given
where the selection is on
|
Right now: https://github.com/mawww/kakoune/wiki/Migrating-from-Vim states, that to "copy a line", one has to do
xy
.That's however is technically not true. Because if you're on an empty line, you are going to copy the next line. My point is not that Wiki is wrong, but that to reliably select a current line, one has to use
<a-x>
, so that reliable "delete current line" is<a-x>d
which is way less convenient, especially comparing to very handydd
in Vim.While I really appreciate the "visual feedback" of Kakoune, and I think it's amazing when doing anything non-trivial, having to rely on the visual output, while doing trivial and mechanical operations like deleting lines is terrible. The fact that I have to pay attention to exact content of everything just so I don't delete a different line is just slowing me down.
Edit: Also, not that
x
is practically unusable for scripting. If your script needs to select a line somewhere, it has to go with<a-x>
as the only reliable one.I am aware that
x
/X
needs to extend down and I also believe it's undesirable to loose that property.So I was wondering if instead of the rule "x/X goes to the next line if the cursor is on LF and already selects the whole line" the new one: "x/X goes to the next line if it previous action was also x/X`" wouldn't be better?
This way first
x
reliably selects the current line, and following ones move downwards. Everything becomes trivially predictable. The behavior of the movement would be conditional only on the keystrokes of the user.This change should be quite easy to get used to for the existing users. In case they press
x
/X
while having a whole line selected somehow without using anyx
command (typically because of being on an empty line), they will just have to pressx
/X
again. It would be awesome if some form of visual change was there, but it's not terrible if it isn't. Maybe there could be a special color or some other visual designation for the "full-line quasi-mode" that one enters after firstx
and leaves after first non-line command, which would make the whole thing obvious.Note: Any line-related command (
xX<a-x><a-X>
) should work for any line-related command for the purpose of "consecutiveness".The text was updated successfully, but these errors were encountered: