Skip to content

Fix fish >= 4.8 shared bindings; add x/X linewise selections - #18

Open
nomoruni wants to merge 1 commit into
sshilovsky:mainfrom
nomoruni:fish48-compat-and-linewise
Open

Fix fish >= 4.8 shared bindings; add x/X linewise selections#18
nomoruni wants to merge 1 commit into
sshilovsky:mainfrom
nomoruni:fish48-compat-and-linewise

Conversation

@nomoruni

Copy link
Copy Markdown

Summary

Two independent fixes, split into separate commits:

1. Fix bindings source dumped at startup on fish >= 4.8

Fish 4.8 changed __fish_shared_key_bindings to print its code instead of
executing it (so that bind attributes the bindings to the caller). The plugin
called it directly, so on every startup the whole binding list was printed to
the terminal instead of applied.

Fixed the same way fish's own fish_vi_key_bindings does it:

function __fish_helix_shared
    eval "$(__fish_shared_key_bindings)"
end
for mode in insert default visual
    __fish_helix_shared -s -M $mode
end
functions -e __fish_helix_shared

Fixes #16

2. Implement x / X linewise selections

  • x selects the current line, each repeat/count grows one line further down
  • X extends one line up per repeat/count, no-op at the first line
  • counts work (3x, 2X), works in Normal and Visual mode
  • reads selection bounds via commandline -B/-E so repeated presses keep
    extending instead of recomputing from the cursor

Adds select_line / extend_line_up to fish_helix_command.fish and binds
them in fish_helix_key_bindings.fish (removes the corresponding FIXMEs).

Fixes #17

Testing

Tested interactively on fish 4.8.1 / Arch Linux:

  • startup is clean, shared bindings (arrows, ctrl-y, alt-e, ...) work again
  • multi-line buffers: x/X grow/clamp correctly per press, counts (2X, 3x)
  • d, y, c behave on the resulting selections; Visual mode verified

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add x / X (select line / extend line above) [fish >= 4.8] Shared bindings' source is dumped to the terminal at startup

1 participant