This commit is contained in:
Geoffrey Frogeye 2018-08-19 11:34:39 +02:00
commit f94154c8f5
73 changed files with 2216 additions and 823 deletions

79
bashrc
View file

@ -12,11 +12,6 @@ export BROWSER=qutebrowser
# Some programs need those changes
export PATH="/usr/lib/ccache/bin/:$PATH"
GEM_HOME=$(ruby -e 'puts Gem.user_dir' 2> /dev/null)
if [ $? -eq 0 ]; then
GEM_PATH=$GEM_HOME
export PATH="$PATH:$GEM_HOME/bin"
fi
if [ -d /data/data/com.termux/ ]; then
export PATH="$HOME/.termux/scripts:$HOME/.termux/bin:$PATH"
fi
@ -44,8 +39,10 @@ alias dd='dd status=progress'
alias rm='rm -Iv --one-file-system'
alias free='free -m'
alias df='df -h'
alias pacman='pacman --color auto'
alias dmesg='dmesg --ctime'
alias ffmpeg='ffmpeg -hide_banner'
alias ffprobe='ffprobe -hide_banner'
alias ffplay='ffplay -hide_banner'
# Frequent mistakes
alias sl=ls
@ -62,17 +59,50 @@ alias po='eval $(proxy off)'
alias nw="sudo systemctl restart NetworkManager"
alias mc="machines"
alias tracefiles="strace -f -t -e trace=file"
alias n='urxvtc &'
# 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'
fi
if which wakeonlan &> /dev/null; then
alias wol='wakeonlan'
fi
function _do_rank() { # executables... -- arguments...
for ex in "$@"
do
[ "$ex" == "--" ] && break
if which "$ex" &> /dev/null
then
for al in "$@"
do
shift
[ "$al" == "--" ] && break
alias "$al"="$ex"
done
"$ex" "$@"
return $?
fi
done
for ex in "$@"
do
[ "$al" == "--" ] && break
if -z "$list"
then
list=$ex
else
list=$list, $ex
fi
done
echo "Not installed: $list"
}
function _install_rank() { # executables...
for ex in "$@"
do
list=$@
alias "$ex"="_do_rank $list --"
done
}
_install_rank nvim vim vi
_install_rank gopass pass
_install_rank wakeonlan wol
_install_rank neomutt mutt
# SHELL CUSTOMIZATION
@ -89,7 +119,8 @@ shopt -s hostcomplete
export HISTSIZE=100000
export HISTFILESIZE=${HISTSIZE}
export HISTCONTROL=ignoreboth
export HISTCONTROL=ignorespace:erasedups
export HISTTIMEFORMAT="%y-%m-%d %H:%M:%S "
# PROMPT CUSTOMIZATION
@ -104,16 +135,28 @@ export PS1="\[\e]2;\u@\h \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[
export PS2="> "
export PS3="+ "
export PS4="- "
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD}\007"'
# CUSTOM SCRIPTS
export PATH="$HOME/.bin/:$HOME/.scripts/:$PATH"
export PATH="$HOME/.local/bin/:$HOME/.scripts/:$PATH"
[ -f ~/.gscripts/gprofile ] && source ~/.gscripts/gprofile
# UTILITIES
# Theme
[ -f ~/.local/bin/colorSchemeApply ] && source ~/.local/bin/colorSchemeApply
[ -f ~/.local/bin/colorSchemeApplyFzf ] && source ~/.local/bin/colorSchemeApplyFzf
# Bash completion
[ -f /etc/bash_completion ] && . /etc/bash_completion
[ -f /etc/bash_completion ] && source /etc/bash_completion
# Fuzzy matching all the way
export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS} --height 100% --layout=default"
export FZF_CTRL_T_OPTS="--preview '[[ -d {} ]] && ls -l --color=always {} || [[ \$(file --mime {}) =~ binary ]] && echo {} is a binary file || (highlight -O ansi -l {} || coderay {} || rougify {} || cat {}) 2> /dev/null | head -500'"
export FZF_COMPLETION_OPTS="${FZF_CTRL_T_OPTS}"
[ -f /usr/share/fzf/completion.bash ] && source /usr/share/fzf/completion.bash
[ -f /usr/share/fzf/key-bindings.bash ] && source /usr/share/fzf/key-bindings.bash
# Bad day mood-saver
function fuck {