Tmux: How to configure tmux to display the current working directory of a pane on the status bar?

后端 未结 3 2076
伪装坚强ぢ
伪装坚强ぢ 2021-02-04 03:14

I am new to tmux and I am trying to edit my tmux.conf file to have the left side of the status bar reflect:

[SessionName] [CurrentPane] [CurrentWorkingDirectory]

3条回答
  •  不思量自难忘°
    2021-02-04 03:45

    Unfortunately, the proposed solution does not work for version 1.7 - "official version" for OpenSuse 12.3, but I managed to find a solution:
    In /etc/tmux.conf:

    setw -g window-status-current-format "#T(#I:#W#F)"  
    setw -g window-status-format "#T(#I:#W#F)"  
    

    Here #T - tells to display current pane title, which can be set with some escape sequence. For doing this at each shell command, put somewhere in .bashrc:

    [[ -n "$TMUX" ]] && PROMPT_COMMAND='echo -n -e "\e]2;${PWD/${HOME}/~}\e\\"'  
    

    This works for me on OpenSuse 12.3, tmux 1.7, bash 4.2.53.

提交回复
热议问题