0

I am at folder /dev/project/ location in and when run vi ~/.gitconfig it opens that file but title of the terminal show the main location (/dev/project) but not the file location which is opened in vim editor, although vim editor show in bottom right about location which is ~ i.e root

so my question is is there any config/ settings available in terminal which change the the title of terminal to opened file name when using vi ( with no tab open , just like we have in Mac)

Note: using default terminal which comes with Ubuntu 24.04 and shell is bash

xkeshav
  • 809
  • 1
  • 9
  • 23

1 Answers1

2

Add set title to your vimrc. Quoting the help:

'title'         boolean (default off, on when title can be restored)
            global
    When on, the title of the window will be set to the value of
    'titlestring' (if it is not empty), or to:
        filename [+=-] (path) - VIM
    Where:
        filename    the name of the file being edited
        -       indicates the file cannot be modified, 'ma' off
        +       indicates the file was modified
        =       indicates the file is read-only
        =+      indicates the file is read-only and modified
        (path)      is the path of the file being edited
        - VIM       the server name v:servername or "VIM"

The default titlestring should be good enough, and looks like this when editing /etc/security/limits.conf while in /home/muru:

Title showing limits.conf = (/etc/security)

muru
  • 207,228