-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ctrl+W closes browser tab #90
Comments
@soichih This is really browser specific. Term.js does try to prevent that and it works in Firefox, but not in Chrome. 😭 In To be fast enough when working in web-term (in browser) I added this in my nnoremap <silent> <F12> :wincmd w<CR> With F12 I can switch between splits/windows in VIM. |
@IonicaBizau Thanks for the suggestion! I tried to map Shift+w to do what Ctrl+w normal does, but I couldn't figure out.. Your mapping works, but do you happen to know how I can basically replace Ctrl+w with Shift+w? Also, I've looked at the before-leaving-me.js.. it's very interesting! However.. there really isn't a way to detect browser leave event caused by user hitting Ctrl+w rather than closing it by clicking on the tab close button, or closing browsers, right? Thanks again for your suggestions! |
That's correct. And it's actually fine, because you probably don't want to close the tab via click too, because you will lose your work. That's how most of terminals work: if you have a process somewhere, they will ask you if you really want to close the terminal. In web-term I added something like this:
That means Ctrl + F will delete the last word. It does work in terminal, but not in VIM. I'm sure it's fixable by adding some shortcut in VIM, tho. 😄 |
When I am using vi on terminal, I usually open more than 1 files opened via ":sp" command. In order to toggle between different files inside vim is by pressing CTRL+W - which happens to be a key combinations for most browsers to close the current tab - no questions asked.
After a doing a bit of research / experiments, it looks like it's impossible to capture / preventDefault() the behavior of CTRL+W. I understand why browser makers adopted this policy, but I am a heavy vim user and I don't think I can live without having to use CTRL+W..
I don't know if there is any solution to this problem - other than not using :sp for vim (or remapping it to something other than CTRL+W..) but I just wanted to report this so that others might know different solutions to this problem.
The text was updated successfully, but these errors were encountered: