dotfiles/.config/zsh/zaliases
2022-03-24 01:26:10 +01:00

109 lines
3.0 KiB
Bash

# -*- 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"
alias hgrep="fc -liD 0 | grep"
alias psgrep="ps aux | grep -v grep | grep"
alias netgrep="netstat -tulpen | grep"
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}'
if [[ "${HOST}" != "ventiloplattform" && -f ~/.ssh/noid_dotfiles ]]; then
_tmp_config_alias="GIT_SSH_COMMAND=\"ssh -i ~/.ssh/noid_dotfiles\" ${_tmp_config_alias}"
fi
alias config="${_tmp_config_alias}"
unset _tmp_config_alias
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.
if command -v lesspipe > /dev/null; then
alias lessp='LESSOPEN="|lesspipe %s" less'
elif command -v lesspipe.sh > /dev/null; then
alias lessp='LESSOPEN="|lesspipe.sh %s" less'
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'
alias cat='cat-highlight'
alias machklein='mksmol'
alias alias diff='diff --color=auto'
# 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