dotfiles/home/aliases

91 lines
2.3 KiB
Plaintext

export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$HOME/.config/composer/vendor/bin:$PATH"
export PATH="/usr/local/texlive/2023/bin/x86_64-linux:$PATH"
export MANPATH="/usr/local/texlive/2023/texmf-dist/doc/man:$MANPATH"
export INFOPATH="/usr/local/texlive/2023/texmf-dist/doc/info:$INFOPATH"
export EDITOR="/usr/bin/nvim"
# vim
alias vim="nvim"
# ls
alias ls="ls --color=auto"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
alias .......="cd ../../../../../.."
alias ........="cd ../../../../../../.."
alias .........="cd ../../../../../../../.."
alias ..........="cd ../../../../../../../../.."
alias ...........="cd ../../../../../../../../../.."
alias ............="cd ../../../../../../../../../../.."
alias .............="cd ../../../../../../../../../../../.."
alias ..............="cd ../../../../../../../../../../../../.."
alias ...............="cd ../../../../../../../../../../../../../.."
alias ................="cd ../../../../../../../../../../../../../../.."
# improved reset and clear
alias reset="tput reset"
alias clear="tput reset"
# better du
alias du="du -ha"
# better feh
alias feh="feh -."
# vi keybindings
alias info="info --vi-keys"
alias less="less -R"
alias sl="ls"
alias la="ls -a"
alias venv="source venv/bin/activate"
# search functions
alias grepa="grep -I -n --color=always -r --exclude-dir=venv --exclude-dir=node_modules"
# cat
alias cat="bat -p --paging=never --theme=OneHalfLight"
# pipe yd-dlp to mpv
ytmpv() {
yt-dlp -q -o - "$1" | mpv -
}
# timeking config
alias newsboat="timeking '11:00-24:00' && newsboat"
goto() {
open="$(grepa "$@" | fzf --ansi -1)"
if [ ! -z "$open" ]; then
file="$(echo "$open" | cut -d: -f1 -)"
line="$(echo "$open" | cut -d: -f2 -)"
vim "$file" -c "cd %:p:h" -c "normal! $line"gg
fi
}
# NVM - Dynamic loading trick
alias nvm="load_nvm; nvm"
alias node="load_nvm; node"
alias npm="load_nvm; npm"
alias npx="load_nvm; npx"
alias yarn="load_nvm; yarn"
alias create-react-app="load_nvm; create-react-app"
export NVM_DIR="$HOME/.nvm"
load_nvm() {
if [ -z $NVM_LOADED ]; then
export NVM_LOADED=1
unalias nvm
unalias node
unalias npm
unalias npx
unalias create-react-app
. /usr/share/nvm/init-nvm.sh
. /usr/share/nvm/bash_completion
fi
}