2015-07-12 18:29:52 +02:00
|
|
|
# Custom scripts
|
|
|
|
|
2016-03-14 13:49:51 +01:00
|
|
|
|
|
|
|
|
2015-10-09 18:45:44 +02:00
|
|
|
#find ~/.scripts/ ~/.gscripts/ -type f -name "*.sh" | while read script; do
|
|
|
|
#source "$script"
|
|
|
|
#done
|
2016-03-14 13:49:51 +01:00
|
|
|
[ -f ~/.scripts/index.sh ] && source ~/.scripts/index.sh
|
|
|
|
[ -f ~/.gscripts/index.sh ] && source ~/.gscripts/index.sh
|
2015-07-12 18:29:52 +02:00
|
|
|
|
|
|
|
# Prompt
|
|
|
|
if [[ $USER == 'root' ]]; then
|
|
|
|
col=31;
|
|
|
|
elif [[ -n $ME ]]; then # $ME is a var set by my private config that is not empty if it is my account (and not a system account e.g. `git`)
|
|
|
|
col=32;
|
|
|
|
else
|
|
|
|
col=33;
|
|
|
|
fi
|
|
|
|
|
2015-12-07 21:54:40 +01:00
|
|
|
export USER=$(whoami)
|
2016-12-30 15:35:25 +01:00
|
|
|
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\] "
|
2016-06-02 10:31:06 +02:00
|
|
|
PS2="> "
|
|
|
|
PS3="+ "
|
2016-12-30 15:35:25 +01:00
|
|
|
PS4="- "
|
2015-07-12 18:29:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Vars
|
2016-02-25 20:35:44 +01:00
|
|
|
export PAGER=less
|
2015-07-12 18:29:52 +02:00
|
|
|
export EDITOR=vim
|
2016-02-25 20:35:44 +01:00
|
|
|
export VISUAL=vim
|
2016-06-20 17:28:17 +02:00
|
|
|
export BROWSER=/usr/bin/qutebrowser
|
2016-02-25 20:35:44 +01:00
|
|
|
export TZ=/usr/share/zoneinfo/Europe/Paris
|
2015-07-12 18:29:52 +02:00
|
|
|
|
2017-01-16 20:17:09 +01:00
|
|
|
export PATH="$PATH"
|
2017-02-07 09:03:18 +01:00
|
|
|
if [ -d $HOME/.gem/ruby ]; then
|
|
|
|
$(which ls) $HOME/.gem/ruby | while read rubyVer; do
|
|
|
|
export PATH="$PATH:$HOME/.gem/ruby/$rubyVer/bin/"
|
|
|
|
done
|
|
|
|
fi
|
2017-01-16 20:17:09 +01:00
|
|
|
export PATH="$(echo "$PATH" | sed 's|:|\n|g' | sort | uniq | tr '\n' ':' | sed 's|:$||')"
|
2015-07-12 18:29:52 +02:00
|
|
|
export LANG=fr_FR.utf8
|
|
|
|
export HISTSIZE=10000
|
|
|
|
export HISTFILESIZE=${HISTSIZE}
|
|
|
|
export HISTCONTROL=ignoreboth
|
|
|
|
export JAVA_FONTS=/usr/share/fonts/TTF
|
2016-04-10 14:05:59 +02:00
|
|
|
export ANDROID_HOME=/opt/android-sdk
|
2016-12-18 15:10:40 +01:00
|
|
|
export GOPATH=$HOME/.go
|
2015-07-12 18:29:52 +02:00
|
|
|
|
2016-11-23 18:56:15 +01:00
|
|
|
if [ -z $XDG_CONFIG_HOME ]; then
|
|
|
|
export XDG_CONFIG_HOME=$HOME/.config
|
|
|
|
fi
|
2015-07-12 18:29:52 +02:00
|
|
|
|
|
|
|
# Tweaks
|
|
|
|
[[ $- != *i* ]] && return
|
|
|
|
|
|
|
|
if [ -f /etc/bash_completion ]; then . /etc/bash_completion; fi
|
|
|
|
|
|
|
|
xhost +local:root > /dev/null 2>&1
|
|
|
|
|
|
|
|
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
|
|
|
|
|
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"
|
|
|
|
alias ll="ls -l $LS_OPTIONS"
|
|
|
|
alias la="ls -la $LS_OPTIONS"
|
2015-11-20 14:03:59 +01:00
|
|
|
alias al=sl
|
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-06-02 10:31:06 +02:00
|
|
|
alias 49.3='sudo'
|
2016-05-14 17:31:21 +02:00
|
|
|
alias pacman='pacman --color auto'
|
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'
|
2015-07-12 18:29:52 +02:00
|
|
|
|
2017-02-12 07:45:14 +01:00
|
|
|
if which gopass &> /dev/null; then
|
|
|
|
alias pass='gopass'
|
2015-09-24 18:08:29 +02:00
|
|
|
fi
|
|
|
|
|
2015-07-12 18:29:52 +02:00
|
|
|
# Utils
|
2017-01-16 20:17:09 +01:00
|
|
|
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
|
|
|
|
2016-05-01 14:48:54 +02:00
|
|
|
# Command not found
|
2016-12-11 23:26:39 +01:00
|
|
|
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash
|
2017-01-14 18:34:14 +01:00
|
|
|
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh
|
2015-07-12 18:29:52 +02:00
|
|
|
|
|
|
|
# Functions
|
|
|
|
function clean {
|
2016-06-02 10:31:06 +02:00
|
|
|
find . -type d -name bower_components -or -name node_modules -print0 | while read file; do
|
2015-07-12 18:29:52 +02:00
|
|
|
rm -rf "$file"
|
|
|
|
done
|
2016-02-20 23:56:34 +01:00
|
|
|
find . -type f -name Makefile -print0 | while IFS= read -r -d '' file; do
|
2015-07-12 18:29:52 +02:00
|
|
|
echo "--> $file"
|
2016-03-16 14:23:24 +01:00
|
|
|
(cd "${file//Makefile}"; make clean)
|
2015-07-12 18:29:52 +02:00
|
|
|
done
|
2016-02-20 23:56:34 +01:00
|
|
|
find . -type d -name .git -print0 | while IFS= read -r -d '' dir; do
|
|
|
|
echo "--> $file"
|
|
|
|
(cd "$dir"; git gc)
|
|
|
|
done
|
2015-07-12 18:29:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function dafont {
|
|
|
|
wget "http://dl.dafont.com/dl/?f=$1" -O /tmp/dafont.zip
|
|
|
|
unzip /tmp/dafont.zip -d ~/.local/share/fonts -x *.txt
|
|
|
|
rm -rf /tmp/dafont.zip
|
|
|
|
}
|
|
|
|
|
2015-09-24 18:08:29 +02:00
|
|
|
alias nw="sudo systemctl restart NetworkManager"
|
2016-04-10 14:05:59 +02:00
|
|
|
|
2017-02-12 07:45:14 +01:00
|
|
|
# Clears everything it can to save space
|
|
|
|
function emergency-space {
|
|
|
|
rm -rf $HOME/.cache
|
|
|
|
if which pacman &> /dev/null; then
|
|
|
|
sudo pacman -Scc
|
|
|
|
elif which apt-get &> /deb/null; then
|
|
|
|
sudo apt-get clean
|
|
|
|
fi
|
|
|
|
if which journalctl &> /dev/null; then
|
|
|
|
sudo journalctl --vacuum-size=100M
|
|
|
|
fi
|
|
|
|
}
|