Giter VIP home page Giter VIP logo

tmux-gitbar's Introduction

Build status

Tmux-GitBar: shows Git Status in Tmux.

tmux-gitbar demo

tmux-gitbar shows the status of your git working tree, right in tmux status bar.

Important: this project has moved

What? You should switch to Gitmux, it now replaces tmux-gitbar.
Why? Because Gitmux does all what tmux-gitbar does but is much easier to install, use and customize!
How? Gitmux is written in Go, uses more recent tmux features making it shell-independent, whereas tmux-gitbar only worked on bash and was honestly was a pain to maintain! 😉
When Now! Gitmux is already at feature parity with tmux-gitbar, and will benefit from new features.

Just download the latest precompiled binary for your platform.

Features

If the working directory is managed by Git, tmux-gitbar will present Git status in a compact, discret and informative way, right in tmux status bar. When the working directory is not managed by git, tmux-gitbar gets out of the way.

Branches Info

  • names of local and remote branches
  • number of commits before/after/divergent between them

Working tree status

  • is your working tree clean?
  • number of changed, stashed, untracked files
  • are there any conflicts?

Integrates easily and discretely with Tmux

  • status bar is left untouched if current directory in not managed by Git.
  • when it does show, tmux-gitbar doesn't overwrite anything, instead it places itself at the leftmost, or righmost end of the status bar.

Customizable
tmux-gitbar has some sensible default, yet you can fully customize what will be displayed, where and how, in tmux-gitbar.conf, this file is auto-generated at first launch, in the installation directory.




Table of Contents

Installation

You can install tmux-gitbar anywhere you want, by default the location is your home directory.

Default installation

Default installation directory is $HOME/.tmux-gitbar

Get the code

git clone https://github.com/arl/tmux-gitbar.git ~/.tmux-gitbar

Add this to tmux.conf

source-file "$HOME/.tmux-gitbar/tmux-gitbar.tmux"

That's it, next time you restart tmux and bash, tmux-gitbar will show when the current directory is managed by Git.

Choosing another install location

Let's say you prefer to install tmux-gitbar in /path/to/tmux-gitbar.

Get the code

git clone https://github.com/arl/tmux-gitbar.git /path/to/tmux-gitbar

Add this to tmux.conf

TMUX_GITBAR_DIR="/path/to/tmux-gitbar"
source-file "/path/to/tmux-gitbar/tmux-gitbar.tmux"

Note: TMUX_GITBAR_DIR environment variable must be set before sourcing tmux-gitbar.tmux. It should not have any trailing slash.

Configuration file

tmux-gitbar generates a default configuration file at first launch in $HOME/.tmux-gitbar.conf. If you prefer having it somewhere else you should set the new path in $TMUX_GITBAR_CONF.

Add this to tmux.conf

TMUX_GITBAR_CONF="/path/to/.tmux-gitbar.conf"

Font

The default tmux-gitbar configuration does not require you to install any additional font. If however some symbols don't show up or are incorrectly displayed, you should check that your terminal font supports the symbols used in tmux-gitbar.

All default symbols can be replaced.

See the Symbols or Troubleshooting sections for more on this.

FYI, the font shown in the screenshots is consolas-font-for-powerline, and the default BRANCH_SYMBOL has been replaced.

Examples

tmux-gitbar demo

  • on branch master
  • remote tracking origin/master
  • local master is 1 commit ahead of origin/master
  • there is 1 changed (not staged) file
  • there is 1 untracked file

tmux-gitbar demo

  • on branch master
  • remote tracking origin/master
  • local master is 1 commit ahead of origin/master
  • the working tree is clean

tmux-gitbar demo

  • working tree is on a 'detached HEAD' state
  • no remote tracking branch
  • can't report about the remote branch
  • there is 1 staged file
  • there is 1 stash entry

tmux-gitbar demo

  • on branch master
  • remote tracking origin/master
  • local master has diverged by 7 commits, origin/master by 1
  • there is one merge conflict

Documentation

To cusstomize the location and appearance of tmux-gitbar you should see tmux-gitbar.conf, this file is generated at first launch with the default config.

Status string

The status string takes care of the general appearance of the status bar, each keyword corresponds to a specific information of the Git status.

Default status string is:

TMGB_STATUS_STRING="#{git_branch} - #{git_upstream} - #{git_remote} #{git_flags}"

The status string can be made of any of the standard tmux keywords, plus 4 new Git specific ones:

keyword example definition
#{git_branch} ⭠ master local branch
#{git_upstream} origin/master remote tracking branch
#{git_remote} ↓n local branch relative to upstream
#{git_flags} ●n ✚n or git status fields

tmux-gitbar keywords

  • #{git_branch}

Shows the symbol followed by the local branch name.

  • #{git_upstream}

Shows the name of remote upstream branch or ^ if you are not tracking any remote branch.

  • #{git_remote}
symbol meaning
↑n local branch is ahead of remote by n commits
↓n local branch is behind remote by n commits
↓m↑n local and remote branches have diverged, yours by m commits, remote by n
L local branch only, not remotely tracked
  • #{git_flags}
symbol meaning
●n there are n staged files
✖n there are n files with merge conflicts
✚n there are n changed but unstaged files
…n there are n untracked files
⚑n there are n stash entries

Flags are not shown if value is 0. The working tree is considered clean if all flags are 0, in this case a is shown.

Status bar location

Accepts left of right. Default:

TMGB_STATUS_LOCATION=right

Status bar color

  • TMGB_BG_COLOR

tmux-gitbar background color. Default is black.

  • TMGB_FG_COLOR

tmux-gitbar foreground color. Default is white.

Symbols

All symbols can be replaced. Symbols defined in tmux-gitbar.conf override default ones. For example, if you want to use the x to represent conflicts, instead of the default '✖' (unicode 0x2716), simply add to your tmux-gitbar.conf:

CONFLICT_SYMBOL="x"

Delimiters

Delimiters between various information can be customized:

  • FLAGS_DELIMITER_FMT delimits the different status flags
  • SYMBOL_DELIMITER_FMT delimits the a status flag symbol with the corresponding number
  • SPLIT_DELIMITER_FMT delimits the status flags with the rest of the status string.

Ignoring Repositories

You can ignore a repository by adding the file .tmgbignore to the root of the repository to be ignored. This will stop tmux-gitbar from showing for the targeted repository.

touch "/path/to/repo/.tmgbignore"

Troubleshooting

tmux-gitbar doesn't show up entirely...

It may simply be hidden because there isn't enough remaining space on the status bar. Try to increase the length of tmux status bar (left or or right) and/or remove some information from the tmux status bar (in tmux.conf):

# increase space on right status bar
set -g status-right-length 100

# remove everything on the right (just tmux-gitbar will show up)
set -g status-right ""

By default tmux-gitbar shows on the right, set left in tmux-gitbar.conf to see if that is your case (in tmux-gitbar.conf).

nothing is showing on tmux status bar...

Check if your $PROMPT_COMMAND has been overwritten.

To check this, open a tmux session and run:

/path/to/tmux-gitbar/update-gitbar

If tmux-gitbar shows up, that means something (in your .bashrc?) might be overwriting the $PROMPT_COMMAND environment variable installed by tmux-gitbar. $PROMPT_COMMAND should be a concatenation of commands, as $PATH is a concatenation of paths.

Check if your $PROMPT_COMMAND has been overwritten (2).

To check this, open a tmux session and run:

echo $PROMPT_COMMAND

If the output is __vte_prompt_command and only __vte_prompt_command, try to change or set default-terminal in your tmux configuration file (probably located at ~/.tmux.conf):

set -g default-terminal "screen-256color"

This is a known issue, on various Linux distributions, of a script that comes with certain versions of libvte. It overwrites the user $PROMPT_COMMAND environment variable instead of concatenating to it. There are different workarounds, the easiest being not to set default-terminal to a string containing xterm nor vte, for example screen-256color.

Windows Subsystem for Linux

Some users reported some symbols do not show up correctly with Bash on Windows, even when some additional font has been installed. Replace the offending symbols to solve this, see Symbols and #49.

Try to provide a maximum of context, at least:

  • the output of tmux -V && echo $SHELL
  • if possible, the content of your .tmux.conf
  • the output of echo $PROMPT_COMMAND while inside a tmux session.

Thanks!

Credits

The inspiration for and a part of the code base of tmux-gitbar are coming from those 2 great projects:

  • bash-git-prompt an informative and fancy bash prompt for Git users.
  • tmux-git a script for showing current Git branch in Tmux status bar

Contributers:

Other credits for :

License

tmux-gitbar is licensed under GNU GPLv3.

Changelog

v2.1.5, 2018-06-21

  • fix #57: git status still read when .tmgbignore found

v2.1.4, 2018-06-04

  • fix #54: garbage output on newly created repositories.

v2.1.3, 2017-04-28

  • update README: libvte workaround (troubleshooting)

v2.1.2, 2017-04-14

  • allow configuring status bar delimiters

v2.1.1, 2016-11-23

  • add support for ignoring repositories through .tmgbignore

v2.1.0, 2016-11-20

  • configuration file location is defined by $TMUX_GITBAR_CONF
  • Fix issue 37: tmux-gitbar.conf can be stored outside of repo.

v2.0.0, 2016-08-29

  • Concatenate Git status to previous status
  • Fix issue 28: do not overwrite previous status

v1.3.2, 2016-08-07

  • Replace default BRANCH_SYMBOL with u8997 symbol
  • Fix issue 10: some symbols do not render with the stock font

v1.3.0, 2016-04-02

  • tmux-gitbar.conf is not version controlled any more, and generated at first launch, allowing to update tmux-gitbar without overwriting user-customized configuration.

v1.2.0, 2016-03-26

  • Add integration test suite

v1.1.1, 2016-03-10

  • Replace deprecated status-xxx-fg/bg/attr syntax with the new style syntax
  • Fix issue 23 'bad colour' error

v1.1.0, 2016-03-06

  • Reorganize code to make testing easier
  • Add unit testing
  • Add travis continuous integration

v1.0.3, 2016-03-02

  • Protect from multiple prompt_command calls

v1.0.2, 2016-02-29

  • Fix Error on tmux.conf reload

v1.0.1, 2016-02-25

  • Remove vim modelines
  • more portable shebangs

v1.0.0, 2016-02-25

  • Breaking change: no more need to modify .bashrc
  • PROMPT_COMMAND now calls a script, not a shell function

v0.1.0, 2016-02-25

  • Include clean flags into #{git_flags} keyword
  • Rework README, add screenshots, screencast

v0.0.1, 2016-02-15

  • Initial version

tmux-gitbar's People

Contributors

alexkornitzer avatar arl avatar roobert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tmux-gitbar's Issues

Still read Git status when .tmgbignore

Opening this problem reported on #40 by @rbuckley:

@rbuckley:

What does the ignore actually do? I've put it in a large repo because it was causing me issues (taking several seconds to print the prompt because update_gitbar was running).

When I put .tmgbignore in the directory, the status on my tmux bar goes away, but I still see update_gitbar taking several seconds before the prompt is printed.

Thanks.

@arl:

Hi

Thanks for reporting!

.tmgbignore obviously should not do that, it should early exit as soon as
possible, just after clearing tmux git status.

Out of curiosity, how large is your repo?

Could you post the output of:

time git status --porcelain -uall

If possible with and without tmux git bar.
To disable, unexport PROMPT_COMMAND in a shell.

@rbuckley:

Hi, thanks for the quick response.

It is a large Android repo, about 28GB.

time outputs:

With tmux gitbar
real 0m4.564s
user 0m1.396s
sys 0m1.622s

After unexporting PROMPT_COMMAND

real 0m3.629s
user 0m1.190s
sys 0m1.660s

Problem to install

Hi,

After installation, I have only this icon on tmux status bar.
image

I tried to change zsh to bash, minimal tmux.conf, new ubuntu user but I have only the same icon.
Did I forget something?

Gitbar is squashed in to rightmost 14 characters

Hi -- I'm running the latest version of tmux, and the output is squashed over to the last 14 characters of the bottom bar.
This means that I'm not seeing anything but the truncated name of the branch I'm on.
Is there a configuration setting somewhere that I can alter to fix this?
Thanks for any & all help,
Doug.

PROMPT_COMMAND added multiple times if tmux-gitbar.tmux is reloaded

If tmux source-file is called when already inside tmux, the $PROMPT_COMMAND is modified another time. This leads to have multiple calls to update-gitbar in the $PROMPT_COMMAND.

The solution could be to check if $TMUX environment variable is set before modifiying $PROMPT_COMMAND

Handle broken Git repositories?

Tmux-gitbar doesn't handle well broken Git working tree... It's not clear exactly how the Git working tree was broken, but it happened with the help of submodules. Probably a git command was unexpectedly failing and producing output that was not filtered by tmux-gitbar, leading to additional lines being printed at every PROMPT_COMMAND and polluting the user terminal.

Problem when on a tag in detached state

To reproduce:

git checkout 2.0.3 

git status sayd:

$ git status
HEAD detached at 2.0.3
nothing to commit, working directory clean

But tmux-gitbar (version tag: v2.1.3)shows:
⎇ 2.0.1-89-g9fc3917 - ^ - . | ✔

Does not work in zsh

Great tmux/git addition!

However, right now it doesn't seem to work in zsh for me. When I enter bash and then a git repo I get the nice status bar, but when I'm just i zsh, it doesn't seem to work.

Make Tmux-gitbar styles/colors optional

Copy paste from issue #28, created by @adrianluff:

(Additionally), the current TMGB behavior requires duplicate, manual configuration of colors and styles in TMGB. This makes it unfriendly for use with plugins like vim-tmuxline. Further TMGB enhancement is possible by making TMGB colors and styles optional. I tested this by simply commenting two lines in tmux-gitbar.sh:

#tmux set-window-option "status-$TMGB_STATUS_LOCATION-style" "$TMGB_STYLE" > /dev/null
#tmux set-window-option "status-$TMGB_STATUS_LOCATION-length" 180 > /dev/null

This is only a partial solution but it allows the TMGB information to be combined with the user's existing tmux colorscheme or theme more easily.

An ideal implementation of this issue would have a conf file setting to enable or disable both of these enhancements rather than my hack-y solutions. Here's an example of what these changes allow.

image

Unnecessarily overwriting status-left or right

Presently tmux-gitbar overwrites the entire status-left or status-right tmux configuration. While the default status line is restored this limitation restricts TMGB's utility.

Consider tmux-gitbar.sh line 176:

tmux set-window-option -a "status-$TMGB_STATUS_LOCATION" "$status_string" > /dev/null

replaced with:

tmux set-window-option "status-$TMGB_STATUS_LOCATION" "$TMGB_OUTREPO_STATUS" > /dev/null
tmux set-window-option -a "status-$TMGB_STATUS_LOCATION" "$status_string" > /dev/null

The new behavior is to restore the default each time, then ADD (-a) the TMGB information to the user's existing tmux status line.

Git information not showing up after reloading tmux config

I've installed tmux-gitbar by git clone-ing per the documentation, updated my config and run source ~/.tmux.conf.

Something initially suspect was that it seems to have hung on generating the git info (apologies, I don't have the exact message handy). I had a config error unrelated to this that I fixed, and reloaded the config again with no change (it didn't hang this time, but no git information is being displayed in my tmux toolbar).

So, an itemized list of steps I've taken to get here:

  1. install per documentation
  2. update tmux config and reload
  3. correct unrelated config error and reload
  4. reload config several more times to attempt to fix issue

I've also tried running update-gitbar from the tmux command prompt but it tells me Unknown command: update-gitbar. I'm not sure if it's because I'm calling it incorrectly or there's something else afoot.

I'm running under bash on high sierra.

bash version:
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)
Copyright (C) 2007 Free Software Foundation, Inc.

tmux version: tmux 2.7

.tmux.conf:

# remap prefix to Control + a
set -g prefix C-a
# bind 'C-a C-a' to type 'C-a'
bind C-a send-prefix
unbind C-b

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

set -g @continuum-restore 'on'

source-file "$HOME/.tmux-gitbar/tmux-gitbar.tmux"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

tmux-gitbar.conf should be autogenerated on first run

The configuration file should be:

  • auto-generated on update-gitbar first run (why not during interpreting of tmux.conf as this would not add any workload to update-gitbar)
  • out of version control

This would permit to modify the default configuration, and not having it overwritten by tmux-gitbar updates.
Obviously if it already exists it should not be recreated...

Garbage output in freshly created repo with 0 commits

Don't know if this happens only on the currently-in-dev-branch handle-special-states, at commit fba3858, but this happens when entering in a freshly created repository with git init, with 0 commits yets:

Garbage output after each command entered:

[0:8369] 02:56:24 Sun Nov 05 [aurelien@computer8:/dev/pts/5 +3] ~/dev/evolve-webui       
$                                           
/home/aurelien/.tmux-gitbar/lib/tmux-gitbar.sh: line 129: test: on: integer expression expected                                                                                   
/home/aurelien/.tmux-gitbar/lib/tmux-gitbar.sh: line 129: test: master: integer expression expected                                                                               
/home/aurelien/.tmux-gitbar/lib/tmux-gitbar.sh: line 129: test: _NO_REMOTE_TRACKING_: integer expression expected                                                                 
/home/aurelien/.tmux-gitbar/lib/tmux-gitbar.sh: line 129: test: ^: integer expression expected

Garbage string showing on tmux status bar:

websocket⮀ 03:03     1:go 2:js (3:bash) 4:bash        ⎇  No - yet - commits | ```

Extra spaces in minimal config

Using the following tmux-gitbar.conf:

readonly TMGB_STATUS_LOCATION='left'
readonly TMGB_STYLE=''
readonly TMGB_STATUS_STRING=" #{git_branch}#{git_flags}"

...produces a minimalist tmux-gitbar config. The outputted information contains extra spaces which bloat the width of the tmux-gitbar status line (dashes used in place of spaces for emphasis):
"-⎇-master--✔"

Ideally I'd like "-⎇master-✔", which isn't possible without editing several places in the lib/tmux-gitbar.sh file because of spaces embedded in the strings.

Not sure this is worth fixing ultimately but thought I'd mention it.

Git status bar not showing automatically

Hi,

I can't make tmux-gitbar display automatically. I have to invoke it manually.
Running tmux using Konsole Version 18.08.0

I reckon I'm asking for trouble since I installed it using TPM, so I updated my conf as stated in the docs, but the status bar does not show unless I'm calling update-gitbar.

❯ tmux -V                                                                                                                                                                                                                                                                                                        
tmux 2.7-rc
❯ echo $SHELL                                                                                                                                                                                                                                                                                                   
/run/current-system/sw/bin/zsh

Here is my .tmux.conf

❯ cat ~/.tmux.conf                                                                                                                                                                                                                                                                                               
set -g base-index 1

# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on

set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000

setw -g mode-keys vi
setw -g mouse on
setw -g monitor-activity on
set -g status-justify centre

bind-key v split-window -h
bind-key s split-window -v

bind-key J resize-pane -D 5
bind-key K resize-pane -U 5
bind-key H resize-pane -L 5
bind-key L resize-pane -R 5

bind-key M-j resize-pane -D
bind-key M-k resize-pane -U
bind-key M-h resize-pane -L
bind-key M-l resize-pane -R

# Vim style pane selection
bind h select-pane -L
bind j select-pane -D 
bind k select-pane -U
bind l select-pane -R

# Use Alt-vim keys without prefix key to switch panes
bind -n M-h select-pane -L
bind -n M-j select-pane -D 
bind -n M-k select-pane -U
bind -n M-l select-pane -R

# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# Shift arrow to switch windows
bind -n S-Left  previous-window
bind -n S-Right next-window

# No delay for escape key press
set -sg escape-time 0

# Reload tmux config
bind r source-file ~/.tmux.conf

# THEME
set -g status-bg black
set -g status-fg white
set -g window-status-current-bg white
set -g window-status-current-fg black
set -g window-status-current-attr bold
set -g status-interval 60
set -g status-left-length 30
set -g status-left '#[fg=green](#S) #(whoami) '
set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'


# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-sidebar'
#set -g @plugin 'arl/tmux-gitbar'

TMUX_GITBAR_DIR="/home/damien/.tmux/plugins/tmux-gitbar"
set -g status-right-length 100

source-file "/home/damien/.tmux/plugins/tmux-gitbar/tmux-gitbar.tmux"

run -b '/home/damien/.tmux/plugins/tpm/tpm'

My ~/.zshrc

#Zplug
export ZPLUG_HOME=~/.zplug
source $ZPLUG_HOME/init.zsh

zplug clear

zplug "mafredri/zsh-async", from:github, defer:0
zplug "lib/completion", from:oh-my-zsh
zplug "zsh-users/zsh-syntax-highlighting", from:github, defer:3
zplug "sindresorhus/pure", use:pure.zsh, from:github, as:theme

zplug "rupa/z", use:z.sh

zplug load

if ! zplug check --verbose; then
    printf "Install zplug plugins? [y/N]: "
    if read -q; then
        echo; zplug install
    fi
fi

alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'

export LOCAL_IP=172.18.0.1

#VirtualEnv
export WORKON_HOME=/home/damien/Python/Envs/
VIRTUAL_ENV_PATH=`whereis virtualenvwrapper.sh | awk '{print $2}'`


#Path
NPM_PACKAGES=/home/damien/.npm-packages
PATH=$NPM_PACKAGES/bin:$PATH

unset MANPATH # delete if you already modified MANPATH elsewhere in your config
export MANPATH="$NPM_PACKAGES/share/man:$(manpath)"

export EDITOR=vim

# tabtab source for serverless package
# uninstall by removing these lines or running `tabtab uninstall serverless`
[[ -f /home/damien/.npm-packages/lib/node_modules/serverless/node_modules/tabtab/.completions/serverless.zsh ]] && . /home/damien/.npm-packages/lib/node_modules/serverless/node_modules/tabtab/.completions/serverless.zsh
# tabtab source for sls package
# uninstall by removing these lines or running `tabtab uninstall sls`
[[ -f /home/damien/.npm-packages/lib/node_modules/serverless/node_modules/tabtab/.completions/sls.zsh ]] && . /home/damien/.npm-packages/lib/node_modules/serverless/node_modules/tabtab/.completions/sls.zsh

NB: I had to comment the plugin declaration in ~/.tmux.conf because tpm was returning an error.

Add length limitation on the branch+remote string, or the whole bar

When the name of current branch is relatively long, the branch+remote substring eats so much space that few tmux windows name, if any, become readable or visible.

Example:
image

This problem would easily be solved by truncating the branch+remote substring. A sensible default in tmgb.conf + possibility to disable the truncating (with xxx_length=-1 or 0?). I guess the truncation could take effect on each component of the substring, replacing truncated parts with ellipsis, so as to still show the beggining of the current branch, and the beggining of the remote.

I guess providing a percentage would give better results than an absolute length.

Doesn’t work with ZSH

My shell is ZSH and when I add tmux-gitbar to my configuration, it does nothing (and I’m in a Git repo, both my ZSH and my Tmux (attach -c)).

I thought I’m doing something wrong, but then I found it relies on the $PROMPT_COMMAND which is a Bash thing.

Some symbols do not render with the stock font

This is what is shown on Linux with the Fixed font, using tmux Powerline:
image

image

If this is only the branch symbol that doesn't show up, I guess the default would be to not have it displayed.
However, if there are too many symbols that don't show up in a vanilla configuration, the set of symbols should be changed.

Error on tmux.conf reload

The if-shell expression, in tmux-gitbar.tmux, installing the PROMPT_COMMAND is failing on tmux.conf reloading. The problem seems due to different variable expansion rules when loading the file, or when reloading it from inside a tmux-session.

Takes no effect after installation

I followed the step described in readme , but nothing looks different than before.
I used zsh with tmux.
What is the expected location for tmux.conf?
In my device , I only have the config file.tmux.conf, rather than tmux.conf.
Any help?

tmux-gitbar.conf needs to exist outside the repo

Could you allow the option to have the tmux-gitbar.conf exist outside the repo? Apologies if this functionality already exists. Having the file exist in the repo makes it difficult to maintain the file across systems. I have tmux-gitbar as a submodule in my home folder setup which means I cannot manage the tmux-gitbar.conf across my machines. The conf file should really exist in the home folder anyway: ~/.tmux-gitbar.conf

Some errors occur when update-gitbar called in the initial git directory

$ cd /tmp
$ mkdir foobar
$ cd foobar
$ git init
$ ~/.tmux-gitbar/update-gitbar
/Users/foo/.tmux-gitbar/lib/tmux-gitbar.sh: line 128: test: on: integer expression expected
/Users/foo/.tmux-gitbar/lib/tmux-gitbar.sh: line 128: test: master: integer expression expected
/Users/foo/.tmux-gitbar/lib/tmux-gitbar.sh: line 128: test: _NO_REMOTE_TRACKING_: integer expression expected
/Users/foo/.tmux-gitbar/lib/tmux-gitbar.sh: line 128: test: ^: integer expression expected

env: tmux 2.6, zsh 5.4.2 (x86_64-apple-darwin16.7.0)
out of context: I'm troubled since I cannot update gitbar automatically...

How does tmux-gitbar would take advantage of tmux v2.3

tmux v2.3 has been released, with a nice changelog's .

How could tmux-gitbar take advantage of the new tmux features, especially from:

  • New option 'pane-border-status' to add text in the pane borders.
  • Support for hooks on commands: 'after' and 'before' hooks.

Switching from one pane to another, or from a window to another would immediately update git status. This removes the need to modify bash's PROMPT_COMMAND. This would also make tmux-gitbar shell-independent.

At this point, installation with the tmux-plugins-manager would be super easy.

Hook on window/pane switch events to keep status synced

Idea comes from this post of an user on tmux-gitbar thread on reddit/r/tmux

Hmm. This looks interesting. But what happens if you have two tmux windows (or panels, I don't know
what they're called) and they've both in different git repositories? Does the bar show the info for the repository for the currently active window / panel?

Answer and a possible solution for implementing it:

Tmux-gitbar is updated via a callback added to your bash $PROMPT_COMMAND. This is triggered every time you send a new bash command (so each time you press ENTER) So basically the gitbar shows the status of last pane or window in which you typed ENTER.
So if you divide your visible screen in 2 panes, and both panes have different working directories, the gitbar is not updated as soon as you switch from one pane to another, but as soon as you type ENTER is a pane.
If guess it should be possible to hook on the tmux switch-pane or switch-window event (or whatever it is called) and update the gitbar at this exact moment. In that way the gitbar would always be in sync.

No bar on tmux 2.1.

Output of tmux -V && echo $SHELL:

tmux 2.1
/bin/bash

My ~/.tmux.conf file can be found at this link (my GitHub repository).

I've tried cd'ing into directories that contain a git repository and I'm seeing no change in my tmux status bar. I don't seem to understand what the problem is.

PS - I'm fairly new to tmux so I may be missing out on something crucial.

Bug when reading a newly created repo

I noticed that if you enter a folder and hit git init, gitbar seems to have no code handle for having the git folder but no commits. Here follow my log:


/home/willian/.tmux-gitbar/lib/tmux-gitbar.sh: line 128: test: on: integer expression expected        
/home/willian/.tmux-gitbar/lib/tmux-gitbar.sh: line 128: test: master: integer expression expected    
/home/willian/.tmux-gitbar/lib/tmux-gitbar.sh: line 128: test: _NO_REMOTE_TRACKING_: integer expression expected                                                                                            
/home/willian/.tmux-gitbar/lib/tmux-gitbar.sh: line 128: test: ^: integer expression expected

Am I right? I could fix this issue if necessary. Just wanted to confirm with you guys before.

Issue when cd into a bare repository

This is what happens when entering into a bare repository:

panty@computerino:[~/dotfiles/term/.tmux-gitbar/tmp/repo]: cd bare
/home/panty/.tmux-gitbar/update-gitbar: line 144: test: -eq: unary operator expected
/home/panty/.tmux-gitbar/update-gitbar: line 144: test: -ne: unary operator expected
/home/panty/.tmux-gitbar/update-gitbar: line 144: test: -ne: unary operator expected
/home/panty/.tmux-gitbar/update-gitbar: line 144: test: -ne: unary operator expected
/home/panty/.tmux-gitbar/update-gitbar: line 144: test: -ne: unary operator expected
/home/panty/.tmux-gitbar/update-gitbar: line 144: test: -ne: unary operator expected
/home/panty/.tmux-gitbar/update-gitbar: line 144: test: -eq: unary operator expected

Still having zsh issue

I have the go version of gitstatus and I added the .tmux.conf line you suggested in a previous issue. Though, the tmux status bar isn't updated with git info once I go into a git directory. I still have to manually issue the command. Is there something I am missing with the setup?

Thanks!

Possible to remove the need to add a line in .bashrc?

The best way to do this, is to make tmux-gitbar.sh a script called, with absolute path, from PROMPT_COMMAND, instead of, as I'm doing now, defining PROMPT_COMMAND as:

PROMPT_COMMAND="update_gitbar; $PROMPT_COMMAND"

So:

PROMPT_COMMAND="/full/path/to/tmux-gitbar.sh; $PROMPT_COMMAND"

Make installable with Tmux Plugin Manager

It should be relatively easy to adapt tmux-gitbar nomenclature to let it follow the one of a tmux plugin manager plugin.
However, the fact that the update_gitbar callback needs to be added to $PROMPT_COMMAND from the user .bashrc could be a problem as adding one line to tmux.conf is not enough to make it work, there would still exist the need, as long as #9 is not solved, for an extra manual user action

Tmux 2.3 problem

Hi,
I did everthing on README but it cannot display in a project which has git repo. I am using tmux 2.3. How can I fix the problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.