diff options
| author | Deposite Pirate | 2025-12-04 21:35:59 +0100 |
|---|---|---|
| committer | Deposite Pirate | 2025-12-04 21:35:59 +0100 |
| commit | ca8316b835874f77eb87b77f179ae470d65bea4e (patch) | |
| tree | d702823a91dd1f43b272785dc33496400c968da1 /conf.d | |
| parent | 2d6303ae1a268a25f074736fb972fb3edfe4908c (diff) | |
Refactor ls handling
Refactor ls handling and integrate eza.
modified: conf.d/02platform.fish
Diffstat (limited to 'conf.d')
| -rw-r--r-- | conf.d/02platform.fish | 87 |
1 files changed, 64 insertions, 23 deletions
diff --git a/conf.d/02platform.fish b/conf.d/02platform.fish index a3c8e69..bd0f9f8 100644 --- a/conf.d/02platform.fish +++ b/conf.d/02platform.fish @@ -1,6 +1,6 @@ if status is-interactive - ### Functions + ## Functions function handle_colorls if command -sq colorls @@ -16,30 +16,41 @@ if status is-interactive end end - ### All platforms + function handle_eza + switch $TERM + case 'xterm-256color' + set -f icons 'yes' + case 'xterm-ghostty' + set -f icons 'yes' + case 'xterm-kitty' + set -f icons 'yes' + case 'tmux-256color' + set -f icons 'yes' + case 'foot' + set -f icons 'yes' + case 'xterm' + set -f icons 'no' + case '*' + set -f icons 'no' + end - alias_if doas sudo + if string match -q -e 'XTerm/OpenBSD' $XTERM_VERSION + set -f icons 'no' + end - alias l 'ls' - alias md 'mkdir' - alias rd 'rmdir' - alias du 'du -h' + if string match -q -e 'yes' $icons + alias ls 'eza --icons --group' + alias la 'eza --icons --all' + else + alias ls 'eza --group' + alias la 'eza --all' + end - if command -sq tree - alias lta 'tree -a' - alias llta 'tree -apugsh' - end - - if command -sq git - alias fishupd 'pushd ~/.config/fish ; git pull ; popd' - end - - # process viewer to look for by order of preference - set topprg 'htop' 'btop' - set found_topprg (find_prog $topprg) - - if test -n "$found_topprg" - alias top "$found_topprg" + alias ll 'eza --long --group' + alias lt 'eza --tree' + alias lta 'eza --all --tree' + alias lla 'eza --all --long --group' + alias llta 'eza --all --tree --long --group' end ### Linux @@ -295,7 +306,7 @@ if status is-interactive alias pkgclean 'doas pkg clean -a' end - end # handle_openbsd + end # handle_freebsd switch (uname) case 'Linux' @@ -310,4 +321,34 @@ if status is-interactive handle_freebsd end + ## All platforms + + if command -sq 'eza' + handle_eza + else + if command -sq tree + alias lta 'tree -a' + alias llta 'tree -apugsh' + end + end + + alias l 'ls' + alias md 'mkdir' + alias rd 'rmdir' + alias du 'du -h' + + alias_if doas sudo + + if command -sq git + alias fishupd 'pushd ~/.config/fish ; git pull ; popd' + end + + # process viewer to look for by order of preference + set topprg 'htop' 'btop' + set found_topprg (find_prog $topprg) + + if test -n "$found_topprg" + alias top "$found_topprg" + end + end |
