- 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?
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?