dotfiles/.config/shell/aliases

64 lines
1.4 KiB
Text
Raw Normal View History

#!/bin/sh
# Aliases used in all kinds of shells
# Manage the bare `git` repository in ~/ holding the dotfiles
alias dotfiles='git --git-dir=$DOTFILES_DIR --work-tree=$HOME'
forget() { # the current history and restore $HISTFILE from disk
if [ -n "$BASH_VERSION" ]; then
history -c
history -r
fi
}
alias path='echo $PATH | tr ":" "\n"'
# Easier `cd` movements
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
# Use human-readable sizes
alias df='df --human-readable'
alias du='du --human-readable'
alias free='free --human'
# Make the terminal more colorful
alias diff='diff --color=auto'
alias grep='grep --color=auto --exclude-dir=.git'
alias ip='ip -color=auto'
if _command_exists dircolors; then
# Compute `$LS_COLORS` only once because this file is also sourced
# by every non-interactive `bash` via `$BASH_ENV` (e.g., ":!cmd" in `vi`)
if [ -z "${LS_COLORS:-}" ]; then
if [ -r "$XDG_CONFIG_HOME/dircolors" ]; then
eval "$(dircolors -b "$XDG_CONFIG_HOME/dircolors")"
else
eval "$(dircolors -b)"
fi
fi
alias ls='ls --color=auto'
fi
# Add common `ls` utilities
alias l='ls --classify --format=vertical'
alias la='ls --classify --format=vertical --almost-all'
alias lal='ls --classify --format=long --almost-all'
alias ll='ls --classify --format=long'
alias lla='lal'