Skip to content

Instantly share code, notes, and snippets.

@benzwick
Last active September 13, 2019 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benzwick/7291ac7128c61956741921fe6b714851 to your computer and use it in GitHub Desktop.
Save benzwick/7291ac7128c61956741921fe6b714851 to your computer and use it in GitHub Desktop.
Ctrl-backspace, Ctrl-delete and Ctrl- up, down, left, right in Bash
# ~/.inputrc
#
# Ctrl backspace, delete and arrow keys in terminal
#
# This should work on Debian 10 and Centos 7
#
# If you want this to work inside tmux as well
# edit your ~/.tmux.conf and add the line:
#
# set-window-option -g xterm-keys on
#
# References:
#
# - [[https://hellricer.github.io/2019/05/21/ctrl-arrows-in-terminal.html][Ctrl+Arrows in terminal]]
# - [[https://unix.stackexchange.com/a/264871][Ctrl-Backspace and Ctrl-Delete in bash]]
# - [[https://superuser.com/a/395273][How can I make ctrl+left/right keys to move by whole word in tmux?]]
# C-backspace
"\C-h": backward-kill-word
# C-delete
"\e[3;5~": kill-word
# urxvt
# "\e[3^": kill-word
# C-S-delete
"\e[3;6~": kill-line
# URxvt note: you have to disable Ctrl+Shift popup in ~/.Xresources:
# URxvt.iso14755: true
# URxvt.iso14755_52: false
# "\e[3@": kill-line
# Move with C- up, down, right, left
# "\e[1;5A": beginning-of-line
# "\e[1;5B": end-of-line
"\e[1;5C": forward-word
"\e[1;5D": backward-word
# urxvt
# "\eOc": forward-word
# "\eOd": backward-word
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment