Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #240139

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

From <tomas@tuxteam.de>
Newsgroups linux.debian.user
Subject Re: A bug in Vim, in Mate Terminal or in Debian 11?
Date 2021-09-19 09:50 +0200
Message-ID <CYZKi-4ry-13@gated-at.bofh.it> (permalink)
References <CYTER-Hm-3@gated-at.bofh.it> <CYTER-Hm-1@gated-at.bofh.it> <CYUKB-1oH-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Sat, Sep 18, 2021 at 10:23:06PM -0400, Greg Wooledge wrote:
> 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,

[...]

> 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 [...]

I've no Mate terminal here (just plain xterm), but this fourth way is
the one Debian chose for me: the shell prompt (via the PS1 variable)
is the one working the magic. I guess Mate terminal works as Xterm
here.

It's defined to be

  tomas@trotzki:~$ echo $PS1
  \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$

Now it's a bit tough to read with all that escape voodoo (part of this
are "real" escapes sent to the terminal, part of them are interpreted
by the shell while preparing the prompt string out of this mumbo-jumbo
template) but I'll try (the PROMPTING section from the bash manual
is of help here). Those digested by the shell prompt I label with [P],
those passed through to the term as escape sequences with [E] (cf.
[1] for the latter):

  \[        ->  [P]              begin sequence of non-printing chars
  \e]0;     ->  [E] ESC ] 0 ;    (Xterm) set window title
  \u        ->  [P]              useername
  @         ->                   literal @
  \h        ->  [P]              hostname
  :         ->                   again, a literal
  [space]   ->                   literal (this gets boring :)
  \w        ->  [P]              current working directory (CWD)
  \a        ->  [E]              bell: close "set window title" escape
  \]        ->  [P]              end sequence of non-printing chars

...the rest is boring prompt matter. What this cooks down to is to
set the terminal title to <username>@<host>: <cwd>.

This has to be done at every prompt, otherwise the title wouldn't
"follow along" when I do cd, for example (or when I ssh into
another host).

When exiting vim, a new prompt is issued, so this is the one which
should take care of this.

So Dedeco -- I'd look into whatever is providing your shell prompt
as a first guess.

Cheers

[1] https://en.wikipedia.org/wiki/ANSI_escape_code

 - t

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

A bug in Vim, in Mate Terminal or in Debian 11? Dedeco Balaco <dedeco.balaco@yahoo.com> - 2021-09-19 03:20 +0200
  Re: A bug in Vim, in Mate Terminal or in Debian 11? Jeremy Hendricks <jwh1981@gmail.com> - 2021-09-19 03:30 +0200
    Re: A bug in Vim, in Mate Terminal or in Debian 11? Jeremy Hendricks <jwh1981@gmail.com> - 2021-09-19 03:50 +0200
  Re: A bug in Vim, in Mate Terminal or in Debian 11? Greg Wooledge <greg@wooledge.org> - 2021-09-19 04:30 +0200
    Re: A bug in Vim, in Mate Terminal or in Debian 11? <tomas@tuxteam.de> - 2021-09-19 09:50 +0200
      Re: A bug in Vim, in Mate Terminal or in Debian 11? Greg Wooledge <greg@wooledge.org> - 2021-09-19 16:00 +0200
        Re: A bug in Vim, in Mate Terminal or in Debian 11? <tomas@tuxteam.de> - 2021-09-19 17:20 +0200
          Re: A bug in Vim, in Mate Terminal or in Debian 11? Greg Wooledge <greg@wooledge.org> - 2021-09-19 18:00 +0200
      Re: A bug in Vim, in Mate Terminal or in Debian 11? <tomas@tuxteam.de> - 2021-09-19 19:50 +0200
        Re: A bug in Vim, in Mate Terminal or in Debian 11? <tomas@tuxteam.de> - 2021-09-19 20:50 +0200
          Re: A bug in Vim, in Mate Terminal or in Debian 11? <tomas@tuxteam.de> - 2021-09-19 21:30 +0200
            Re: A bug in Vim, in Mate Terminal or in Debian 11? David Wright <deblis@lionunicorn.co.uk> - 2021-09-19 21:40 +0200
              Re: A bug in Vim, in Mate Terminal or in Debian 11? <tomas@tuxteam.de> - 2021-09-19 22:00 +0200
                Re: A bug in Vim, in Mate Terminal or in Debian 11? David Wright <deblis@lionunicorn.co.uk> - 2021-09-19 22:20 +0200
            Re: A bug in Vim, in Mate Terminal or in Debian 11? <tomas@tuxteam.de> - 2021-09-19 22:10 +0200
    Re: A bug in Vim, in Mate Terminal or in Debian 11? Greg Wooledge <greg@wooledge.org> - 2021-09-19 16:00 +0200
  Re: A bug in Vim, in Mate Terminal or in Debian 11? Mark Neyhart <Mark.Neyhart@akleg.gov> - 2021-09-20 22:40 +0200
    Re: A bug in Vim, in Mate Terminal or in Debian 11? Dedeco Balaco <dedeco.balaco@yahoo.com> - 2021-09-20 22:40 +0200

csiph-web