6

I've been playing with this for a couple of days, so I'm sure I'm missing something simple. Love tmux. Using it for development and have so many windows I need a better way of distinguishing them in the status bar and in the buffer list. Seeing a list of "bash" and "vim" isn't really helpful at all. And since they're all on the same host - don't care about the hostname right now.

I'd like to show the current working directory, and the file being worked on. For example when I view the list of buffers I currently see:

(0) 0: vim [100x44] (1 panes) "murph"
(1) 1: vim [100x44] (1 panes) "murph"
(2) 2: bash- [100x44] (1 panes) "murph"
(3) 3: bash* [100x44] (1 panes) "murph"

Here's what I'd like to see
0:vim main.py ~/devl/project1
1:vim index.html ~/devl/samples/staticfiles
2:bash ~/devl/sandbox
3:bash ~/.vimrc

I'd like to see similar info in the status bar for each individual window. While I am able to get PWD to show up in the status bar of a window, it's only the working directory from where tmux was launched. This isn't any help as I change directories.

I'm hoping this can be done without a bunch of scripts.

Thanks all.

1

For bash add to .bash_profile or whatever:

PROMPT_COMMAND="echo -ne \"\\033]0;\${USER}@${HOSTNAME}\\007\\033k\${PWD}\\033\\\\\""

For vim add to .vimrc:

if &term == "screen"
    set t_ts=^[k
    set t_fs=^[\
endif
if &term == "screen" || &term == "xterm"
    set title
endif

autocmd BufEnter * let &titlestring = "vim " . expand("%:t") . " " . expand("%:h")

For those not familiar, to get the escape sequence ^[ in vim, press Control-V Escape.

1

Put this in your ~/.tmux.conf to get have current directory (of the pane you are one) show in tmux status

set -g status-left-length 100
set -g status-left '#[fg=green] #T#[default]'
  • This doesn't seem to actually affect the tmux status line – Tneuktippa Jun 6 '12 at 17:56
  • Thanks. This is what I come up with and prefer, set -g status-right-length 100 set -g status-right '#T' – jsz Jan 10 '13 at 2:41
  • didn't work for me – Michael Durrant Oct 12 '13 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.