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

Ctrl-Left/Right Arrow doesn't work with vi key bindings #6755

Closed
YaLTeR opened this issue Mar 15, 2020 · 5 comments
Closed

Ctrl-Left/Right Arrow doesn't work with vi key bindings #6755

YaLTeR opened this issue Mar 15, 2020 · 5 comments

Comments

@YaLTeR
Copy link

YaLTeR commented Mar 15, 2020

fish version 3.0.2
Fedora 31 and Arch Linux, Tilix and Alacritty

Ctrl-Left/Right Arrow do something weird instead of working when the vi key bindings are active. Alt+Left/Right Arrow works fine.

  1. sh -c 'env HOME=$(mktemp -d) fish'
  2. fish_vi_key_bindings
  3. Type something and try using Ctrl-Left/Right Arrow
@faho
Copy link
Member

faho commented Mar 15, 2020

Please execute fish_key_reader, press ctrl-left. That'll give you something like

bind \e\[1\;5C 'do something'

Take that, chop off the "do something" bit, so that you just execute

bind \e\[1\;5C

On my system that just says it's bound to "forward-word" in the default bindings and nothing in the vi ones, which seems correct.

@faho faho added the question label Mar 15, 2020
@YaLTeR
Copy link
Author

YaLTeR commented Mar 15, 2020

That's the same as I get. So I guess it tries executing the sequence literally which leads to the "weird behavior" (exiting to normal mode and sometimes inserting additional text from previous command).

@faho
Copy link
Member

faho commented Mar 15, 2020

Well, that's to be expected. Ctrl-arrow sends

\e\[1\;5C

which is escape, then [1;5C. So it does the thing for escape, which is exit to normal mode, then the thing for [, which is searching history, then the thing for ;, which is repeating a jump, then the thing for 5, which is nothing, then the thing for C, which is killing a line and repainting.

I don't think there is a good way around this, because we can't conclusively enumerate all possible escape sequences, and I don't think there is a set enough pattern for these.

@YaLTeR
Copy link
Author

YaLTeR commented Mar 15, 2020

Maybe ctrl+arrows should be bound for the vi insert mode by default? In the actual vim insert mode ctrl+arrows also jumps words.

@faho
Copy link
Member

faho commented Mar 15, 2020

Huh, so it does.

Yeah, lemme fix that.

@faho faho closed this as completed in 463b9b9 Mar 15, 2020
@faho faho added enhancement and removed question labels Mar 15, 2020
@faho faho added this to the fish 3.2.0 milestone Mar 15, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants