5

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.

  1. New terminal window – "" – ""
  2. vim foo.txt – "foo.txt" – "foo.txt"
  3. :q – "" – ""
  4. vim foo.txt – "foo.txt" – "foo.txt"
  5. CtrlZ – "" – "Thanks for flying Vim"
  6. %% – "foo.txt" – "foo.txt"
  7. :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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.