dotfiles/home/aliases

75 lines
1.4 KiB
Plaintext

export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"
export EDITOR="/usr/local/bin/nvim"
# vim
alias vim="nvim"
# ls
alias ls="ls --color=auto"
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 -hd 1"
# 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="batcat -p --paging=never"
# pipe yd-dlp to mpv
ytmpv() {
yt-dlp -q -o - "$1" | mpv -
}
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 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
. "$NVM_DIR/nvm.sh"
. "$NVM_DIR/bash_completion"
fi
}