Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Remove last argument on command line

Feb
240
3
I find myself often repeating the following sequence:
1] I hit up-arrow on the command line to go to a previous command
2] I erase the last argument of that command (usually a filename)
3] I fill in a new filename for the argument (usually by typing a mask and using autocomplete) and hit enter.
The item that I'd like to figure out how to do more efficiently is step #2. How can I remove that last argument with a single keypress?
Right now, after recalling that previous command, I can backspace over the last argument, or I can use shift-left-arrow to select it and then delete it. The problem is that a single shift-left-arrow generally doesn't do the job, because shift-left-arrow doesn't select a whole argument; rather, it stops at underscores, dashes, and periods, and I often find that I have to press shift-left-arrow 4 or 5 times until I select the whole filename.
Hence, I'm wondering: is there a way to erase the entire argument with a single keystroke?
 
My fingers have learned Control-L to erase the word to the left of the cursor. Yes, it may be necessary to press it several times, but that never bothered me.
 
My fingers have learned Control-L to erase the word to the left of the cursor. Yes, it may be necessary to press it several times, but that never bothered me.
I figured there had to be an erase_word_left, but that one works oddly with quoted strings. For example, if you start with

a "b c"

the first Ctrl-L erases c
, the second erases b[space], and you need another to erase the remaining quote.

I would have thought ... only one (to erase the entire quoted word) or two (erase c
, then
b[space]. The same holds for the single quote and the back-tick.
 
My fingers have learned Control-L to erase the word to the left of the cursor. Yes, it may be necessary to press it several times, but that never bothered me.
Well that got all fouled up by my putting "quote" in brackets! I'll try again. If I start with

a "b c"

the first Ctrl-L erases c-quote, the second erases b-space, and the third erases the remaining quote.

Two would be better (erase c-quote, then quote-b-space). Better yet, only one (erase the entire quoted arg).
 
Back
Top
[FOX] Ultimate Translator
Translate