Giter VIP home page Giter VIP logo

Comments (15)

arl avatar arl commented on June 6, 2024 1

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.

arl avatar arl commented on June 6, 2024

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.

enderahmetyurt avatar enderahmetyurt commented on June 6, 2024

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.

arl avatar arl commented on June 6, 2024

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.

enderahmetyurt avatar enderahmetyurt commented on June 6, 2024

It's bash

from tmux-gitbar.

arl avatar arl commented on June 6, 2024

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.

enderahmetyurt avatar enderahmetyurt commented on June 6, 2024

Yes. It's working after running set -x ~/.tmux-gitbar/update-gitbar

from tmux-gitbar.

arl avatar arl commented on June 6, 2024

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 trivial PS1 or PROMPT_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.

enderahmetyurt avatar enderahmetyurt commented on June 6, 2024

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.

enderahmetyurt avatar enderahmetyurt commented on June 6, 2024

@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.

arl avatar arl commented on June 6, 2024

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.

enderahmetyurt avatar enderahmetyurt commented on June 6, 2024

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.

arl avatar arl commented on June 6, 2024

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.

enderahmetyurt avatar enderahmetyurt commented on June 6, 2024

Ok thank you for your all help 🍰 🍡

from tmux-gitbar.

arl avatar arl commented on June 6, 2024

You're welcome

from tmux-gitbar.

Related Issues (20)

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.