logoalt Hacker News

fellertstoday at 8:44 AM4 repliesview on HN

CTRL + W usually deletes everything until the previous whitespace, so it would delete the whole '/var/log/nginx/' string in OP's example. Alt + backspace usually deletes until it encounters a non-alphanumeric character.

Be careful working CTRL + W into muscle memory though, I've lost count of how many browser tabs I've closed by accident...


Replies

hejiratoday at 8:57 AM

In my terminal it's the exact opposite – Alt-Backspace deletes to the previous space, whereas Ctrl-W deletes to the last non-alphanumeric (such as /). I'm using fish shell in an Alacritty terminal.

Yeah, pressing Ctrl-W accidentially is a pain sometimes ... but Ctrl-Shift-T in Firefox is a godsend.

show 1 reply
fainpultoday at 10:01 AM

Set $WORDCHARS accordingly. In your case, remove / from $WORDCHARS.

https://unix.stackexchange.com/a/726014

show 1 reply
gryffttoday at 8:51 AM

Ctrl-Shift-T usually brings that tab right back at least

figmerttoday at 9:57 AM

> Be careful working CTRL + W into muscle memory though, I've lost count of how many browser tabs I've closed by accident...

This hurts.

Also, for the shell, if you do C+w, you can "paste" it back using C+y. Assuming you have not removed that configuration.