Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-15-2006, 05:24 AM
|
#1
|
Member
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641
Rep:
|
bash: How to make ^u kill entire line, not just to beginning
All,
On Slack 10.2/current with bash, pressing ^u on the command-line kills the content from cursor to the beginning of the line, instead of killing the entire contents of the input. I have the proper stty ^u statement, but it seems like it's bash's ReadLine that needs configuration in the ~/.inputrc to tell it to kill the entire line, rather than just from cursor to start.
Does anyone have a sample entry in .inputrc that does this? I've played around with various set commands and "Control-u":kill-entire-line settings, but so far found none that work..
Thanks in advance, and Happy Holidays!
-Y1
|
|
|
04-15-2006, 10:03 AM
|
#2
|
Member
Registered: Apr 2003
Location: uk
Distribution: slackware current
Posts: 769
Rep:
|
in your .inputrc, try
"\C-u": kill-whole-line
enter ctrl-x ctrl-r to get the file re-read first
this may depend on how some other environment variables are set, but see how you go
tobyl
|
|
|
04-15-2006, 11:49 AM
|
#3
|
Member
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641
Original Poster
Rep:
|
Thanks tobyl,
Unfortunately I've tried that and quite a few variants, and my ~/.inputrc (perm rwx) has tried both "\C-u": kill-whole-line and "Control-u":kill-whole-line, but none work. It keeps its "default" behaviour of killing from cursor to the beginning of the line, leaving the characters after the cursor.
Pressing ^E ^U works, as it first moves the cursor to the end, and then erases all infront, but that's not the behaviour I'm looking for here..
Additionally, it'd be nice to understand how this actually works, as I am only beginning to grasp how powerful the readline system is.
Could the emacs mode be part of the reason, rather than vi-mode?
Anyone else experiencing this ^u behaviour in bash?
-Y1
|
|
|
04-15-2006, 12:59 PM
|
#4
|
Member
Registered: Apr 2003
Location: uk
Distribution: slackware current
Posts: 769
Rep:
|
Quote:
Could the emacs mode be part of the reason, rather than vi-mode?
|
yes! I was playing around, and found that if you put the line I quoted in your .inputrc (i'm sure "Control-u":kill-whole-line is fine too)
then
set -o emacs
then ctrl-x ctrl-r as before, it works as you want
if I do
set | grep emacs
I get
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor=emacs
I think this is the important bit
if you use the set command it seems necessary to re-read the .inputrc
Quote:
Anyone else experiencing this ^u behaviour in bash?
|
probably, because it is the default behaviour.
kill-whole-line is not bound by default to any key combination
(I only know this because your post got me curious)
tobyl
|
|
|
04-15-2006, 11:45 PM
|
#5
|
Senior Member
Registered: Aug 2005
Posts: 1,755
Rep:
|
Also, I know that Ctrl-K kills everything from the cursor to the end of the line, so together with Ctrl-U, that kills the whole line, right? Perhaps there are other control sequences that do this better?
|
|
|
04-17-2006, 01:19 PM
|
#6
|
Member
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641
Original Poster
Rep:
|
Tried the emacs options, and still can't get it to work. I know I can use ^E ^U or ^U ^K, but now I'm curious as to these bindings and would really like to understand how to harness the power of readline..
I'm set for emacs mode, and still ^U only kills from cursor to line-begin.
Any other useful information on my settings I should contribute?
Thanks again to all who helped so far!
-Y1
|
|
|
All times are GMT -5. The time now is 01:29 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|