Closed enderahmetyurt closed 7 years ago
Hi,
Did you use the default or custom installation?
Can you show me the content of your tmux.conf
.
I tested tmux-gitbar on tmux 2.3 and I use versions 1.9 and 2.0 everyday.
I used the deafult installation.
set -g default-terminal "screen-256color"
# hjkl pane traversal
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
set -g base-index 1 # make the windows index start at 1 instead 0
set -g pane-base-index 1 # make the pane index start at 1 instead of 0
# splitting panes
bind | split-window -h
bind - split-window -v
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
#
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
#
# quick pane cycling
unbind ^A
bind ^A select-pane -t :.+
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
set-window-option -g window-status-current-bg colour22
source-file "$HOME/.tmux-gitbar/tmux-gitbar.tmux"
# 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 ""
Ok thanks, I forgot to ask you, what is your default shell? Bash or something else, as tmux-gitbar is supports only bash for now
It's bash
Ok i just tried with tmux.conf
your provided and tmux 1.9 and 2.3 and the git information is show in tmux status bar. So it must be something else...
Can you try to comment the line regarding tmux-gitbar
from tmux.conf
(source-file
),open a tmux session, cd into a git working tree directory and run:
set -x
~/.tmux-gitbar/update-gitbar
Can you see something?
Yes. It's working after running set -x ~/.tmux-gitbar/update-gitbar
Uhm, i can't seem to see which obvious thing it is, let me sum up:
update-gitbar
, when called, does what it's expected to (so its not a status bar settings problem)$PROMPT_COMMAND
could be overwritten somewhat, do you have a non trivial PS1
or PROMPT_COMMAND
in .bashrc
or somewhere else that might be overwriting it?tmux.conf
could differs from the actual path. But it doesn't seem to be the case...From what i understand, the tmux-gitbar specific $PROMPT_COMMAND, which should simply call ~/.tmux-gitbar/update-gitbar
doesn't seem to be installed. May i ask you to post here the output of set -x
and echo $PROMPT_COMMAND
when you are inside tmux?
In my .bashrc I set something for PS1
and PROMPT_COMMAND
. I cannot want to paste result of set -x
because it's so long :(
I removed PS1
and PROMPT_COMMAND
in my .bash_profile and It is fixed now. You are right. They are overwrite tmux-gitbar config.
Glad to hear it's working for you now.
Just so you know, you don't have to remove your $PROMPT_COMMAND
modifications, just be sure to not overwite what might be previously defined. You probably had a line similar to that in your .bashrc
:
export PROMPT_COMMAND=my_prompt_cmd
This will be run by tmux each time it creates a new window, and will reset any previously set $PROMPT_COMMAND
.
Instead, if you add something like that in your .bashrc
(replace date
with whatever was your command):
my_prompt_cmd=date
if ! echo $PROMPT_COMMAND | grep "$my_prompt_cmd" -q ; then
export PROMPT_COMMAND="$my_prompt_cmd;$PROMPT_COMMAND"
fi
This checks if the my_prompt_cmd
command is present in $PROMPT_COMMAND
, if yes it does nothing, if no it concatenates it. If you don't do this check, you may end with the same command run multiple times.
$PS1
has nothing to do with tmux-gitbar, so you can let it.
@aurelien-rainone this is my .bash_profile how can I configure it like you pointed. Could you help me?
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export PATH="$PATH:/usr/local/m-cli"
export PATH="$PATH:/path/to/elixir/bin"
if [ -f "$HOME/.profile" ]; then
source "$HOME/.profile"
fi
source ~/.git-prompt.sh
source ~/.git-completion.bash
# h is the host name, w the complete path
export PS1="\h\w$ "
##
## Git shortcut
##
g() {
if [[ $# == '0' ]]; then
git status
else
case $1 in
fuss)
shift
git rebase -i HEAD~"$1";;
*)
git "$@";;
esac
fi
}
##
## Prompt color
##
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export PS1="$PS1\$(git-radar --bash --fetch)"
function prompt {
local RESET="\[\e[0m\]"
local BLACK="\[\e[1;30m\]"
local RED="\[\e[0;31m\]"
local BLUE="\[\e[1;34m\]"
local LIGHTBLUE="\[\e[1;35m\]"
local RVM_GEMSET="$(~/.rvm/bin/rvm-prompt g | tr -d '\n')"
if [ -n "${RVM_GEMSET}" ]; then
local RVM_PROMPT="${RED}[$RVM_GEMSET]${RESET}"
else
local RVM_PROMPT=""
fi
if test -z "$VIRTUAL_ENV" ; then
local VIRTUALENV_PROMPT=""
else
local VIRTUALENV_PROMPT="${RED}[`basename \"$VIRTUAL_ENV\"`]${RESET} "
fi
local PATH_PROMPT="${LIGHTBLUE}\w${RESET}"
local TITLEBAR='\[\e]2;`pwdtail`\a'
local GIT_RADAR="$GIT_RADAR\$(git-radar --bash --fetch)"
PS1="${BLUE}\h:${VIRTUALENV_PROMPT}${RVM_PROMPT}${GIT_RADAR} ${PATH_PROMPT}\n${RESET}> "
}
PROMPT_COMMAND=prompt
PROMPT_COMMAND="tab_title ; $PROMPT_COMMAND"
tab_title () {
echo -n -e "\033]0;${PWD##*/}\007"
}
From what i understand, your prompt
function is what sets up your prompt (colors, git-radar, etc.), but it should not be included in the $PROMPT_COMMAND
variable, I now it's misguiding... Only tab_title
should be added/concatenated to $PROMPT_COMMAND
.
So i would remove both lines starting with PROMPT_COMMAND=
and adds this at the end of the file (after tab_title
definition):
# check if tab_title has already been installed as PROMPT_COMMAND
if ! echo $PROMPT_COMMAND | grep "tab_title" -q ; then
export PROMPT_COMMAND="tab_title;$PROMPT_COMMAND"
fi
# defines my bash prompt
prompt
I removed
PROMPT_COMMAND=prompt
PROMPT_COMMAND="tab_title ; $PROMPT_COMMAND"
and set as you say but now bash cannot change the RVM ruby gemset name.
Ok, so prompt
does need to be part of the $PROMPT_COMMAND
, this should do the trick:
if ! echo $PROMPT_COMMAND | grep "tab_title;prompt" -q ; then
export PROMPT_COMMAND="tab_title;prompt;$PROMPT_COMMAND"
fi
Ok thank you for your all help 🍰 🍵
You're welcome
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?