I'm using Vim 7.3 on OS X Terminal version 2.6.1 (OS X version 10.11.2). If it's relevant, my version is compiled without X11.
When I open a file in Vim, the terminal title bar changes to show the file name, as expected. Quitting the file with :q
clears the title bar, also expected. The problem comes when using CtrlZ to stop Vim temporarily. After doing so, the title bar reads "Thanks for flying Vim". Restarting the stopped Vim instance with %%
causes the title bar to once again display the file name. Finally, quitting Vim with :q
leaves the title bar showing the file name, instead of blank as it should be.
Here's an example to clarify. Each step lists the action, the title bar that is expected, and the title bar that actually results.
- New terminal window – "" – ""
vim foo.txt
– "foo.txt" – "foo.txt":q
– "" – ""vim foo.txt
– "foo.txt" – "foo.txt"- CtrlZ – "" – "Thanks for flying Vim"
%%
– "foo.txt" – "foo.txt":q
– "" – "foo.txt"
As you can see, there are discrepancies between what I expect and what actually happens at steps 5 and 7. 5 can be fixed, I've found, with :set titleold=
, to clear the old title variable. However, step 7 continues to vex me, and is clearly related to stopping Vim using bash job control.
How do I get the title bar properly restored even after stopping and restarting Vim using bash job control?