Skip to content
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

Select by default with Goto #5127

Open
schecko opened this issue Dec 12, 2022 · 8 comments
Open

Select by default with Goto #5127

schecko opened this issue Dec 12, 2022 · 8 comments
Labels
A-keymap Area: Keymap and keybindings C-enhancement Category: Improvements

Comments

@schecko
Copy link

schecko commented Dec 12, 2022

By default, basic movements such as "w" or "b" will highlight in the wake of the movement, rather than requiring something like "vw" to select before performing an action. Should more movements have this feature? In particular, the "g" commands could benefit from this. For example, to change to the end of the line would be "vglc", the same functionality in vim would be "ce". With this change, "vglc" becomes just "glc".

@schecko schecko added the C-enhancement Category: Improvements label Dec 12, 2022
@archseer
Copy link
Member

This is not a new proposal: #1630

The question is, there's gl/ge etc that are movements, but then gd/gi etc are jumps. Do we diverge and have some movements select, and others jump?

@schecko
Copy link
Author

schecko commented Dec 12, 2022

Unless the jump is to another file, i think its fine to just make everything select by default? I can see it having its place for something like gt or gc etc.

@the-mikedavis the-mikedavis added the A-keymap Area: Keymap and keybindings label Dec 12, 2022
@CptPotato
Copy link
Contributor

CptPotato commented Dec 13, 2022

This might be a bit controversial, but I actually prefer the goto bindings to not select. In my mental model I consider all of the current goto movements "jumps" rather than "relative movements" (compared to w for example).
If jumps select, in the best case this happens to select what I wanted so I save a v press. In the worst case it selects something I didn't want, so I have to cancel the automatic selection and reselect what I actually wanted. For example deleting line 123 would turn into 123gg;Xd.

I guess it's probably down to personal preference and how you use the editor (i.e. if the default ends up being what you want in most cases). I usually don't want to select from the starting position when using any of the goto commands. A common one I use is gli to insert before the tailing ;/,/. on a line. Or knowing that there's an error on line 200, 200ggi will go there in insert mode.

However, in case selection is implemented for goto commands, I could probably get around this by remapping the key binds to explicitly deselecting afterwards.

@pascalkuthe
Copy link
Member

I think having separate versions of the goto commands that select might be reasonable/uncontroversial addition so users could change their keymap as they desire.

I used to want this feature for gl and gh but actually found that I prefer t<ret> and T<ret> for selecting to line end/start. It doesn't require me to remember an extra keybindings altough it's slightly harder to reach. Other goto commands are probably used rarely enough that it's not a big deal to use v to select if that is what you want.

@schecko
Copy link
Author

schecko commented Dec 16, 2022

Yeah I ended up finding t<ret> and T<ret> through matrix chat. maybe its enough to add them to tutor so they are known to new users?

@sicher
Copy link

sicher commented Aug 23, 2023

I don't know if this is a bug, but I get the same result with T<ret> as with F<ret>. In both cases, the selection includes the previous return character:
image

@pascalkuthe
Copy link
Member

pascalkuthe commented Aug 23, 2023

that seems like a bug, most likely I would guess that you are using windows/a file with crfl line ending and T<ret> doesn't handle that correctly. That's an orthogonal issue though and should be reported seperatly

@sicher
Copy link

sicher commented Aug 23, 2023

Yes, I only see that on windows. I'll report that as a separate issue when I'm back on my work machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-keymap Area: Keymap and keybindings C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

6 participants