dotfiles/.config/zsh/zaliases

109 lines
3.1 KiB
Plaintext
Raw Normal View History

2022-03-18 14:34:27 +01:00
# -*- mode: shell-script; -*-
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ls="ls --color=auto -v"
alias ll="ls -lh"
alias l="ls -1"
alias la="ls -a"
alias grep="grep --color=auto"
alias zgrep="zgrep --color=auto"
2022-03-24 01:24:45 +01:00
alias hgrep="fc -liD 0 | grep"
2022-03-18 14:34:27 +01:00
alias psgrep="ps aux | grep -v grep | grep"
2022-03-28 03:45:30 +02:00
alias netgrep="ss --all --extended --processes --oneline | grep"
2022-03-18 14:34:27 +01:00
alias ltail="tail -n 50"
alias lhead="head -n 50"
alias po="popd"
alias man="LC_MESSAGES=C man"
alias make="LC_MESSAGES=C make"
alias free="LC_MESSAGES=C free"
if [[ "${VISUAL}" =~ "emacs(client|remote)" ]]; then
local tmp_editor="${VISUAL/ -c/}"
local ec_opts=""
# Workaround for <https://emacs.stackexchange.com/q/63843>.
[[ -z "${DISPLAY}" ]] && ec_opts=" -c"
alias e="${tmp_editor}${ec_opts}"
if [[ "${tmp_editor}" =~ "emacsremote$" ]]; then
alias se="${tmp_editor} --sudo"
elif pgrep -f "emacs --daemon" > /dev/null; then
# Edit files as root in the Emacs instance run by the current user.
alias se="$(command -v emacsremote) ${emacsclient_opts} --sudo --local"
fi
else
alias e="${VISUAL}"
alias se="sudo ${VISUAL}"
fi
alias ta="tmux attach -t tastytea || tmux new-session -s tastytea"
alias tmux_monitor="tmux source-file ~/.tmux/monitor.session"
alias exifremove='exiftool -all='
_tmp_config_alias='git --git-dir=${HOME}/.dotfiles/ --work-tree=${HOME}'
2022-03-18 14:34:27 +01:00
if [[ "${HOST}" != "ventiloplattform" && -f ~/.ssh/noid_dotfiles ]]; then
_tmp_config_alias="GIT_SSH_COMMAND=\"ssh -i ~/.ssh/noid_dotfiles\" ${_tmp_config_alias}"
2022-03-18 14:34:27 +01:00
fi
alias config="${_tmp_config_alias}"
unset _tmp_config_alias
2022-03-18 14:34:27 +01:00
alias please='sudo'
alias 🥺='sudo'
command -v thefuck > /dev/null && eval $(thefuck --alias)
alias cmake_static='cmake -DCMAKE_FIND_LIBRARY_SUFFIXES=".a" -DBUILD_SHARED_LIBS=OFF -D CMAKE_EXE_LINKER_FLAGS="-static"'
# Ask before removing crontab.
alias crontab='crontab -i'
# Explicitly use lesspipe.
2022-03-22 22:43:16 +01:00
if command -v lesspipe > /dev/null; then
2022-03-18 14:34:27 +01:00
alias lessp='LESSOPEN="|lesspipe %s" less'
2022-03-22 22:43:16 +01:00
elif command -v lesspipe.sh > /dev/null; then
alias lessp='LESSOPEN="|lesspipe.sh %s" less'
2022-03-18 14:34:27 +01:00
fi
# Follow mode does not work with highlight.
alias lessf='LESSOPEN="" less +F'
alias cp='cp --reflink=auto' # CoW copies if possible.
alias ip='ip -color -brief'
# Add --accept=".jpg,.png" or whatever.
alias wget_leech='wget --no-directories --page-requisites --span-hosts'
2022-03-18 16:01:01 +01:00
alias cat='cat-highlight'
alias machklein='mksmol'
alias alias diff='diff --color=auto'
2022-03-18 14:34:27 +01:00
# OS specific settings.
case $(lsb_release -i -s 2> /dev/null) in
Gentoo)
# Directory aliases
for dir in /etc/portage/package.*; do
hash -d -- -$(basename ${dir})=${dir}
done
if [[ -d /usr/local/portage ]]; then
hash -d -- -localrepo=/usr/local/portage
fi
;;
Debian|Raspbian|Ubuntu)
alias qs="apt-cache search --names-only"
;;
esac
# Directory aliases for Gentoo repos
for repo in overlay-tastytea guru gentoo; do
[[ -d ~/Projekte/${repo} ]] && hash -d -- -${repo}=~/Projekte/${repo}
done