dotfiles/files/aliases.sh
Fernando Schauenburg 9b3bc72eaf bash: factor out profile and aliases
This is a preparation to start experimenting with zsh. The idea is to
share the aliases and environment setup between both shells to avoid
having a bunch of duplication. Even if I decide to stick with zsh it
would be nice to keep the bash configs around for systems where I might
not want to install zsh for some reason. We'll see how this goes...
2021-08-07 01:33:26 +02:00

43 lines
1.2 KiB
Bash

#!/bin/sh
# ls: make `ls` group directories first if supported.
# lsc: force `ls` to use color output (e.g. for piping into `less`).
if command -v exa >/dev/null 2>&1; then
# Prefer exa if installed
alias \
ls="exa -F --git --group-directories-first --group --links" \
la="ls -a" \
lt="ls -lT -I'.git'" \
lta="lt -a" \
lsc="ls --color=always" \
ltc="lt --color=always"
elif ls --group-directories-first --color=auto >/dev/null 2>&1; then
# GNU ls
alias \
ls="ls -hF --group-directories-first --color=auto" \
la="ls -A" \
lt="tree --dirsfirst -FI '.git|Spotlight-V100|.fseventsd'" \
lsc="ls --color=always" \
ltc="tree -C --dirsfirst -FI '.git'"
else
# BSD ls (e.g. macOS)
alias \
ls="ls -hF -G" \
la="ls -A" \
lt="tree --dirsfirst -FI '.git|Spotlight-V100|.fseventsd'" \
lsc="/usr/bin/env CLICOLOR_FORCE=1 ls" \
ltc="tree -C --dirsfirst -FI '.git'"
fi
alias ll="ls -l"
alias lla="la -l"
alias grep="grep --color=auto"
alias egrep="egrep --color=auto"
alias fgrep="fgrep --color=auto"
if command -v nvim >/dev/null 2>&1; then
alias vim="nvim"
alias vimdiff="nvim -d"
fi