From 01c22e7a4d0d130d89b66b3890e335e121926346 Mon Sep 17 00:00:00 2001 From: rootiest Date: Sun, 26 Apr 2026 02:35:27 -0400 Subject: [PATCH] feat: prefer eza over lsd in all ls-related functions fix: clean stale wraps metadata fix: ensure user functions take precedence over CachyOS overrides --- config.fish | 12 +++++++++++- functions/l.fish | 6 ++++-- functions/lS.fish | 6 ++++-- functions/llm.fish | 8 +++++--- functions/ls.fish | 7 +++++-- functions/lstree.fish | 6 ++++-- functions/lt.fish | 6 ++++-- functions/ltr.fish | 10 ++++++++-- 8 files changed, 45 insertions(+), 16 deletions(-) diff --git a/config.fish b/config.fish index d8a2656..4e648de 100644 --- a/config.fish +++ b/config.fish @@ -6,7 +6,17 @@ # ╰──────────────────────────────────────────────────────────╯ # ──────────────────────── Source CachyOS configs ──────────────────────── -source /usr/share/cachyos-fish-config/cachyos-config.fish +if test -f /usr/share/cachyos-fish-config/cachyos-config.fish + source /usr/share/cachyos-fish-config/cachyos-config.fish +end + +# CachyOS defines aliases for ls/lt/cleanup that shadow our function files. +# Erase them and immediately source our versions. +for _fname in ls lt cleanup + functions --erase $_fname + source $__fish_config_dir/functions/$_fname.fish +end +set --erase _fname # ───────────────────────── Source user secrets ────────────────────────── if test -f $HOME/.config/.user-dots/fish/secrets.fish diff --git a/functions/l.fish b/functions/l.fish index b2dabf2..e585b62 100644 --- a/functions/l.fish +++ b/functions/l.fish @@ -1,8 +1,10 @@ # Copyright (C) 2026 Rootiest # SPDX-License-Identifier: AGPL-3.0-or-later -function l --wraps='lsd --almost-all --long' --description 'alias l=lsd --almost-all --long' - if which lsd >/dev/null 2>&1 +function l --description 'Long listing, all files' + if which eza >/dev/null 2>&1 + eza --all --long --git --header --icons --color=auto --hyperlink $argv + else if which lsd >/dev/null 2>&1 lsd --almost-all --long --git --header --hyperlink=auto $argv else command ls --color=auto --almost-all -l $argv diff --git a/functions/lS.fish b/functions/lS.fish index 46acb2a..9947263 100644 --- a/functions/lS.fish +++ b/functions/lS.fish @@ -1,8 +1,10 @@ # Copyright (C) 2026 Rootiest # SPDX-License-Identifier: AGPL-3.0-or-later -function lS --wraps='lsd --oneline --classic' --description 'alias lS=lsd --oneline --classic' - if which lsd >/dev/null 2>&1 +function lS --description 'Size-sorted listing' + if which eza >/dev/null 2>&1 + eza --sort=size --icons --color=auto --hyperlink $argv + else if which lsd >/dev/null 2>&1 lsd --oneline --classic $argv else command ls $argv diff --git a/functions/llm.fish b/functions/llm.fish index 0dbcce3..2239bf5 100644 --- a/functions/llm.fish +++ b/functions/llm.fish @@ -1,10 +1,12 @@ # Copyright (C) 2026 Rootiest # SPDX-License-Identifier: AGPL-3.0-or-later -function llm --wraps='lsd --timesort --long' --description 'alias llm=lsd --timesort --long' - if which lsd >/dev/null 2>&1 +function llm --description 'Long listing sorted by modification time' + if which eza >/dev/null 2>&1 + eza --long --sort=modified --git --header --icons --color=auto --hyperlink $argv + else if which lsd >/dev/null 2>&1 lsd --timesort --long --git --header --hyperlink=auto $argv else - command ls color=auto -l $argv + command ls --color=auto -lt $argv end end diff --git a/functions/ls.fish b/functions/ls.fish index e00f49c..4ab1c29 100644 --- a/functions/ls.fish +++ b/functions/ls.fish @@ -1,8 +1,11 @@ # Copyright (C) 2026 Rootiest # SPDX-License-Identifier: AGPL-3.0-or-later -function ls --wraps=lsd --wraps='lsd --hyperlink=auto' --description 'alias ls=lsd' - if which lsd >/dev/null 2>&1 +function ls --description 'List files' + if which eza >/dev/null 2>&1 + eza --oneline --icons --color=auto --hyperlink $argv + + else if which lsd >/dev/null 2>&1 lsd --hyperlink=auto $argv else command ls --color=auto $argv diff --git a/functions/lstree.fish b/functions/lstree.fish index 417378e..e56c363 100644 --- a/functions/lstree.fish +++ b/functions/lstree.fish @@ -1,8 +1,10 @@ # Copyright (C) 2026 Rootiest # SPDX-License-Identifier: AGPL-3.0-or-later -function lstree --wraps='ls --tree' --description 'alias lstree=ls --tree' - if which lsd >/dev/null 2>&1 +function lstree --description 'Full recursive tree listing' + if which eza >/dev/null 2>&1 + eza --tree --icons --color=auto --hyperlink $argv + else if which lsd >/dev/null 2>&1 lsd --tree --hyperlink=auto $argv else command ls --color=auto -R $argv diff --git a/functions/lt.fish b/functions/lt.fish index da7b0b9..e32a25b 100644 --- a/functions/lt.fish +++ b/functions/lt.fish @@ -1,8 +1,10 @@ # Copyright (C) 2026 Rootiest # SPDX-License-Identifier: AGPL-3.0-or-later -function lt --wraps='lsd --tree --depth=2' --description 'alias lt=lsd --tree --depth=2' - if which lsdq >/dev/null 2>&1 +function lt --description 'Tree listing, depth 2' + if which eza >/dev/null 2>&1 + eza --tree --level=2 --icons --color=auto --hyperlink $argv + else if which lsd >/dev/null 2>&1 lsd --tree --depth=2 --hyperlink=auto $argv else command ls --color=auto -R $argv diff --git a/functions/ltr.fish b/functions/ltr.fish index 977de61..a46bf49 100644 --- a/functions/ltr.fish +++ b/functions/ltr.fish @@ -1,6 +1,12 @@ # Copyright (C) 2026 Rootiest # SPDX-License-Identifier: AGPL-3.0-or-later -function ltr --wraps='lsd -ltr' --description 'alias ltr=lsd -ltr' - lsd -ltr $argv +function ltr --description 'Reversed time-sorted listing' + if which eza >/dev/null 2>&1 + eza --long --sort=modified --reverse --icons --color=auto --hyperlink $argv + else if which lsd >/dev/null 2>&1 + lsd -ltr $argv + else + command ls --color=auto -ltr $argv + end end