Makes bashrc more portable checking for rpg-cli

main
zoomiti 3 years ago
parent 765044d9db
commit 282e5bf1b5

@ -18,7 +18,6 @@ alias grep='grep --color=auto'
alias webcam='mpv --demuxer-lavf-o=video_size=1920x1080,input_format=mjpeg av://v4l2:/dev/video0 --profile=low-latency --untimed' alias webcam='mpv --demuxer-lavf-o=video_size=1920x1080,input_format=mjpeg av://v4l2:/dev/video0 --profile=low-latency --untimed'
alias xp="xprop | awk '/^WM_CLASS/{sub(/.* =/, \"instance:\"); sub(/,/, \"\nclass:\"); print}/^WM_NAME/{sub(/.* =/, \"title:\"); print}'" alias xp="xprop | awk '/^WM_CLASS/{sub(/.* =/, \"instance:\"); sub(/,/, \"\nclass:\"); print}/^WM_NAME/{sub(/.* =/, \"title:\"); print}'"
alias gs='git status' alias gs='git status'
alias ga='git add' alias ga='git add'
alias gc='git commit' alias gc='git commit'
@ -26,23 +25,36 @@ alias gp='git push'
alias nvcfg='nvim ~/.config/nvim/init.vim' alias nvcfg='nvim ~/.config/nvim/init.vim'
alias rpg-battle="rpg-cli cd -f . && rpg-cli battle"
alias rm="rpg-battle && rm"
alias rmdir="rpg-battle && rmdir"
alias mkdir="rpg-battle && mkdir"
alias touch="rpg-battle && touch"
alias mv="rpg-battle && mv"
alias cp="rpg-battle && cp"
alias chown="rpg-battle && chown"
alias chmod="rpg-battle && chmod"
alias la='ls -a' alias la='ls -a'
alias ll='ls -la' alias ll='ls -la'
alias vifm='vifmrun' alias vifm='vifmrun'
cd () {
vicd () {
dst="$(command vifm --choose-dir - . "$@")"
if [ -z "$dst" ] ; then
echo 'Directory picking cancelled/failed'
fi
cd "$dst"
}
if command -v rpg-cli &> /dev/null
then
PS1="[\u@\h ](\W)\n$(CLICOLOR_FORCE=1 rpg-cli stat -q | sed 's/@.*//' | sed 's/\(\x1B[@A-Z\\\]^_]\|\x1B\[[0-9:;<=>?]*[-!"#$%&'"'"'()*+,.\/]*[][\\@A-Z^_`a-z{|}~]\)/\\[\1\\]/g')\$ "
alias rpg-battle="rpg-cli cd -f . && rpg-cli battle"
alias rm="rpg-battle && rm"
alias rmdir="rpg-battle && rmdir"
alias mkdir="rpg-battle && mkdir"
alias touch="rpg-battle && touch"
alias mv="rpg-battle && mv"
alias cp="rpg-battle && cp"
alias chown="rpg-battle && chown"
alias chmod="rpg-battle && chmod"
cd () {
builtin cd "$@" builtin cd "$@"
command ls --color=auto command ls --color=auto
if [[ $PWD == ~ ]] ; then if [[ $PWD == ~ ]] ; then
@ -51,25 +63,19 @@ cd () {
rpg-cli cd -f . rpg-cli cd -f .
rpg-cli battle rpg-cli battle
fi fi
} }
ls () { ls () {
command ls --color=auto "$@" command ls --color=auto "$@"
if [ $# -eq 0 ] ; then if [ $# -eq 0 ] ; then
rpg-cli cd -f . rpg-cli cd -f .
rpg-cli ls rpg-cli ls
fi fi
} }
else
vicd () { PS1='[\u@\h \W]\$ '
dst="$(command vifm --choose-dir - . "$@")" fi
if [ -z "$dst" ] ; then
echo 'Directory picking cancelled/failed'
fi
cd "$dst"
}
PS1='[\u@\h \W]\$ '
bind '"\e[A": history-search-backward' bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward' bind '"\e[B": history-search-forward'

Loading…