zsh: exa -> lsd

parent 1206b88c
......@@ -86,7 +86,7 @@ brew "proselint"
brew "task"
brew "tldr"
brew "bat"
brew "exa"
brew "lsd"
brew "grc"
brew "shellcheck"
brew "shfmt" # Doesn't work with zsh, only sh & bash
......
......@@ -148,27 +148,6 @@ function {
export RIPGREP_CONFIG_PATH="${HOME}/.rgrc"
export WEECHAT_PASSPHRASE=`security find-generic-password -g -a weechat 2>&1| perl -e 'if (<STDIN> =~ m/password: \"(.*)\"$/ ) { print $1; }'`
############### Exa
# di directories
# ex executable files
# fi regular files
# ln symlinks
# ur,uw,ux user permissions
# gr,gw,gx group permissions
# tr,tw,tx others permissions
# sn the numbers of a file's size
# sb the units of a file's size
# uu user that is you
# un user that is someone else
# gu a group that you belong to
# gn a group you aren't a member of
# ga new file in Git
# gm a modified file in Git
# gd a deleted file in Git
# gv a renamed file in Git
# da a file's date
export EXA_COLORS="uu=38;5;249:un=38;5;241:gu=38;5;245:gn=38;5;241:da=38;5;245:sn=38;5;7:sb=38;5;7:ur=38;5;3;1:uw=38;5;5;1:ux=38;5;1;1:ue=38;5;1;1:gr=38;5;3:gw=38;5;5:gx=38;5;1:tr=38;5;3:tw=38;5;1:tx=38;5;1:di=38;5;12:ex=38;5;7;1:*.md=38;5;229;4:*.png=38;5;208:*.jpg=38;5;208:*.gif=38;5;208"
############### Direnv
export N_PREFIX="${HOME}/.n"
export NODE_VERSIONS="${N_PREFIX}/n/versions/node"
......
......@@ -13,12 +13,13 @@ alias history='fc -il 1'
(( $+commands[htop] )) && alias top=htop
if (( $+commands[exa] )); then
alias ll="exa --tree --all --group-directories-first"
if (( $+commands[lsd] )); then
alias ls="lsd "
alias ll="lsd --tree --almost-all --group-dirs first "
elif (( $+commands[tree] )); then
alias ll="type tree >/dev/null && tree --dirsfirst -a -L 1 || l -d .*/ */ "
else
alias ll="echo 'You have to install exa or tree'"
alias ll="echo 'You have to install lsd or tree'"
fi
# TERMINAL
......
......@@ -4,37 +4,38 @@ emulate -L zsh
unalias l 2> /dev/null
l(){
if (( $+commands[exa] )); then
if [[ "$1" == '--help' ]]; then
exa --help
else
exa --all --long --header --links --color-scale --group-directories-first --sort=type "$@"
fi
elif [[ -x "${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin/ls" ]]; then
# https://github.com/paulirish/dotfiles/blob/7c46f8c25015c2632894dbe5fea20014ab37fd89/.functions#L14-L25
# [TODO]: Check why this is not picked up from $PATH?
${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin/ls --almost-all -l --human-readable --classify -alph --group-directories-first --color=always "$@" | awk '
{
k=0;
for (i=0;i<=8;i++)
k+=((substr($1,i+2,1)~/[rwx]/) *2^(8-i));
if (k)
printf("%0o ",k);
printf(" %9s %3s %2s %5s %6s %s %s %s\n", $3, $6, $7, $8, $5, $9,$10, $11);
}'
if [[ $# -eq 1 && -f $1 ]]; then
if (( $+commands[bat] )); then
bat "$1"
else
# List all files, long format, colorized, permissions in octal
ls -l "$@" | awk '
{
k=0;
for (i=0;i<=8;i++)
k+=((substr($1,i+2,1)~/[rwx]/) *2^(8-i));
if (k)
printf("%0o ",k);
printf(" %9s %3s %2s %5s %6s %s %s %s\n", $3, $6, $7, $8, $5, $9,$10, $11);
}'
less "$1"
fi
}
return
fi
l "$@"
if (( $+commands[lsd] )); then
lsd --almost-all --long --group-dirs first --timesort "$@"
elif [[ -x "${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin/ls" ]]; then
# https://github.com/paulirish/dotfiles/blob/7c46f8c25015c2632894dbe5fea20014ab37fd89/.functions#L14-L25
# [TODO]: Check why this is not picked up from $PATH?
${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin/ls --almost-all -l --human-readable --classify -alph --group-directories-first --color=always "$@" | awk '
{
k=0;
for (i=0;i<=8;i++)
k+=((substr($1,i+2,1)~/[rwx]/) *2^(8-i));
if (k)
printf("%0o ",k);
printf(" %9s %3s %2s %5s %6s %s %s %s\n", $3, $6, $7, $8, $5, $9,$10, $11);
}'
else
# List all files, long format, colorized, permissions in octal
ls -l "$@" | awk '
{
k=0;
for (i=0;i<=8;i++)
k+=((substr($1,i+2,1)~/[rwx]/) *2^(8-i));
if (k)
printf("%0o ",k);
printf(" %9s %3s %2s %5s %6s %s %s %s\n", $3, $6, $7, $8, $5, $9,$10, $11);
}'
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment