I'm not sure how better to phrase this question. I have not recently installed anything new—in fact I'm a bit overdue to upgrade my three-year-old Linux Mint install—but in the last couple months I started seeing some maddening behaviour from vim that I can't figure out what option (plugin?) is doing it and thus can't turn it off.
Here's the bad behaviour: I'm editing a file, maybe a .tex file or a .cpp file, and every time focus leaves the terminal window and comes back to it, vim does some sort of grep of recent files based on the keyword under the cursor. If the vim session was in insert mode, it gets kicked out of it. The grep is printed at the bottom of the screen, below the status bar of the last buffer, scrolling up everything in the window, and requiring a keypress to clear the (unwanted) search and return to editing.
Here's what makes it especially hard to track down: it doesn't always do it. I have no idea what turns it on. I can edit files of various types over the course of several days and not see the bad behaviour. Then it starts, and I don't know what I've done differently.
Even weirder: not only does it keep happening as long as I'm editing that file, even if I quit vim, all subsequent vim sessions in that same terminal window will have the behaviour, for all file types. If I open another terminal window and edit those exact same files, they won't do the grep thing.
When I do :se
on two windows, side-by-side, where one is doing the thing and the other isn't, the options are identical, so it doesn't seem like any of them could be the culprit, but here they are:
:se
--- Options ---
background=dark ignorecase ruler sidescrolloff=3
cindent incsearch scroll=25 smartcase
expandtab laststatus=2 scrolloff=2 syntax=cpp
filetype=cpp nomodeline shiftwidth=2 ttyfast
helplang=en number showmatch ttymouse=sgr
backspace=indent,eol
comments=sO:* -,mO:* ,exO:*/,s1:/*,mb:*,ex:*/,://
fileencodings=ucs-bom,utf-8,default,latin1
formatoptions=croql
omnifunc=ccomplete#Complete
printoptions=paper:letter
runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim80,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
Press ENTER or type command to continue
This is typical of the grep-like output, if the cursor happens to be sitting on the word "begin":
exam1a.tex
1: 7 \begin{document}
exam1a-instructions.tex
2: 2 \begin{itemize}
3: 47 \begin{solnbox}{0in}
exam1-reformat.tex
4: 6 \begin{verbatim}
5: 10 \begin{verbatim}
6: 21 \begin{quote}
7: 29 \begin{quote}
8: 56 \begin{itemize}
9: 63 \begin{tabbing}
Press ENTER or type command to continue
and at the moment, two of those files are in open buffers and the third is one of a few dozen files in the directory, and I don't know why it was selected for searching.
When this gets going, vim is essentially unusable, because the content being edited is jumping up and down and the editor is pulled out of insert mode without me telling it to—but I can't turn it off without shutting down the editor and opening a fresh terminal window. The whole thing is surpassingly strange. If anyone knows what plugin this might be or what option to look for, to go turn off, please let me know.
I'm running vim 8.0.3741 on Linux Mint 19 Tara (like I said, a little overdue for an upgrade). It looks like I last upgraded vim in January of this year, but I don't remember ever seeing the above-described behaviour until late summer.
FocusGained
orFocusLost
events? You can check with:verbose au FocusGained
. Also try disabling plugins to see if it helps, and then enabling them one-by-one if it does to isolate the specific plugin. Also see How do I debug my vimrc file?[D
,[I
). Can you try and confirm if that's correct? If so, it would suggest to me than escape sequence containing those characters is being sent (somehow) and that Vim isn't correctly processing the sequence, ending up executing the command.