2

I currently use the following command to display the current git branch or mercurial bookmark for the pane's working directory. It works correctly as far as I can tell, but just before it computes the bookmark name the status bar flashes the actual text of the command that it's about to execute (it looks something like <cd ... && ...>) and then that gets replaced with the name of the bookmark after a moment. How can I avoid this flash and only see the final change?

set-option -g status-left\
  "#(cd #{pane_current_path} &&\
    if hg status 1>&2 2>/dev/null; then\
      echo \"($(hg book | grep \"^\\s\\*\" | cut -d' ' -f 3)) \";\
    elif git status 1>&2 2>/dev/null; then\
      echo \"($(git branch | grep \"^\\*\\s\" | cut -d' ' -f 2)) \";\
    fi;\
  )"

Note: I am running tmux 2.2

  • I'm also having this problem :( Did you find a solution? – Bill Jan 22 '18 at 13:52
  • I changed it to reference the internal file where the bookmark is stored. I didn't end up seeing how to do this in git, but for mercurial I ended up changing the command to just echo \"($(cat /path/to/repo/.hg/bookmarks.current 2> /dev/null)) \";\ . I imagine there's an analogue for this in git. – Kvass Jan 25 '18 at 19:43

Your Answer

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

Browse other questions tagged or ask your own question.