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

Leave prompt with <Escape> #582

Open
0ax1 opened this issue Mar 28, 2017 · 1 comment

Comments

@0ax1
Copy link
Contributor

commented Mar 28, 2017

After entering the prompt with : or searching with /, is there a way to abort the command?
I expected being able to escape the prompt by pressing <Escape>.

@commonquail

This comment has been minimized.

Copy link

commented Jul 8, 2017

I wonder if this is possible with readline. If you open the file finder (f), which doesn't use readline, you can see that Escape already bails. If you compile without readline support the other prompts will, too. You'd need to configure readline's keybindings, defined in ~/.inputrc or /etc/inputrc. For instance, if you add ESC: "foo", hitting Escape in one of the readline prompts will insert the text foo. Unfortunately you can't bind one key to multiple commands and there is no built-in "discard all text and submit" command. I managed to hack one together with ESC: "\C-U\C-K\C-M" " (Emacs bindings for: unix-line-discard, kill-line, accept-line), because you can bind to multiple key bindings; that actually worked but revealed another flaw: arrow keys also send ESC, so mapping only ESC to anything effectively breaks arrow keys in prompts. And even if that had worked, that configuration would probably be shared with any other tool using readline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.