[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A bug in Vim, in Mate Terminal or in Debian 11?



On Sat, Sep 18, 2021 at 10:14:39PM -0300, Dedeco Balaco wrote:
> My window manager is Mate Desktop. The terminal i most use is its own.
> And i use vim a lot,

> After the upgrade, when i quit vim, the terminal title becomes empty,
> instead of returning to the default title "Terminal".

The real question is how it worked in stretch.  There are several
moving pieces here, and it's not at all clear how they all fit together.

The terminal's title bar is set whenever some program writes the
appropriate bytes to the terminal.  Once the title is set to something,
it stays that way, until something changes it again.

So: under stretch, what program was writing what bytes to the terminal,
at what time?

We know that vim can be configured to set the title when you start it.
This is controlled by the "title" setting.  If you have "set title"
in your .vimrc file, then at startup, vim will change the terminal's
title to the name of the file you're editing.

But what happens when vim exits?  Vim doesn't know what the *previous*
title was, so how can it change the title back?  Therefore, when vim
exits (with "set title" in your .vimrc file), it changes the title
to "Thanks for flying Vim".

Vim has another setting called "titleold".  If this is set to a non-empty
string, vim will use the value of this variable as the new title.  So,
for example, if you would like the title to be changed to "Terminal"
every time you exit vim, you can put these lines in your .vimrc file:

set title
set titleold=Terminal

If titleold is set to the empty string, then the title isn't changed at
all on exit -- it just stays as the filename.

If there's a *third* option (to make vim somehow read the previous title
from the terminal, if that's even possible), then I don't know how to
achieve it.  It would probably be specific to the terminal as well.

If you want more answers than this, I suggest asking on a vim mailing
list.  They may have more expertise than we do.

A *fourth* option that some people use is to have their shell change the
terminal's title on a regular or semi-regular basis.  For example, some
people unilaterally override the title from the shell prompt every time
the prompt is drawn.  Other people override the title when the shell
changes directory.  These might be viable solutions for you as well, if
you choose.


Reply to: