Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It is possible! I wanted to share this answer because I've been looking for it for quite some time. Finally got the time to implement it myself. Put the following in your <code>.vimrc</code>:</p> <pre><code>autocmd BufEnter * let &amp;titlestring = ' ' . expand("%:t") set title </code></pre> <p>It will set the terminal title to only the document title currently in focus (<code>%t</code> stands for the document title without the path). Thanks to the event <code>BufEnter</code>, the terminal title changes each time you switch focus to another document. Also when leaving Vim, it is changed back to the original state. Put (or replace) the following in your <code>.tmux.conf</code>:</p> <pre><code>set-window-option -g window-status-current-format "[#I #W#T]" set-window-option -g window-status-format "[#I #W#T]" </code></pre> <p>It is not necessary to copy it exactly, but it looks like so: </p> <pre><code>[1 vim .tmux.conf][2 bash]... </code></pre> <p>The <code>I</code> stands for the window number. The <code>W</code> stands for the current application being run and the <code>T</code> stand for the terminal title. The later we use to show the current file open in vim. The terminal title is always set (my bash terminal always shows the hostname which i don't need to see in my status bar descriptions), so to only show it when vim runs add the following to your <code>.bashrc</code>:</p> <pre><code>PROMPT_COMMAND='echo -ne "\033]0;\007"' </code></pre> <p>This is true for bash, the shell I use. PROMPT_COMMAND is evaluated just before your prompt is shown in the terminal. The echo command sets the terminal title to nothing. This action thus happens each time you get your prompt back from applications who might have changed the title. Other shells might need to be configured differently...</p> <p>I wouldn't use <code>tmux rename-window</code> as it sets the title for as long as the windows exists. You would need to call it for each application launch. The presented approach keeps things dynamic, as it works with multiple panes in a window and multiple split screens/files open within vim.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload