bash: replace ls with exa when available

This commit is contained in:
Fernando Schauenburg 2020-12-13 02:02:25 +01:00
parent a520c635b6
commit 6af4eb3192
2 changed files with 12 additions and 5 deletions

View file

@ -163,21 +163,26 @@ __ps1_set() {
# ls: make `ls` group directories first if supported. # ls: make `ls` group directories first if supported.
# lsc: force `ls` to use color output (e.g. for piping into `less`). # lsc: force `ls` to use color output (e.g. for piping into `less`).
if ls --group-directories-first --color=auto &>/dev/null 2>&1; then if command -v exa >/dev/null; then
alias ls="exa -F --git --group-directories-first --group --links -I'.git'"
alias la="ls -a"
alias lt="ls -lT"
alias lta="ls -lTa"
alias lsc="ls --color=always"
elif ls --group-directories-first --color=auto &>/dev/null 2>&1; then
# GNU ls # GNU ls
alias ls="ls -hF --group-directories-first --color=auto" alias ls="ls -hF --group-directories-first --color=auto"
alias la="ls -A"
alias lsc="ls --color=always" alias lsc="ls --color=always"
else else
# BSD ls (e.g. macOS) # BSD ls (e.g. macOS)
alias ls="ls -hF -G" alias ls="ls -hF -G"
alias la="ls -A"
alias lsc="/usr/bin/env CLICOLOR_FORCE=1 ls" alias lsc="/usr/bin/env CLICOLOR_FORCE=1 ls"
fi fi
alias la="ls -a"
alias ll="ls -l" alias ll="ls -l"
alias lla="ls -la" alias lla="la -l"
alias llc="lsc -l"
alias llac="lsc -la"
alias g='git' alias g='git'
alias ga='git a' alias ga='git a'

View file

@ -6,6 +6,7 @@
apt: name={{ item }} state=latest update_cache=yes apt: name={{ item }} state=latest update_cache=yes
loop: loop:
- curl - curl
- exa
- exuberant-ctags - exuberant-ctags
- ffmpeg - ffmpeg
- gpg - gpg
@ -32,6 +33,7 @@
- coreutils - coreutils
- ctags - ctags
- curl - curl
- exa
- exiftool - exiftool
- ffmpeg - ffmpeg
- findutils - findutils