tmux-gitbar shows the status of your git working tree, right in tmux status bar.
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! :wink:
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.
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
Working tree status
Integrates easily and discretely with Tmux
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.
You can install tmux-gitbar anywhere you want, by default the location is your home directory.
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.
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.
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"
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.
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.
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 |
#{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.
Accepts left
of right
. Default:
TMGB_STATUS_LOCATION=right
TMGB_BG_COLOR
tmux-gitbar background color. Default is black.
TMGB_FG_COLOR
tmux-gitbar foreground color. Default is white.
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 between various information can be customized:
FLAGS_DELIMITER_FMT
delimits the different status flagsSYMBOL_DELIMITER_FMT
delimits the a status flag symbol with the
corresponding numberSPLIT_DELIMITER_FMT
delimits the status flags with the rest of the status
string.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"
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
).
$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.
$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
.
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:
tmux -V && echo $SHELL
.tmux.conf
echo $PROMPT_COMMAND
while inside a tmux session.Thanks!
The inspiration for and a part of the code base of tmux-gitbar are coming from those 2 great projects:
Contributers:
Other credits for :
tmux-gitbar is licensed under GNU GPLv3.
.tmgbignore
found.tmgbignore
$TMUX_GITBAR_CONF
tmux-gitbar.conf
is not version controlled any more, and generated at first
launch, allowing to update tmux-gitbar without overwriting user-customized
configuration..bashrc
PROMPT_COMMAND
now calls a script, not a shell function#{git_flags}
keyword