edkolev / tmuxline.vim

Simple tmux statusline generator with support for powerline symbols and statusline / airline / lightline integration
MIT License
1.61k stars 90 forks source link

display git branch in statusbar #65

Open georges-hatem opened 8 years ago

georges-hatem commented 8 years ago

I'm trying to use '#(shell-command)' to display the status of my git branch, but output is blank.

to debug, i replaced it with '#(ls -l)', and refreshed the theme through VIM. it showed '0', which makes sense because we're inside VIM.

exit vim, the count is still 0 even though that's not true.

Looks like the commands are not updating, which is surprising since #W changes upon path, and time and date update as well.

Any ideas?

jckegelman commented 6 years ago

I'm not sure if it's exactly what you're looking for, but if you just want to display the branch name in the tmuxline status, this worked for me:

#(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD)

Here is my tmuxline_preset from my .vimrc:

let g:tmuxline_preset = {
    \'a'    : '#S',
    \'b'    : '#W',
    \'c'    : '#(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD)',
    \'cwin' : ['#I', '#W'],
    \'win'  : ['#I', '#W'],
    \'x'    : '#{?client_prefix,Prefix,      }',
    \'y'    : ['%a', '%e-%b-%Y', '%l:%M%p'],
    \'z'    : '#h'}