-
Notifications
You must be signed in to change notification settings - Fork 2
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
Alt + Backspace to delete complete words #1
Comments
@cmprmsd Thanks for testing it out and submitting all these great issues! It looks like go-prompt uses Emacs keybindings by default. So
|
Cool, this works! Just had to move opt into shell.New like this: cmd.AddCommand(shell.New(cmd, opt)) Sadly there is no prompt.AltBackspace. 👎 Strange. I'll ask what happend and why it got closed 🤷♂️ |
Just a quick heads up. It's possible to create ASCIICodeBinds. So I modified your suggestion to include also Alt+Backspace: func init() {
keyBinds := prompt.OptionAddKeyBind(
prompt.KeyBind{Key: prompt.ControlLeft, Fn: prompt.GoLeftWord},
prompt.KeyBind{Key: prompt.ControlRight, Fn: prompt.GoRightWord},
)
codeBinds := prompt.OptionAddASCIICodeBind(
prompt.ASCIICodeBind{ASCIICode: []byte{0x1b, 0x7f}, Fn: prompt.DeleteWord}, // Alt + Backspace
)
rootCmd.AddCommand(shell.New(rootCmd, keyBinds, codeBinds))
} |
Hey Brian,
Can't believe I'm the first person creating an issue here. This project is such a great idea! I missed this automation in other projects like ishell or promptui.
Bug / Feature Request
I just noticed that
alt + backspace
behaves strangely. It will insert question marks instead of deleting complete words as I would expect it in an interactive shell.As it messes with the cli-ui it might be a bug to address but also a nice feature implementation that I'd love to see!
Edit: Also
ctrl+right
andctrl+left
would be a great idea in order to skip through longer commands as I just noticed :DThanks in advance!
The text was updated successfully, but these errors were encountered: