MacVim -- switch to tab where file is opened if trying to open an already-opened file Over the course of the day, I often open many tabs/windows open in MacVim, I forget exactly which files I've opened etc.

Then when I try to open a file I have already opened somewhere, I get something like the following:



So I have to go look for where I opened the file before, which is annoying (I have to go through all windows one-by-one to find its tab).

Is there a way to make MacVim just close the tab where I last opened the file automatically when I try to open the file again?
You can remap tabnew to tab drop so you will be switched to already opened files or directed to newly created file.

cnoreabbrev &lt;expr&gt; tabnew getcmdtype() == ":" &amp;&amp; getcmdline() == "tabnew" ? "tab drop" : "tabnew"