Remix.run Logo
fellerts 9 hours ago

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

oxag3n 31 minutes ago | parent | next [-]

Depends on the shell - bash on my Ubuntu deletes entire '/var/log/nginx/', while after switching to sh it deletes only nginx

hejira 9 hours ago | parent | prev | next [-]

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.

Aerolfos 9 hours ago | parent [-]

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

Fun fact: despite having absolutely no menu entry for it, and I believe not even a command available with Ctrl+Shift+P, Vscode supports Ctrl+Shift+T to re-open a closed tab. Discovered out of pure muscle memory.

dgrunwald 7 hours ago | parent [-]

It's a normal command called "View: Reopen Closed Editor".

fainpul 8 hours ago | parent | prev | next [-]

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

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

exceptione 7 hours ago | parent [-]

For the bash people

  stty werase undef
  bind '"\C-w": backward-kill-word'

source: https://superuser.com/questions/212446/binding-backward-kill...
themafia 22 minutes ago | parent | prev | next [-]

'man readline' contains all the useful key combinations.

fp64 2 hours ago | parent | prev | next [-]

I've installed "More Better Ctrl-W" for Chromium, and mapped Ctrl-W to do nothing, and Ctrl-D to close the current tab

figmert 8 hours ago | parent | prev | next [-]

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

gryfft 9 hours ago | parent | prev | next [-]

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

sfink 2 hours ago | parent | prev [-]

...which is why I recently went to about:keyboard and removed that hotkey. I love that page.

That, and Ctrl-N. No more forest of blank browser windows when using a terminal emulator in a web page!

(Firefox only)