3

I am using a oh-my-zsh shell in an Apple terminal (2.11) in full screen, and by default the name of the tabs is the name of the program being run (eg. vim).

Is there an easy way to set the title of the individual terminal tabs to the filename currently opened with vim?

The terminal window title is already set, but not visible in full screen mode. What I'm looking for is to get at a glance the title of all terminal tabs where vim is opened.

Screenshot below: 5 macOS terminal tabs with vim open in each

manuch100
  • 181
  • 2
  • 15
  • 1
    zsh is a shell, not a terminal. See [the difference](https://askubuntu.com/a/507138/356625). What terminal is this? Can you check the "help > about" at the top of the terminal window? – M Imam Pratama Jan 26 '22 at 09:51
  • 1
    Looks like you're using a macOS terminal, so [here it is](https://stackoverflow.com/a/49389564/9157799). – M Imam Pratama Jan 26 '22 at 10:08
  • @MImamPratama this works for the terminal window title, not for individual tabs titles. – manuch100 Jan 26 '22 at 20:07
  • Looks like there is an answer on the [Ask Different](https://apple.stackexchange.com/a/370287) sister site. – Tigger Jan 26 '22 at 20:20

1 Answers1

3

The solution seems to use vim script shared in https://stackoverflow.com/a/48975505/4756084. It sets the title dynamically based on what file is currently being viewed — which you cannot obtain by going into Terminal Preferences > Tab, and checking "Active process name" and "Arguments" (that would only display the name of the file opened when typing vim file.ext, ignoring any file opened with :e file2.txt, switches between vim panes, etc.)

(With oh-my-zsh, uncommenting DISABLE_AUTO_TITLE="true" in ~/.zshrc might help, as suggested in https://superuser.com/questions/292652/change-iterm2-window-and-tab-titles-in-zsh, although it seems optional after the step above.)

manuch100
  • 181
  • 2
  • 15