1
votes

Hello Dear Vim Lovers,

The situation is this.

I am editing something in vim. While I am in insert mode, I press alt-tab key to switch to another window. When I return back to vim, I am seeing alt and tab keys were captured by vim and inserted into my text.

It seems like [O[I[O[I[O[I[O[I.

I am working in gnome-terminal. I do not recall this behavior in my previous setups. There must be something wrong but I could not figure it out yet. In case anyone knows how to fix it, please let me know.

Thank you!

1
I'm sort of clueless, but to me the problem would have to be with your 1) OS, 2) UI (xwindows stack), or 3) gnome-terminal. One of those systems should be eating alt-tab so that it doesn't get forwarded to the app in gnome-terminal. I'm sure vim can be made to swallow alt-tab, but you'll run into other issues, I suspect. Maybe try on unix.stackexchange or askubuntu (if appropriate)?zzxyz
@zzxyz Thank you for your input. I tried to map alt-tab in insert mode to <ESC> but it did not work. It seem it captures Alt and Tab separately.Validus Oculus
Yeah, and I think you could probably map the escape sequence like \e[0[I or whatever, but then you still probably run into problems with other shells, emacs, neovim, etc...ps...if you do sed -n l, and then hit say...ctrl-right arrow, you should see a sequence...you should not see a sequence for alt-tab. Curious if you dozzxyz
Are you using tmux? If so, is the tmux option 'focus-events' set (look at the output of $ tmux show-options -s | grep focus)? Are you using the vim-tmux-focus-events plugin? If so, what's the output of :verb nno <f24> and :verb nno <f25>?user938271
@user938271 Thank you for your comment. The focus-events is on. The others are set by vim-tmux-focus-events plugin. Do you know any solution for this? n <F24> * :silent doautocmd FocusLost %<CR> Last set from ~/workshop/dotfiles/vim/bundle/vim-tmux-focus-events/plugin/tmux_focus_events.vim n <F25> * :doautocmd FocusGained %<CR> Last set from ~/workshop/dotfiles/vim/bundle/vim-tmux-focus-events/plugin/tmux_focus_events.vimValidus Oculus

1 Answers

2
votes

I was running into this problem after remapping <Esc> to a noop as recommended here. Deleting the remap stopped the characters from being inserted.