Skip to content

Add select variations of line-based extend commands #12210

Description

@llakala

I commonly prefer the select variations of extend commands, as they don't preserve where you started the selection, which is more intuitive for me. select_line_below and select_line_above are a godsend. However, many extend binds don't have select alternatives.

I specifically ran into this with extend_to_first_nonwhitespace and extend_to_line_end. I had these bound to H and L respectively, and I was hoping that a key sequence like HL would select all the way to the left, then select all the way to the right from the left, therefore selecting the entire line. However, because of how extend binds worked, this just selected the left half, then selected the right half.

I originally tried to get working behavior through something like this (done through home-manager):

    H = [ "collapse_selection" "select_mode" "goto_first_nonwhitespace" "normal_mode" ];
    L = [ "collapse_selection" "select_mode" "goto_line_end" "normal_mode" ];

This worked for a single line, but by necessity, if I had any other lines selected, it would deselect them. I don't believe there's a key combination that would replicate my ideal behavior here, where it wouldn't deselect previous lines, but it also wouldn't care about where you started the selection.

In my ideal solution, these binds would be added:

  • select_to_line_start
  • select_to_first_nonwhitespace
  • select_to_line_end
  • select_to_line_end_newline

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions