Skip to content

Instantly share code, notes, and snippets.

@calpo
Created July 25, 2012 08:58
Show Gist options
  • Save calpo/3175186 to your computer and use it in GitHub Desktop.
Save calpo/3175186 to your computer and use it in GitHub Desktop.
bash_completion (git補完も) インストール
$ cd ~/local/src/
$ wget http://bash-completion.alioth.debian.org/files/bash-completion-1.2.tar.bz2
$ bzip2 bash-completion-1.2.tar.bz2
$ bzip2 -d bash-completion-1.2.tar.bz2
$ tar xvf bash-completion-1.2.tar
$ rm bash-completion-1.2.tar
$ cd bash-completion-1.2/
$ ./configure --help
$ ./configure --prefix=~/localll
$ ./configure --prefix=~/local
$ ./configure --prefix=/home/calpo/local
$ make
$ make install
$ wget "https://raw.github.com/git/git/master/contrib/completion/git-completion.bash" -O ~/local/etc/bash_completion.d/git --no-check-certificate
$ wget "https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh" -O ~/local/etc/bash_completion.d/git.prompt --no-check-certificate
----- .bashrc -----------------
# bash補完スクリプトディレクトリ
if [ -d /usr/local/etc/bash_completion.d ]; then
BASH_COMPLETION=/usr/local/etc/bash_completion
BASH_COMPLETION_DIR=/usr/local/etc/bash_completion.d
BASH_COMPLETION_COMPAT_DIR=/usr/local/etc/bash_completion.d
if [ -f /usr/local/etc/bash_completion ]; then
. /usr/local/etc/bash_completion
fi
fi
if [ -d /etc/bash_completion.d ]; then
BASH_COMPLETION=/etc/bash_completion
BASH_COMPLETION_DIR=/etc/bash_completion.d
BASH_COMPLETION_COMPAT_DIR=/etc/bash_completion.d
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
if [ -d $HOME/local/etc/bash_completion.d ]; then
BASH_COMPLETION=$HOME/local/etc/bash_completion
BASH_COMPLETION_DIR=$HOME/local/etc/bash_completion.d
BASH_COMPLETION_COMPAT_DIR=$HOME/local/etc/bash_completion.d
if [ -f $HOME/local/etc/bash_completion ]; then
. $HOME/local/etc/bash_completion
fi
fi
if [ ! -z $BASH_COMPLETION_DIR ]; then
if [ -f $BASH_COMPLETION_DIR/git ]; then
. $BASH_COMPLETION_DIR/git
. $BASH_COMPLETION_DIR/git.prompt
export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w$(__git_ps1) \n\[\033[01;34m\]\$\[\033[00m\] '
else
export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w \n\[\033[01;34m\]\$\[\033[00m\] '
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment