Comments (15)
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.
from tmux-gitbar.
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.
from tmux-gitbar.
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 ""
from tmux-gitbar.
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
from tmux-gitbar.
It's bash
from tmux-gitbar.
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?
from tmux-gitbar.
Yes. It's working after running set -x ~/.tmux-gitbar/update-gitbar
from tmux-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)- your
$PROMPT_COMMAND
could be overwritten somewhat, do you have a non trivialPS1
orPROMPT_COMMAND
in .bashrc
or somewhere else that might be overwriting it? - the path to tmux-gitbar, as defined in
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?
from tmux-gitbar.
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.
from tmux-gitbar.
@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 tmux-gitbar.
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
from tmux-gitbar.
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.
from tmux-gitbar.
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
from tmux-gitbar.
Ok thank you for your all help π° π΅
from tmux-gitbar.
You're welcome
from tmux-gitbar.
Related Issues (20)
- How does tmux-gitbar would take advantage of tmux v2.3 HOT 2
- Takes no effect after installation HOT 1
- tmux-gitbar.conf needs to exist outside the repo HOT 6
- Show when a rebase, bisect, am is in progress? HOT 3
- Gitbar is squashed in to rightmost 14 characters HOT 3
- Add length limitation on the branch+remote string, or the whole bar
- No bar on tmux 2.1. HOT 12
- Problem when on a tag in detached state
- Symbols in Bash on Ubuntu on Windows don't work HOT 7
- Some errors occur when update-gitbar called in the initial git directory HOT 3
- Garbage output in freshly created repo with 0 commits
- unknown option: status-right-style HOT 5
- Bug when reading a newly created repo HOT 8
- Still read Git status when .tmgbignore
- Does not work in zsh HOT 5
- Doesnβt work with ZSH HOT 6
- Git status bar not showing automatically HOT 7
- Git information not showing up after reloading tmux config HOT 6
- Still having zsh issue HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmux-gitbar.