dotfiles/bashrc

115 lines
2.8 KiB
Bash
Raw Normal View History

#
# ~/.bashrc
#
2015-07-12 18:29:52 +02:00
# ENVIRONMENT VARIABLES
2016-03-14 13:49:51 +01:00
# Region preferences
export LANG=fr_FR.utf8
export TZ=/usr/share/zoneinfo/Europe/Paris
2016-03-14 13:49:51 +01:00
# Favourite commands
2016-02-25 20:35:44 +01:00
export PAGER=less
2015-07-12 18:29:52 +02:00
export EDITOR=vim
export VISUAL=gvim
export BROWSER=qutebrowser
2015-07-12 18:29:52 +02:00
# Some programs need those changes
2017-02-07 09:03:18 +01:00
if [ -d $HOME/.gem/ruby ]; then
ls $HOME/.gem/ruby | while read rubyVer; do
2017-02-07 09:03:18 +01:00
export PATH="$PATH:$HOME/.gem/ruby/$rubyVer/bin/"
done
fi
#export PATH="$(echo "$PATH" | sed 's|:|\n|g' | sort | uniq | tr '\n' ':' | sed 's|:$||')"
2015-07-12 18:29:52 +02:00
export JAVA_FONTS=/usr/share/fonts/TTF
export ANDROID_HOME=/opt/android-sdk
2016-12-18 15:10:40 +01:00
export GOPATH=$HOME/.go
export XDG_CONFIG_HOME=$HOME/.config
2015-07-12 18:29:52 +02:00
# ALIASES
2015-07-12 18:29:52 +02:00
# Completion for existing commands
2016-05-12 19:39:38 +02:00
export LS_OPTIONS='--group-directories-first --time-style=+"%d/%m/%Y %H:%M" --color=auto --classify --human-readable'
alias ls="ls $LS_OPTIONS"
2015-07-12 18:29:52 +02:00
alias grep='grep --color=tty -d skip'
2016-05-12 19:39:38 +02:00
alias mkdir='mkdir -v'
alias cp="cp -i"
alias mv="mv -iv"
alias dd='dd status=progress'
alias rm='rm -Iv --one-file-system'
alias free='free -m'
alias df='df -h'
2016-05-14 17:31:21 +02:00
alias pacman='pacman --color auto'
# Shortcuts for commonly used commands
alias ll="ls -l $LS_OPTIONS"
alias la="ls -la $LS_OPTIONS"
alias al=sl
2016-12-08 21:43:45 +01:00
alias x='startx; logout'
2016-12-11 23:13:54 +01:00
alias s='sudo -s -E'
alias po='eval $(proxy off)'
alias nw="sudo systemctl restart NetworkManager"
alias mc="machines"
# Superseding commands with better ones if they are present
if which vim &> /dev/null; then
alias vi='vim'
fi
if which gopass &> /dev/null; then
alias pass='gopass'
2015-09-24 18:08:29 +02:00
fi
if which wakeonlan &> /dev/null; then
alias wol='wakeonlan'
fi
2015-09-24 18:08:29 +02:00
# SHELL CUSTOMIZATION
complete -cf sudo
shopt -s cdspell
shopt -s checkwinsize
shopt -s cmdhist
shopt -s dotglob
shopt -s expand_aliases
shopt -s extglob
shopt -s histappend
shopt -s hostcomplete
export HISTSIZE=10000
export HISTFILESIZE=${HISTSIZE}
export HISTCONTROL=ignoreboth
# PROMPT CUSTOMIZATION
if [[ $USER == 'root' ]]; then
col=31;
elif [[ $USER == 'geoffrey' || $USER == 'gbontoux' || $USER == 'gpreud' ]]; then
col=32;
else
col=33;
2017-01-16 20:17:09 +01:00
fi
2017-02-12 15:14:51 +01:00
export PS1="\[\e]2;\u@\h \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "
export PS2="> "
export PS3="+ "
export PS4="- "
# CUSTOM SCRIPTS
export PATH="$HOME/.scripts/:$PATH"
[ -f ~/.gscripts/gprofile ] && source ~/.gscripts/gprofile
2017-01-16 20:17:09 +01:00
# UTILITIES
2015-07-12 18:29:52 +02:00
# Bash completion
[ -f /etc/bash_completion ] && . /etc/bash_completion
2015-07-12 18:29:52 +02:00
# Bad day mood-saver
if which thefuck &> /dev/null; then
alias fuck='TF_CMD=$(TF_ALIAS=fuck PYTHONIOENCODING=utf-8 TF_SHELL_ALIASES=$(alias) thefuck $(fc -ln -1)) && eval $TF_CMD && history -s $TF_CMD'
alias FUCK='fuck'
fi
2015-07-12 18:29:52 +02:00
2017-02-12 15:14:51 +01:00
# Command not found handlers
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash # Arch
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh # Arch (alternative, for Manjaro mostly)