2022-03-18 14:34:27 +01:00
|
|
|
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-04-18 20:04:06 +02:00
|
|
|
alias netgrep="ss --all --extended --processes --oneline --numeric | grep"
|
2022-03-18 14:34:27 +01:00
|
|
|
|
|
|
|
alias ltail="tail -n 50"
|
|
|
|
alias lhead="head -n 50"
|
|
|
|
|
|
|
|
alias po="popd"
|
2022-03-28 06:14:46 +02:00
|
|
|
alias d='print ${dirstack}'
|
2022-03-18 14:34:27 +01:00
|
|
|
|
|
|
|
alias man="LC_MESSAGES=C man"
|
|
|
|
alias make="LC_MESSAGES=C make"
|
|
|
|
alias free="LC_MESSAGES=C free"
|
|
|
|
|
2022-04-28 12:53:35 +02:00
|
|
|
if [[ ${VISUAL} == *emacs(client|remote)* ]]; then
|
2022-03-18 14:34:27 +01:00
|
|
|
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}"
|
2022-04-28 12:53:35 +02:00
|
|
|
if [[ "${tmp_editor}" == *emacsremote ]]; then
|
2022-03-18 14:34:27 +01:00
|
|
|
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 exifremove='exiftool -all='
|
|
|
|
|
2022-03-28 03:56:52 +02:00
|
|
|
local _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
|
2022-03-18 22:18:06 +01:00
|
|
|
_tmp_config_alias="GIT_SSH_COMMAND=\"ssh -i ~/.ssh/noid_dotfiles\" ${_tmp_config_alias}"
|
2022-03-18 14:34:27 +01:00
|
|
|
fi
|
2022-03-18 22:18:06 +01:00
|
|
|
alias config="${_tmp_config_alias}"
|
|
|
|
unset _tmp_config_alias
|
2022-03-18 14:34:27 +01:00
|
|
|
|
|
|
|
alias please='sudo'
|
|
|
|
alias 🥺='sudo'
|
|
|
|
|
|
|
|
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'
|
|
|
|
|
2022-04-10 06:15:21 +02:00
|
|
|
alias cp='cp --reflink=auto --preserve=all'
|
2022-03-18 14:34:27 +01:00
|
|
|
|
|
|
|
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'
|
|
|
|
|
2022-03-18 23:11:27 +01:00
|
|
|
alias machklein='mksmol'
|
|
|
|
|
2022-03-28 03:56:52 +02:00
|
|
|
alias diff='diff --color=auto'
|
2022-03-23 16:19:02 +01:00
|
|
|
|
2022-03-18 14:34:27 +01:00
|
|
|
# OS specific settings.
|
2022-04-08 00:28:05 +02:00
|
|
|
if [[ -f /etc/gentoo-release ]]; then
|
|
|
|
# Directory aliases for some Gentoo paths
|
|
|
|
for dir in /etc/portage/package.*; do
|
|
|
|
hash -d -- -${dir##*/}=${dir}
|
|
|
|
done
|
|
|
|
|
|
|
|
# Directory aliases for all enabled repos
|
|
|
|
function _my_diralias_repo_done()
|
|
|
|
{
|
|
|
|
local return_code=${2}
|
|
|
|
local stdout=${3}
|
|
|
|
|
|
|
|
if [[ ${return_code} -eq 0 ]]; then
|
|
|
|
if [[ "${stdout%%=*}" == "allrepos" ]]; then
|
|
|
|
# We got the list of repos
|
|
|
|
for repo in $(print ${stdout#*=}); do
|
|
|
|
async_job diralias_repo _my_diralias_repo ${repo}
|
|
|
|
done
|
|
|
|
else
|
|
|
|
# We got the path of a repo
|
|
|
|
local repo="repo_${stdout%%=*}"
|
|
|
|
hash -d -- -${repo}="${stdout#*=}"
|
2022-03-28 05:01:37 +02:00
|
|
|
fi
|
2022-04-08 00:28:05 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
function _my_diralias_repo()
|
|
|
|
{
|
|
|
|
print -n "${1}="
|
2022-04-08 00:39:53 +02:00
|
|
|
nice portageq get_repo_path / "${1}"
|
2022-04-08 00:28:05 +02:00
|
|
|
}
|
|
|
|
async_start_worker diralias_repo
|
|
|
|
async_register_callback diralias_repo _my_diralias_repo_done
|
|
|
|
async_job diralias_repo 'print -n "allrepos=$(portageq get_repos /)"'
|
|
|
|
fi
|
2022-03-18 14:34:27 +01:00
|
|
|
|
2022-03-28 03:56:52 +02:00
|
|
|
command -v apt-cache > /dev/null && alias qs="apt-cache search --names-only"
|
|
|
|
|
2022-03-28 05:01:37 +02:00
|
|
|
# Directory aliases for Gentoo repos in my home dir
|
|
|
|
for repo in gentoo guru; do
|
2022-03-28 05:23:26 +02:00
|
|
|
[[ -d ~/Projekte/${repo} ]] && hash -d -- -devrepo_${repo}=~/Projekte/${repo}
|
2022-03-18 14:34:27 +01:00
|
|
|
done
|
2022-03-28 05:01:37 +02:00
|
|
|
if [[ -d ~/Projekte/overlay-tastytea ]]; then
|
2022-03-28 05:23:26 +02:00
|
|
|
hash -d -- -devrepo_tastytea=~/Projekte/overlay-tastytea
|
2022-03-28 05:01:37 +02:00
|
|
|
fi
|