2017-02-12 10:41:03 +00:00
|
|
|
#
|
|
|
|
# ~/.bashrc
|
|
|
|
#
|
2015-07-12 16:29:52 +00:00
|
|
|
|
2017-02-12 10:41:03 +00:00
|
|
|
# ENVIRONMENT VARIABLES
|
2016-03-14 12:49:51 +00:00
|
|
|
|
2017-02-12 10:41:03 +00:00
|
|
|
# Favourite commands
|
2016-02-25 19:35:44 +00:00
|
|
|
export PAGER=less
|
2015-07-12 16:29:52 +00:00
|
|
|
export EDITOR=vim
|
2017-02-13 05:40:24 +00:00
|
|
|
export VISUAL=vim
|
2017-02-12 10:41:03 +00:00
|
|
|
export BROWSER=qutebrowser
|
2015-07-12 16:29:52 +00:00
|
|
|
|
2017-02-12 10:41:03 +00:00
|
|
|
# Some programs need those changes
|
2017-04-22 16:04:17 +00:00
|
|
|
export PATH="/usr/lib/ccache/bin/:$PATH"
|
2018-04-10 13:38:18 +00:00
|
|
|
# if [ -d $HOME/.gem/ruby/2.4.0/bin ]; then
|
|
|
|
# export PATH="$HOME/.gem/ruby/2.4.0/bin/:$PATH"
|
|
|
|
# fi
|
2017-09-17 11:36:17 +00:00
|
|
|
if [ -d /data/data/com.termux/ ]; then
|
|
|
|
export PATH="$HOME/.termux/scripts:$HOME/.termux/bin:$PATH"
|
|
|
|
fi
|
2017-02-12 10:41:03 +00:00
|
|
|
#export PATH="$(echo "$PATH" | sed 's|:|\n|g' | sort | uniq | tr '\n' ':' | sed 's|:$||')"
|
2015-07-12 16:29:52 +00:00
|
|
|
export JAVA_FONTS=/usr/share/fonts/TTF
|
2016-04-10 12:05:59 +00:00
|
|
|
export ANDROID_HOME=/opt/android-sdk
|
2016-12-18 14:10:40 +00:00
|
|
|
export GOPATH=$HOME/.go
|
2017-09-01 16:39:06 +00:00
|
|
|
export PATH=$GOPATH/bin:$PATH
|
2017-02-12 10:41:03 +00:00
|
|
|
export XDG_CONFIG_HOME=$HOME/.config
|
2017-06-14 06:06:40 +00:00
|
|
|
export ARDUINO=/usr/share/arduino
|
|
|
|
export ARDUINO_DIR=$ARDUINO
|
|
|
|
export ARDMK_VENDOR=archlinux-arduino
|
2017-09-17 16:42:53 +00:00
|
|
|
export PYTHONSTARTUP=$HOME/.config/pythonstartup.py
|
2015-07-12 16:29:52 +00:00
|
|
|
|
2017-02-12 10:41:03 +00:00
|
|
|
# ALIASES
|
2015-07-12 16:29:52 +00:00
|
|
|
|
2017-02-12 10:41:03 +00:00
|
|
|
# Completion for existing commands
|
2017-09-01 16:40:03 +00:00
|
|
|
export LS_OPTIONS='--group-directories-first --time-style=+"%d/%m/%Y %H:%M:%S" --color=auto --file-type --human-readable'
|
2016-05-12 17:39:38 +00:00
|
|
|
alias ls="ls $LS_OPTIONS"
|
2015-07-12 16:29:52 +00:00
|
|
|
alias grep='grep --color=tty -d skip'
|
2016-05-12 17:39:38 +00: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 15:31:21 +00:00
|
|
|
alias pacman='pacman --color auto'
|
2018-03-19 06:29:56 +00:00
|
|
|
alias pacaur='pacaur --color auto'
|
2017-06-14 06:06:40 +00:00
|
|
|
alias dmesg='dmesg --ctime'
|
|
|
|
|
|
|
|
# Frequent mistakes
|
2018-01-22 07:29:43 +00:00
|
|
|
alias sl=ls
|
|
|
|
alias al=la
|
|
|
|
alias mdkir=mkdir
|
2017-06-14 06:06:40 +00:00
|
|
|
alias systemclt=systemctl
|
2017-02-12 10:41:03 +00:00
|
|
|
|
|
|
|
# Shortcuts for commonly used commands
|
|
|
|
alias ll="ls -l $LS_OPTIONS"
|
|
|
|
alias la="ls -la $LS_OPTIONS"
|
2016-12-08 20:43:45 +00:00
|
|
|
alias x='startx; logout'
|
2016-12-11 22:13:54 +00:00
|
|
|
alias s='sudo -s -E'
|
2017-02-12 15:46:30 +00:00
|
|
|
alias po='eval $(proxy off)'
|
2017-02-12 10:41:03 +00:00
|
|
|
alias nw="sudo systemctl restart NetworkManager"
|
|
|
|
alias mc="machines"
|
2017-08-22 05:57:52 +00:00
|
|
|
alias tracefiles="strace -f -t -e trace=file"
|
2018-05-21 08:57:19 +00:00
|
|
|
alias n='urxvtc &'
|
2018-01-08 11:26:49 +00:00
|
|
|
|
2017-02-12 10:41:03 +00:00
|
|
|
# Superseding commands with better ones if they are present
|
2018-04-10 13:38:18 +00:00
|
|
|
function vi() {
|
|
|
|
if which vim &> /dev/null; then
|
|
|
|
alias vi='vim'
|
|
|
|
fi
|
|
|
|
vim "$@"
|
|
|
|
}
|
|
|
|
function pass() {
|
|
|
|
if which gopass &> /dev/null; then
|
|
|
|
alias pass='gopass'
|
|
|
|
fi
|
|
|
|
gopass "$@"
|
|
|
|
}
|
|
|
|
function wol() {
|
|
|
|
if which wakeonlan &> /dev/null; then
|
|
|
|
alias wol='wakeonlan'
|
|
|
|
fi
|
|
|
|
wakeonlan "$@"
|
|
|
|
}
|
|
|
|
function mutt() {
|
|
|
|
if which neomutt &> /dev/null; then
|
|
|
|
alias mutt='neomutt'
|
|
|
|
fi
|
|
|
|
neomutt "$@"
|
|
|
|
}
|
2015-09-24 16:08:29 +00:00
|
|
|
|
2017-02-12 10:41:03 +00: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
|
|
|
|
|
2017-06-14 06:06:40 +00:00
|
|
|
export HISTSIZE=100000
|
2017-02-12 10:41:03 +00:00
|
|
|
export HISTFILESIZE=${HISTSIZE}
|
2018-04-10 13:38:18 +00:00
|
|
|
export HISTCONTROL=ignorespace:erasedups
|
|
|
|
export HISTTIMEFORMAT="%d/%m/%y %H:%M:%S "
|
2017-02-12 10:41:03 +00:00
|
|
|
|
|
|
|
# PROMPT CUSTOMIZATION
|
|
|
|
|
|
|
|
if [[ $USER == 'root' ]]; then
|
|
|
|
col=31;
|
|
|
|
elif [[ $USER == 'geoffrey' || $USER == 'gbontoux' || $USER == 'gpreud' ]]; then
|
|
|
|
col=32;
|
|
|
|
else
|
|
|
|
col=33;
|
2017-01-16 19:17:09 +00:00
|
|
|
fi
|
2017-02-12 14:14:51 +00: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="- "
|
2018-04-15 14:29:27 +00:00
|
|
|
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD}\007"'
|
2017-02-12 14:14:51 +00:00
|
|
|
|
|
|
|
# CUSTOM SCRIPTS
|
|
|
|
|
2017-09-01 16:39:06 +00:00
|
|
|
export PATH="$HOME/.bin/:$HOME/.scripts/:$PATH"
|
2017-02-12 14:14:51 +00:00
|
|
|
[ -f ~/.gscripts/gprofile ] && source ~/.gscripts/gprofile
|
2017-01-16 19:17:09 +00:00
|
|
|
|
2017-02-12 10:41:03 +00:00
|
|
|
# UTILITIES
|
2015-07-12 16:29:52 +00:00
|
|
|
|
2017-02-12 10:41:03 +00:00
|
|
|
# Bash completion
|
|
|
|
[ -f /etc/bash_completion ] && . /etc/bash_completion
|
2015-07-12 16:29:52 +00:00
|
|
|
|
2017-02-12 10:41:03 +00:00
|
|
|
# Bad day mood-saver
|
2017-06-21 18:05:05 +00:00
|
|
|
function fuck {
|
2017-06-14 07:26:25 +00:00
|
|
|
if which thefuck &> /dev/null
|
|
|
|
then
|
|
|
|
eval $(thefuck --alias)
|
2017-06-27 07:19:26 +00:00
|
|
|
fuck $@
|
2017-06-14 07:26:25 +00:00
|
|
|
else
|
|
|
|
echo "thefuck is not installed on this system."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
alias FUCK='fuck'
|
|
|
|
|
|
|
|
# Node Version Manager
|
2017-06-21 18:05:05 +00:00
|
|
|
function nvm {
|
2017-06-27 07:19:26 +00:00
|
|
|
export NVM_DIR="$HOME/.nvm"
|
2017-06-14 07:26:25 +00:00
|
|
|
if [ -s "$NVM_DIR/nvm.sh" ]
|
|
|
|
then
|
|
|
|
. "$NVM_DIR/nvm.sh"
|
|
|
|
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
2017-06-27 07:19:26 +00:00
|
|
|
nvm $@
|
2017-06-14 07:26:25 +00:00
|
|
|
else
|
|
|
|
echo "NVM is not installed on this system."
|
|
|
|
fi
|
|
|
|
}
|
2015-07-12 16:29:52 +00:00
|
|
|
|
2017-02-12 14:14:51 +00: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)
|
2016-04-10 12:05:59 +00:00
|
|
|
|