Feature Request: Shortcuts to delete whole word/lines using <Ctrl>+[<Shift>]+<DEL> #6098

Closed
opened 2026-01-31 00:29:46 +00:00 by claunia · 6 comments
Owner

Originally created by @henry2man on GitHub (Jan 22, 2020).

Shorcuts to delete whole word/lines using <Ctrl>+[<Shift>]+<DEL>

In another CLI's (like Ubuntu one) we have very useful shortcuts to delete from the cursor to its right, deleting a word or the whole line. When I have this on the CLI:

$> ls myfolder

If I put the cursor just before "myfolder"

$> ls | myfolder

I can press <Ctrl>+<DEL> in order to delete the whole word:

$> ls | myfolder

Similary I can press <Ctrl>+<Shift>+<DEL> in order to delete all chars from the cursor to the end of the line.

Related to #755

Originally created by @henry2man on GitHub (Jan 22, 2020). # Shorcuts to delete whole word/lines using `<Ctrl>+[<Shift>]+<DEL>` In another CLI's (like Ubuntu one) we have very useful shortcuts to delete from the cursor to its right, deleting a word or the whole line. When I have this on the CLI: _$> ls myfolder_ If I put the cursor just before "myfolder" _$> ls **|** myfolder_ I can press `<Ctrl>+<DEL>` in order to delete the whole word: _$> ls **|** ~~myfolder~~_ Similary I can press `<Ctrl>+<Shift>+<DEL>` in order to delete all chars from the cursor to the end of the line. Related to #755
Author
Owner

@zadjii-msft commented on GitHub (Jan 22, 2020):

What shell application are you seeing this behavior in? In bash, even in gnome-terminal, Ctrl+DEL just echos 5~ at the position of the cursor for me. Have you made any modifications to inputrc or something?

@zadjii-msft commented on GitHub (Jan 22, 2020): What shell application are you seeing this behavior in? In `bash`, even in `gnome-terminal`, <kbd>Ctrl+DEL</kbd> just echos `5~` at the position of the cursor for me. Have you made any modifications to `inputrc` or something?
Author
Owner

@henry2man commented on GitHub (Jan 22, 2020):

Well, AFAIK I have not modified anything. I have some tweaks active for Kubernetes, but I don't think that this could be related.

I'm using Ubuntu Mate default terminal and also Terminator. Let me check again.

@henry2man commented on GitHub (Jan 22, 2020): Well, AFAIK I have not modified anything. I have some tweaks active for Kubernetes, but I don't think that this could be related. I'm using Ubuntu Mate default terminal and also Terminator. Let me check again.
Author
Owner

@henry2man commented on GitHub (Jan 23, 2020):

Just to confirm. The behaviour I've described in this issue is present in mate-terminal, a fork of Gnome terminal.

I've found this shortcuts very useful.

@henry2man commented on GitHub (Jan 23, 2020): Just to confirm. The behaviour I've described in this issue is present in [mate-terminal](https://github.com/mate-desktop/mate-terminal), a fork of Gnome terminal. I've found this shortcuts very useful.
Author
Owner

@zadjii-msft commented on GitHub (Jan 23, 2020):

@henry2man Could you share your /etc/inputrc file? Maybe the default inputrc on Mate is different than what I'm expecting.

Could you also share what you see if you run showkey -a in linux and press Ctrl+Del or Ctrl+shift+Del? For example, I see:
image

@zadjii-msft commented on GitHub (Jan 23, 2020): @henry2man Could you share your `/etc/inputrc` file? Maybe the default `inputrc` on Mate is different than what I'm expecting. Could you also share what you see if you run `showkey -a` in linux and press <kbd>Ctrl+Del</kbd> or <kbd>Ctrl+shift+Del</kbd>? For example, I see: ![image](https://user-images.githubusercontent.com/18356694/73001481-2911b000-3dc8-11ea-8daf-b8057b792b8a.png)
Author
Owner

@henry2man commented on GitHub (Jan 23, 2020):

Here they are:

/etc/inputrc

# /etc/inputrc - global inputrc for libreadline
# See readline(3readline) and `info rluserman' for more information.

# Be 8 bit clean.
set input-meta on
set output-meta on

# To allow the use of 8bit-characters like the german umlauts, uncomment
# the line below. However this makes the meta key not work as a meta key,
# which is annoying to those which don't need to type in 8-bit characters.

# set convert-meta off

# try to enable the application keypad when it is called.  Some systems
# need this to enable the arrow keys.
# set enable-keypad on

# see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys

# do not bell on tab-completion
# set bell-style none
# set bell-style visible

# some defaults / modifications for the emacs mode
$if mode=emacs

# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line

# allow the use of the Delete/Insert keys
"\e[3~": delete-char
"\e[2~": quoted-insert

# mappings for "page up" and "page down" to step to the beginning/end
# of the history
# "\e[5~": beginning-of-history
# "\e[6~": end-of-history

# alternate mappings for "page up" and "page down" to search the history
# "\e[5~": history-search-backward
# "\e[6~": history-search-forward

# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word

$if term=rxvt
"\e[7~": beginning-of-line
"\e[8~": end-of-line
"\eOc": forward-word
"\eOd": backward-word
$endif

# for non RH/Debian xterm, can't hurt for RH/Debian xterm
# "\eOH": beginning-of-line
# "\eOF": end-of-line

# for freebsd console
# "\e[H": beginning-of-line
# "\e[F": end-of-line

$endif

showkey -a:

Pulse cualquier tecla -- o Ctrl-D para salir de este programa

^[[3;5~ 	 27 0033 0x1b
 	 91 0133 0x5b
 	 51 0063 0x33
 	 59 0073 0x3b
 	 53 0065 0x35
 	126 0176 0x7e
^[[3;6~ 	 27 0033 0x1b
 	 91 0133 0x5b
 	 51 0063 0x33
 	 59 0073 0x3b
 	 54 0066 0x36
 	126 0176 0x7e
@henry2man commented on GitHub (Jan 23, 2020): Here they are: **/etc/inputrc** ``` # /etc/inputrc - global inputrc for libreadline # See readline(3readline) and `info rluserman' for more information. # Be 8 bit clean. set input-meta on set output-meta on # To allow the use of 8bit-characters like the german umlauts, uncomment # the line below. However this makes the meta key not work as a meta key, # which is annoying to those which don't need to type in 8-bit characters. # set convert-meta off # try to enable the application keypad when it is called. Some systems # need this to enable the arrow keys. # set enable-keypad on # see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys # do not bell on tab-completion # set bell-style none # set bell-style visible # some defaults / modifications for the emacs mode $if mode=emacs # allow the use of the Home/End keys "\e[1~": beginning-of-line "\e[4~": end-of-line # allow the use of the Delete/Insert keys "\e[3~": delete-char "\e[2~": quoted-insert # mappings for "page up" and "page down" to step to the beginning/end # of the history # "\e[5~": beginning-of-history # "\e[6~": end-of-history # alternate mappings for "page up" and "page down" to search the history # "\e[5~": history-search-backward # "\e[6~": history-search-forward # mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving "\e[1;5C": forward-word "\e[1;5D": backward-word "\e[5C": forward-word "\e[5D": backward-word "\e\e[C": forward-word "\e\e[D": backward-word $if term=rxvt "\e[7~": beginning-of-line "\e[8~": end-of-line "\eOc": forward-word "\eOd": backward-word $endif # for non RH/Debian xterm, can't hurt for RH/Debian xterm # "\eOH": beginning-of-line # "\eOF": end-of-line # for freebsd console # "\e[H": beginning-of-line # "\e[F": end-of-line $endif ``` `showkey -a:` ``` Pulse cualquier tecla -- o Ctrl-D para salir de este programa ^[[3;5~ 27 0033 0x1b 91 0133 0x5b 51 0063 0x33 59 0073 0x3b 53 0065 0x35 126 0176 0x7e ^[[3;6~ 27 0033 0x1b 91 0133 0x5b 51 0063 0x33 59 0073 0x3b 54 0066 0x36 126 0176 0x7e ```
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 23, 2020):

It looks like Windows Terminal, conhost and xterm (the terminal we're trying best to mimic for key encodings) are producing the same keys here. I can't find anywhere in any readline documentation that specifies that readline applications should, by default, support C-S-<Del> or C-<Del>, but it looks like bash supports C-<Del>.

I can't see this as anything other than a shell config issue. Sorry!

@DHowett-MSFT commented on GitHub (Jan 23, 2020): It looks like Windows Terminal, conhost and _xterm_ (the terminal we're trying best to mimic for key encodings) are producing the same keys here. I can't find anywhere in any readline documentation that specifies that readline applications should, by default, support `C-S-<Del>` or `C-<Del>`, but it looks like _bash_ supports `C-<Del>`. I can't see this as anything other than a shell config issue. Sorry!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6098