Closes highlighted tabs. To replace ctrl-w on Windows/Linux for Vim users!
# Better Ctrl-W
Vim users are used to using the `Ctrl-w` key combination for deleting the last
word when in insert mode. That's no problem for Mac OS users when using
chrome, as the keyboard shortcut for closing a tab is Cmd+w. This is a problem
when using the browser on either Linux or Windows machines, as `Ctrl-w` is the
shortcut for closing a window. So, when editing a text, a Vim user might
accidentally close the current tab by issuing a `Ctrl-w` command, sometimes losing
important text that was being edited.
That annoyance motivated people to discuss solutions on [a StackOverflow thread][1],
in which user [`samson`][2] commented he created [a Chrome extension][3] precisely to:
1. Assign `Ctrl-w` to an extension shortcut that does absolutely nothing
2. Assign a hotkey to close the current tab (I like to use `Alt-w` to mimic Mac OS's `Cmd+w`)
The problem with his extension is that it only works with the currently active tab,
and I regularly use `Shift + Click` to highlight a bunch of tabs, so that I can close them
all at once. His plugin didn't support multiple highlighted tabs, so I created my own.
# Usage
To use this plugin as it's intended, you have to set up the keyboard shortcuts after
installing it. Go to `chrome://extensions/shortcuts` and set the following shortcuts:
1. Assign `Do absolutely nothing` to `Ctrl-w`
2. Assign `Close highlighted tabs` to `Alt-w` or any other key combination of choice
This way, `Ctrl-w` will no longer close the current tab by mistake when editing it,
and you will be able to use `Alt-w` to close either the current of all highlighted tabs.
[1]: https://superuser.com/a/1207752
[2]: https://superuser.com/users/276658/samson
[3]: https://chrome.google.com/webstore/detail/ctrlw/goejokenmdamcapadhgghgpeeaeaaedc?hl=en
Latest reviews
- (2023-02-16) Elroyskimms: This extension does not work automatically after installation. You have to find the "Usage" instructions in the Overview to configure it. The configuration is simple and this extension works perfectly. I can finally use the browser-based terminal application without constantly closing the browser tab.
- (2022-12-18) Michael Chao: Although it works, when I want to reset Ctrl W to close tabs, I can't reset it anymore. Users should be warned that the changes cannot be undo!
- (2022-09-15) Miffy Poi: does not work on Chrome 105.x 在 Chrome 105.x 版本无法正常工作
- (2022-06-12) Lucy: This extension disables Ctrl-W even outside chrome. Yes, even while using other programs.
- (2022-05-08) Mike Michael: Doesn't work.
- (2022-01-15) Oleg Korolev: it would be great if you add to your extension the ability to delete the word before the cursor in the <input>
- (2021-09-02) Andras: I love it. Thanks!
- (2021-03-11) Stickelback: I use Ctrl W for ever browser game out there thank you so much!
- (2020-10-21) Hope J: Oh wow this is amazing. I've closed so many windows switching from terminal to chrome. SUGGESTION: put the intstructions to change the keybindings towards the top of the description/readme. Right now they are in the "read more" section, and it seemed like the extension wasn't working at first. thx!
- (2020-08-03) Nick Black: i've been logging out of the dumb terminal-in-a-browser work has foisted upon me something like twenty times a day. thank you.
- (2020-07-09) Paul Luong: I use a Mac and Windows interchangeably with the same keyboard. Really nice to be able to close tabs using alt-tab on this Windows Keyboard!
- (2020-06-26) no no (no): awesome!