Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 481754

Summary: app-shells/bash-4.2_p45 - binding kill-whole-line to ^U fails
Product: Gentoo Linux Reporter: Johnny Wezel <j>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED INVALID    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info

Description Johnny Wezel 2013-08-20 13:56:12 UTC
Created attachment 356490 [details]
emerge --info

I cannot bind kill-whole-line to ^U. See what happens:

j@starfish ~ $ bind -p | grep kill
"\C-x\C-?": backward-kill-line
"\e\C-h": backward-kill-word
"\e\C-?": backward-kill-word
# copy-region-as-kill (not bound)
"\C-k": kill-line
# kill-region (not bound)
# kill-whole-line (not bound)
"\ed": kill-word
# shell-backward-kill-word (not bound)
# shell-kill-word (not bound)
j@starfish ~ $ bind '"\C-u": kill-whole-line'
j@starfish ~ $ asdlkj asd # whole line should be killed^C
j@starfish ~ $ bind -p | grep kill
"\C-x\C-?": backward-kill-line
"\e\C-h": backward-kill-word
"\e\C-?": backward-kill-word
# copy-region-as-kill (not bound)
"\C-k": kill-line
# kill-region (not bound)
# kill-whole-line (not bound)
"\ed": kill-word
# shell-backward-kill-word (not bound)
# shell-kill-word (not bound)
j@starfish ~ $ bind '"\M-u": kill-whole-line'
j@starfish ~ $ bind -p | grep -- -u
"\e~": complete-username
"\C-x~": possible-username-completions
"\C-x\C-u": undo
"\C-u": unix-line-discard
j@starfish ~ $ bind '"\C-]": kill-whole-line'
j@starfish ~ $ <====================== Whole line killed with ^]. OK
j@starfish ~ $ bind -r '"C-u"' <===== Removing ^U binding
j@starfish ~ $ bind -p | grep C-u
"\C-x\C-u": undo
"\C-u": unix-line-discard <===== ^U binding still here

Conclusion:
-----------

- Unbinding does not work
- Binding a key that already exists cannot be reassigned
Comment 1 SpanKY gentoo-dev 2013-08-27 05:27:09 UTC
i'm almost certain this is due to your tty settings and not bash/readline

$ man stty
       kill CHAR
              CHAR will erase the current line

$ stty -a | grep -o 'kill[^;]*'
kill = ^U

so you first need to change your tty settings with `stty`, and then use bash's `bind` to set it to something else