-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Keybind for Extend/shrink selection up and down #9080
Conversation
…s also fixes a problem when starting at an empty line.
The implementation should work better now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've played around with this for a bit, and it feels quite intuitive to me! I think the selection flipping is consistent, and makes sense. I'm going to keep these commands instead of my old binds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this appears fine as is, there are a lot of pull requests though so it will be a while before 2 people with write access approve it.
I don't mind as I can just use my personal branch for now. |
Wouldn't say that the lint improves readability of the code but it's fine either way I guess. Sorry for not checking beforehand |
Nice that this made it in. In case people are looking for ways to bind this, the following is a clean way to integrate this in the default keymapping. [keys.normal]
J = ["select_line_below"]
K = ["select_line_above"]
"A-j" = "join_selections"
"A-J" = "join_selections_space"
X = "remove_primary_selection"
x = "keep_selections"
"A-x" = "remove_selections"
[keys.select]
J = ["select_line_below"]
K = ["select_line_above"]
"A-j" = "join_selections"
"A-J" = "join_selections_space"
X = "remove_primary_selection"
x = "keep_selections"
"A-x" = "remove_selections" The bonus is that As an addendum, I find it useful to map H/L to select everything to the left/right:
The rationale for choosing H/J/K/L is that they represent directions, while holding shift is often associated with extending a selection (in mainstream text editing UI). |
* implement another selection modifying command * Selection feels more ergonomic in case of swapping the direction. This also fixes a problem when starting at an empty line. * rename select_line_up/down to select_line_above/below * apply clippy suggestion of using cmp instead of if-chain * revert `Extent` implementing `Clone/Copy` * move select_line functions below extend_line implementations * implement help add function, which saturates at the number of text lines --------- Co-authored-by: Emi <emanuel.boehm@gmail.com>
* implement another selection modifying command * Selection feels more ergonomic in case of swapping the direction. This also fixes a problem when starting at an empty line. * rename select_line_up/down to select_line_above/below * apply clippy suggestion of using cmp instead of if-chain * revert `Extent` implementing `Clone/Copy` * move select_line functions below extend_line implementations * implement help add function, which saturates at the number of text lines --------- Co-authored-by: Emi <emanuel.boehm@gmail.com>
* implement another selection modifying command * Selection feels more ergonomic in case of swapping the direction. This also fixes a problem when starting at an empty line. * rename select_line_up/down to select_line_above/below * apply clippy suggestion of using cmp instead of if-chain * revert `Extent` implementing `Clone/Copy` * move select_line functions below extend_line implementations * implement help add function, which saturates at the number of text lines --------- Co-authored-by: Emi <emanuel.boehm@gmail.com>
* implement another selection modifying command * Selection feels more ergonomic in case of swapping the direction. This also fixes a problem when starting at an empty line. * rename select_line_up/down to select_line_above/below * apply clippy suggestion of using cmp instead of if-chain * revert `Extent` implementing `Clone/Copy` * move select_line functions below extend_line implementations * implement help add function, which saturates at the number of text lines --------- Co-authored-by: Emi <emanuel.boehm@gmail.com>
* implement another selection modifying command * Selection feels more ergonomic in case of swapping the direction. This also fixes a problem when starting at an empty line. * rename select_line_up/down to select_line_above/below * apply clippy suggestion of using cmp instead of if-chain * revert `Extent` implementing `Clone/Copy` * move select_line functions below extend_line implementations * implement help add function, which saturates at the number of text lines --------- Co-authored-by: Emi <emanuel.boehm@gmail.com>
* implement another selection modifying command * Selection feels more ergonomic in case of swapping the direction. This also fixes a problem when starting at an empty line. * rename select_line_up/down to select_line_above/below * apply clippy suggestion of using cmp instead of if-chain * revert `Extent` implementing `Clone/Copy` * move select_line functions below extend_line implementations * implement help add function, which saturates at the number of text lines --------- Co-authored-by: Emi <emanuel.boehm@gmail.com>
* implement another selection modifying command * Selection feels more ergonomic in case of swapping the direction. This also fixes a problem when starting at an empty line. * rename select_line_up/down to select_line_above/below * apply clippy suggestion of using cmp instead of if-chain * revert `Extent` implementing `Clone/Copy` * move select_line functions below extend_line implementations * implement help add function, which saturates at the number of text lines --------- Co-authored-by: Emi <emanuel.boehm@gmail.com>
* implement another selection modifying command * Selection feels more ergonomic in case of swapping the direction. This also fixes a problem when starting at an empty line. * rename select_line_up/down to select_line_above/below * apply clippy suggestion of using cmp instead of if-chain * revert `Extent` implementing `Clone/Copy` * move select_line functions below extend_line implementations * implement help add function, which saturates at the number of text lines --------- Co-authored-by: Emi <emanuel.boehm@gmail.com>
Implements #9079