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

Add Ctrl+Backspace keybind to delete word #979

Closed
wants to merge 1 commit into from

Conversation

pol-rivero
Copy link
Contributor

Most users expect Ctrl+Backspace to delete the entire word placed to the left of the cursor. This PR adds a customizable keybind (defaults to Ctrl+Backspace) that does that.

@mattrose
Copy link
Member

I'm wondering if this is not handled better by readline or the shell, not the terminal emulator. Do you know if other terminal emulators do this?

@pol-rivero
Copy link
Contributor Author

I've tested alacritty, kitty, gnome-terminal and konsole and ctrl+backspace doesn't seem to work on any of them.
It does work in vscode, thanks to these default binds. They seem to be sending \u0017 for ctrl+backspace and \u001bd for ctrl+delete.

I will investigate if using \u0017 is better than the "alt+backspace" I'm currently sending. Also, I completely forgot about ctrl+delete, so I'll add that too.

@mattrose
Copy link
Member

I confirmed that this is handled by the readline library. I really don't want to add functionality that is duplicated by another layer of the shell. You should probably edit the readline configuration to get the behaviour you want in your shell. I think all you're doing here is mapping ctrl+backspace to Meta-Delete and having that handled by readline.

Do you mind if I close this PR?

@pol-rivero
Copy link
Contributor Author

Ah I see, yes I'll close the PR.
Thank you for your time.

@pol-rivero pol-rivero closed this Jan 12, 2025
@mattrose
Copy link
Member

Thanks for understanding. I hate turning away PRs, especially ones from people who have contributed successfully in the past, but I really want to keep the code as simple as I can.

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.

2 participants