darkrc/bashrc

124 lines
3.8 KiB
Bash
Raw Normal View History

# vim: set noexpandtab :miv #
2020-05-15 07:59:40 +00:00
alias gcd="source git-cd"
2020-05-15 09:36:09 +00:00
alias g="source cd-improved"
2020-05-15 09:37:57 +00:00
alias gg="cd $HOME; g ."
alias hello='echo "Hello :)"'
alias w='watch -t -d -n 1'
alias setclip='xclip -selection c'
alias getclip='xclip -selection clipboard -o'
2019-10-17 17:08:36 +00:00
alias r='ranger'
alias rr='(ranger)'
2019-12-05 10:00:28 +00:00
alias ro='(f=$(tempfile); $(which ranger) --choosefiles $f; rifle $(cat $f); rm $f)'
2020-06-22 12:40:09 +00:00
alias rf='(f=$(tempfile); $(which ranger) --choosefiles $f; cat $f; rm $f)'
# alias cmatrix='cmatrix -b -C `r.choose green red blue white yellow cyan magenta black`'
alias oneko='oneko -speed 20 -fg "#2f2f2f" -cursor 2 -name neko'
alias sakura='oneko -bg "#ffddee" -sakura -name sakura'
alias tmux='tmux -2'
alias pi='ssh pi -t ''tmux a -t home \|\| tmux new-session -s home'''
alias server='ssh server -t ''tmux a -t home \|\| tmux new-session -s home'''
alias ltc='getclip | luac -l -'
2018-03-09 13:57:04 +00:00
alias sign='gpg --armor --no-version --detach-sign --local-user darkwiiplayer'
2018-11-07 12:30:49 +00:00
alias workspace='cd ~/workspace'
2019-02-25 12:47:29 +00:00
alias shit='git'
alias ranger='source ranger'
2019-06-15 12:44:48 +00:00
alias ta='tmux a -t'
2019-12-17 16:13:48 +00:00
alias co='checkout'
2020-01-10 10:46:08 +00:00
alias qed='[ $RANDOM -ge $((32767 / 100 * 10)) ] && echo Quod Erat Demonstrandum || echo Quo Errat Demonstrator'
2020-01-30 14:46:47 +00:00
alias u='unicode'
2020-05-06 15:00:09 +00:00
alias hlcat='highlight -O xterm256'
2020-09-16 18:23:05 +00:00
alias please='sudo'
2020-11-16 07:17:55 +00:00
export HISTIGNORE='ls:clear:history:vimswitch*'
2018-11-07 12:30:49 +00:00
if which nvim > /dev/null
then
alias vim=nvim
alias oldvim=$(which vim)
fi
stty -ixon
2017-11-04 09:19:44 +00:00
# Enable Vi editing mode
set -o vi
2018-11-06 12:12:15 +00:00
2020-01-27 10:04:35 +00:00
rlevel() {
if [ -n "$RANGER_LEVEL" ]
then if [ "$RANGER_LEVEL" -gt 1 ] && [ ! -z "$3" ]
2020-01-27 10:04:35 +00:00
then
/bin/echo -ne "$1$3$RANGER_LEVEL "
2020-01-27 10:04:35 +00:00
else
/bin/echo -ne "$1 "
2020-01-27 10:04:35 +00:00
fi
fi
if [ -n "$VIM_LEVEL" ]
then if [ "$VIM_LEVEL" -gt 1 ] && [ ! -z "$3" ]
then
/bin/echo -ne "$2$3$VIM_LEVEL "
else
/bin/echo -ne "$2 "
fi
fi
2020-01-27 10:04:35 +00:00
}
2020-02-04 21:42:03 +00:00
numjobs() {
jobs=$(jobs | wc -l)
if [ $jobs -gt 1 ] && [ ! -z "$2" ]
then echo "$1$2$jobs "
2020-02-04 21:42:03 +00:00
elif [ $jobs -gt 0 ]
then echo "$1 "
fi
}
export PS1full='\[\033[00;34m\]┌─╼ \[\033[00;30m\]$(numjobs ⚒ " ×")\033[00;36m$(rlevel 🥆 📓 ·)\[\033[01;35m\]\u\[\033[00;34m\]@\[\033[01;35m\]\h \[\033[00;33m\]\$ \[\033[01;35m\]\w \[\033[01;34m\]`find -mindepth 1 -maxdepth 1 -type d | wc -l`\[\033[00;34m\]d \[\033[01;32m\]`find -maxdepth 1 -type f | wc -l`\[\033[00;32m\]f\[\033[00;34m\] $(gitprompt)
2018-11-06 19:02:35 +00:00
\[\033[00;34m\]└╼ \[\033[00m\]'
export PS1tiny='\[\033[00;30m\]$(numjobs ⚒)\[\033[00;30m\]$(dirs +0 | sed -e "s/.*\\(\\(\\/.*\\)\\{2\\}\\)$/…\\1/") \[\033[00;36m\]$(rlevel 🥆 📓 ·)\[\033[00;34m\]‣ \[\033[00m\]'
2020-01-31 11:13:45 +00:00
export PS1nano='\[\033[02;31m\]‣ \[\033[00m\]'
export PS1nogit='\[\033[00;34m\]┌─╼ \033[00;31m$(rlevel 🥆 📓)\[\033[01;35m\]\u\[\033[00;34m\]@\[\033[01;35m\]\h \[\033[00;33m\]\$ \[\033[01;35m\]\w \[\033[01;34m\]`find -mindepth 1 -maxdepth 1 -type d | wc -l`\[\033[00;34m\]d \[\033[01;32m\]`find -maxdepth 1 -type f | wc -l`\[\033[00;32m\]f\[\033[00m\]
\[\033[00;34m\]└╼ \[\033[00m\]'
export PS1git='\[\033[00;30m\]$(numjobs ⚒)\[\033[00;30m\]$(gitprompt || dirs +0) \[\033[00;36m\]$(gitpath) \[\033[00;36m\]$(rlevel 🥆 📖 ·)
\[\033[00;34m\]\[\033[00m\]'
2020-01-31 11:13:45 +00:00
2020-05-30 08:04:03 +00:00
export PS1gitlong='\[\033[00;30m\]$(numjobs ⚒ ·)\[\033[00;30m\]$(gitprompt || dirs +0) \[\033[00;30m\]$(git log --oneline --no-decorate -1 2>/dev/null)
\[\033[00;36m\]$(rlevel 🥆 📓 ·)\[\033[00;36m\]$(gitpath)\[\033[00;31m\]» \[\033[00m\]'
2020-02-04 20:52:08 +00:00
2020-07-17 11:26:43 +00:00
vimswitch() {
if [ -z "$EXPANDTAB" ]
then
export EXPANDTAB=yes
export TABSTOP=2
echo -e "Vim switched to \033[01;32mSpaces\033[00m mode"
else
unset EXPANDTAB
unset TABSTOP
echo -e "Vim switched to \033[01;35mTabs\033[00m mode"
fi
}
2020-01-31 11:13:45 +00:00
prompt() {
name=PS1$1
if [ -z $1 ] || [ -z "${!name}" ]; then
name=PS1full
2020-01-31 11:13:45 +00:00
fi
export PS1set=$1
PS1=${!name}
}
prompt $PS1set
2018-12-23 20:40:14 +00:00
cd() {
if [ -f .bashcdout ]
then
source .bashcdout
fi
builtin cd "$@" || return
if [ -f .bashcd ]
then
source .bashcd
fi
}
2019-02-25 12:47:29 +00:00
export GPG_TTY="$(tty)" # This is necessary for the gpg-agent, apparently