trogdoro / xiki

A shell console with GUI features
http://xiki.org
Other
3.76k stars 208 forks source link

Bind shortcuts don't work when bash is set to vi mode #137

Closed choffee closed 9 years ago

choffee commented 9 years ago

Hi

In the .xsh file it sets Ctrl-R to xsh-r using
bind \"$xiki_reverse_key'" "\C-axsh -r \n"' This assumes that \C-a moves to the start of the line. If you use bash in vi mode, using set -o vi, then it fails.

I did trying setting it with an alternate shortcut bind \"$xiki_reverse_key'" "\e[H xsh -r \n"' But that only sort of works, you have to press crtl-R twice quickly.

There could be a separate set of shortcuts if bash is in vi mode. bind \"$xiki_reverse_key'" "\e^ixsh -r \n"' That seems to work okay. It does feel a little hacky though. Maybe the \C-a bit could be replace with a function in some way?

trogdoro commented 9 years ago

I did a push just now that should fix it. I just defined C-a to be beginning-of-line in bash vi insert mode. (And added the zsh equivalent.)

:xiki/bin/.xsh : bind -m vi-insert "\C-a":beginning-of-line

Do you think bash vi key users wil object to having C-a go to the beginning of the line in insert mode? If so, I could map beginning-of-line to a more obscure char, like M-C-b or something, and then use that instead of C-a.

choffee commented 9 years ago

Cool. That works great.

C-A in vim is assigned to increase the number under the cursor but that is not supported in bash so that should be fine.

CaptainQuirk commented 9 years ago

What about tmux users who remap C-b to C-a as leader ?