2017-02-09 11:00:03 +01:00
|
|
|
|
|
|
|
# Get ourselves a nice prompt
|
2017-05-19 17:06:37 +02:00
|
|
|
ks() { s="$?" ; $* ; return "$s" ; }
|
|
|
|
prompt_pwd() {
|
|
|
|
pwd | sed -e "s_${HOME}_~_" -e 's_\(/*.\)[^/]*/_\1/_g'
|
|
|
|
}
|
|
|
|
prompt_status() {
|
2017-02-09 11:00:03 +01:00
|
|
|
if [ "$?" = "0" ]
|
2017-05-19 17:06:37 +02:00
|
|
|
then echo " $"
|
|
|
|
else echo " %"
|
2017-02-09 11:00:03 +01:00
|
|
|
fi
|
|
|
|
}
|
2017-05-19 17:06:37 +02:00
|
|
|
BOLD="\[$(tput bold)\]"
|
|
|
|
GREEN="\[$(tput setaf 2)\]"
|
|
|
|
RESET="\[$(tput sgr0)\]"
|
2017-08-02 09:33:16 +02:00
|
|
|
source /usr/share/git/git-prompt.sh
|
|
|
|
export GIT_PS1_SHOWDIRTYSTATE=1
|
|
|
|
export GIT_PS1_SHOWSTASHSTATE=1
|
|
|
|
export GIT_PS1_SHOWUNTRACKEDFILES=1
|
|
|
|
export GIT_PS1_SHOWUPSTREAM="auto verbose"
|
|
|
|
PROMPT_COMMAND="__git_ps1 \"$BOLD[\T]$RESET $GREEN\$(ks prompt_pwd)$RESET\" \"\$(prompt_status) \""
|
2017-05-19 17:06:37 +02:00
|
|
|
unset BOLD
|
2017-02-09 11:00:03 +01:00
|
|
|
unset GREEN
|
|
|
|
unset RESET
|
|
|
|
|
2017-02-09 21:07:45 +01:00
|
|
|
# Completion
|
|
|
|
complete -c man
|
|
|
|
complete -cf sudo
|
2017-08-02 09:33:16 +02:00
|
|
|
complete -cf exec
|
2017-02-09 21:07:45 +01:00
|
|
|
|
2017-02-09 11:00:03 +01:00
|
|
|
# Color ls
|
|
|
|
alias ls="lr -1FG"
|
|
|
|
|
|
|
|
# No need for less history and more
|
|
|
|
alias less="LESSHISTFILE=- less"
|
|
|
|
alias more="less"
|
|
|
|
|
|
|
|
# There is only one vim
|
|
|
|
alias vim="nvim"
|
|
|
|
alias vi="nvim"
|
|
|
|
alias nano="nvim"
|
|
|
|
|
|
|
|
# Ready for ssh'ing
|
|
|
|
alias agent='eval "$(ssh-agent)" && ssh-add'
|
|
|
|
|
2017-06-14 10:21:16 +02:00
|
|
|
alias stop-after-this-song="mpc single && mpc idle && mpc single"
|
|
|
|
|
2017-02-09 11:00:03 +01:00
|
|
|
# FZF
|
2017-05-19 17:06:37 +02:00
|
|
|
go() {
|
|
|
|
dir="$(lr /home /data /etc -L -t '(name ~~ ".*" && prune || print) && type = d && !(name = ".git")' \
|
|
|
|
| fzf --height 10 \
|
|
|
|
)"
|
2017-02-09 11:00:03 +01:00
|
|
|
[ -n "$dir" ] && cd "$dir" || false
|
|
|
|
}
|
|
|
|
|