# If not running interactively, don't do anything [ -z "$PS1" ] && return ##### VARIABLES ##### # don't put duplicate lines in the history. See bash(1) for more options export HISTCONTROL=ignoredups # ... and ignore same sucessive entries. export HISTCONTROL=ignoreboth # size export HISTSIZE=10000 export HISTFILESIZE=100000 # navigateur prefere export BROWSER=firefox # editeur par defaut export EDITOR=vim export VISUAL=$EDITOR # pager man conserve affichage à l'écran export MANPAGER="less -X" # youtube dl default dl dir FIXME default in youtube export YDL_TARGET=$HOME ##### COLORS ##### # ls colors export LSCOLORS="ExGxFxdxCxDxDxhbadExEx" # enable color support of ls and also add handy aliases if [ "$TERM" != "dumb" ]; then [ -x /usr/bin/dircolors ] && eval "`dircolors -b`" fi ##### FUNCTIONS ##### # status indicator prompt_status() { if [[ "$?" == "0" ]] then echo -n '\[\033[1;32m\]>' else echo -n '\[\033[1;31m\]X' fi echo -n '\[\033[1;31m\]' } ##### INCLUDES ##### # Alias definitions. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi # host specific if [ -f ~/.bash_aliases_$(hostname -s) ]; then . ~/.bash_aliases_$(hostname -s) fi # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi # FreeBSD [[ $PS1 && -f /usr/local/share/bash-completion/bash_completion.sh ]] && \ source /usr/local/share/bash-completion/bash_completion.sh ##### MISC ##### # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # conserve l'historique lorsque l'on utilise plusieurs terminaux shopt -s histappend # If this is an xterm set the title to user@host:dir case "$TERM" in xterm*|rxvt*) PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"' ;; *) ;; esac # Tmux + ssh agent forwarding if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock fi export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock ##### PROMPT ##### PS1_pre="\[\033[1;31m\]>> \[\033[01;37m\](\[\033[0;37m\]\u@\[\033[0;32m\]\h\[\033[01;37m\]) \[\033[01;34m\]\w\[\033[00m\]" PS1_post="\[\033[1;31m\]$(prompt_status)>\[\033[0;37m\] " PS1="${PS1_pre}\n${PS1_post}" ##### GIT ##### if [ -e /usr/local/share/git-core/contrib/completion/git-completion.bash ]; then . /usr/local/share/git-core/contrib/completion/git-completion.bash fi if [ -e /usr/local/share/git-core/contrib/completion/git-prompt.sh ] || [ -e /usr/lib/git-core/git-sh-prompt ]; then if [ -e /usr/lib/git-core/git-sh-prompt ]; then . /usr/lib/git-core/git-sh-prompt fi if [ -e /usr/local/share/git-core/contrib/completion/git-prompt.sh ]; then . /usr/local/share/git-core/contrib/completion/git-prompt.sh fi export GIT_PS1_SHOWDIRTYSTATE=1 export GIT_PS1_SHOWSTASHSTATE=1 export GIT_PS1_SHOWUNTRACKEDFILES=1 export GIT_PS1_SHOWUPSTREAM="auto" export GIT_PS1_SHOWCOLORHINTS=1 export PROMPT_COMMAND='__git_ps1 "$PS1_pre" "\n$PS1_post"' fi