From c97c2290ebc12182924562385a04ff5f54b57314 Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 3 Jun 2026 22:52:49 -0400 Subject: [PATCH 1/5] feat(shell): add poke function and update fish-deps for ov and yay - Add poke: touch with automatic parent directory creation; prints colored notice when new dirs are created; handles multiple file args - Refactor config.fish CachyOS override block: consolidate copy into the erase+source loop alongside ls/lt/cleanup - fish-deps: replace most with ov (cargo crate + AUR pkg); add yay as rec dep with yay-build special (paru -S yay or AUR makepkg); add update handling for yay-build in _fish_deps_update - README: document poke in Directory & File Listing table --- README.md | 1 + config.fish | 47 +++++++++++-------------------- functions/_fish_deps_catalog.fish | 16 +++++------ functions/_fish_deps_install.fish | 18 ++++++++++++ functions/_fish_deps_update.fish | 15 ++++++++++ functions/poke.fish | 17 +++++++++++ 6 files changed, 76 insertions(+), 38 deletions(-) create mode 100644 functions/poke.fish diff --git a/README.md b/README.md index 25fb07e..a140bfb 100644 --- a/README.md +++ b/README.md @@ -271,6 +271,7 @@ rm -f file.txt # Falls through to standard rm -f | Function | Description | |---|---| | `mkcd ` | Create directory (including missing parents) and `cd` into it | +| `poke ...` | `touch` with automatic parent directory creation; prints a colored notice when new directories are created | | `ls` | `eza` — long listing, all files, icons, color, hyperlinks | | `lss` | `eza` — size-sorted long listing with gradient color scale | | `lsr` | `eza` — reversed time-sorted oneline listing | diff --git a/config.fish b/config.fish index 7e51587..dafaf17 100644 --- a/config.fish +++ b/config.fish @@ -11,16 +11,12 @@ if test -f /usr/share/cachyos-fish-config/cachyos-config.fish # Source our tricks over the cachyOS config test -f "$__fish_config_dir/conf.d/tricks.fish" and source "$__fish_config_dir/conf.d/tricks.fish" - # 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 + # Erase CachyOS aliases/functions that shadow our versions, then + # re-source our versions since functions --erase removes autoload entries. + for _fname in ls lt cleanup copy functions --erase $_fname source "$__fish_config_dir/functions/$_fname.fish" end - # CachyOS defines a broken copy command. - # Override it with our working function. - test -f "$__fish_config_dir/functions/copy.fish" - and source "$__fish_config_dir/functions/copy.fish" end set --erase _fname @@ -50,7 +46,6 @@ set -gx NVIDIA_SETTINGS_RW_CONFIG_FILE "$XDG_CONFIG_HOME/nvidia/settings" set -gx CODEIUM_HOME "$XDG_CONFIG_HOME/codeium" set -gx WORDLIST "$XDG_CONFIG_HOME/hunspell_en_US" -# ───────────────────── Misc Configuration variables ───────────────────── # ─────────────────────────── Pager variables ──────────────────────────── if type -q ov set -gx PAGER ov @@ -133,7 +128,7 @@ if not type -q fisher set --erase _fisher_reply end -# ─────────────────────── visual/interactive setup ─────────────────────── +# ─────────────────────── Visual/Interactive setup ─────────────────────── # Run only if we're in an interactive session (not a script or non-interactive shell) if status is-interactive # ────────────────────────────── Key bindings ──────────────────────────── @@ -173,8 +168,8 @@ if status is-interactive set -gx CLAUDE_CODE_NO_FLICKER 1 # ╭────────────────────────────── OVERRIDES ─────────────────────────────╮ - # | Run these last so they can override any previous settings. | - # | This is useful for machine-specific behavior or configurations. | + # │ Run these last so they can override any previous settings. │ + # │ This is useful for machine-specific behavior or configurations. │ # ╰────────────────────────────── OVERRIDES ─────────────────────────────╯ # # Define user-dots path variable for a more legible secrets/local config. @@ -196,26 +191,18 @@ if status is-interactive test -f "$dot_fish/local.fish"; and source "$dot_fish/local.fish" # # ╭──────────────────────────── END OVERRIDES ──────────────────────────╮ - # | End of override section. | + # │ End of override section. │ # ╰──────────────────────────── END OVERRIDES ──────────────────────────╯ - - # ───────────────────────────────────────────────────────────────────────── - # Tools like starship, zoxide, etc. append init lines below this point via their - # setup commands. We manage all integrations through conf.d/ instead, so we - # return here to prevent injected lines from conflicting with that setup. - # - # This catches injections within the interactive block and - # prevents them from conflicting with our conf.d/ setup. - return # <-- Do not remove this line. - # ───────────────────────────────────────────────────────────────────────── end -# ───────────────────────────────────────────────────────────────────────────── -# Tools like starship, zoxide, etc. append init lines below this point via their -# setup commands. We manage all integrations through conf.d/ instead, so we -# return here to prevent injected lines from conflicting with that setup. -# -# This catches injections outside the interactive block and -# prevents them from conflicting with our conf.d/ setup. return # <-- Do not remove this line. -# ───────────────────────────────────────────────────────────────────────────── +# ╭──────────────────────────────── !!!NOTE!!! ───────────────────────────────╮ +# │ Tools like starship, zoxide, etc. append init lines below this point │ +# │ via their setup commands. We manage these integrations through │ +# │ conf.d/ instead, so we return here to prevent duplicate or conflicting │ +# │ inits from being executed. │ +# │ │ +# │ If a tool's shell integration appears to do nothing, │ +# │ check whether its setup command appended an init line here, │ +# │ then create a conf.d/.fish instead and place the init in that file. │ +# ╰───────────────────────────────────────────────────────────────────────────╯ diff --git a/functions/_fish_deps_catalog.fish b/functions/_fish_deps_catalog.fish index 3f4cea0..89a3023 100644 --- a/functions/_fish_deps_catalog.fish +++ b/functions/_fish_deps_catalog.fish @@ -16,27 +16,27 @@ # uv and cargo are listed first so both are available before fish and other Rust tools. function _fish_deps_catalog set -g _fdc_bins \ - uv cargo fish fisher starship fzf zoxide direnv paru \ + uv cargo fish fisher starship fzf zoxide direnv paru yay \ wakatime tailscale \ - eza lsd bat btop dust duf prettyping most rg lazygit lazydocker trash kitty wezterm + eza lsd bat btop dust duf prettyping ov rg lazygit lazydocker trash kitty wezterm set -g _fdc_tiers \ - req req req req req req req req rec \ + req req req req req req req req rec rec \ int int \ rec rec rec rec rec rec rec rec rec rec rec rec rec rec set -g _fdc_cargo \ - "" "" "" "" starship "" zoxide "" "" \ + "" "" "" "" starship "" zoxide "" "" "" \ "" "" \ - eza lsd bat "" du-dust "" "" "" ripgrep "" "" trashy "" "" + eza lsd bat "" du-dust "" "" ov ripgrep "" "" trashy "" "" set -g _fdc_pm \ - uv cargo fish "" starship fzf zoxide direnv "" \ + uv cargo fish "" starship fzf zoxide direnv "" yay \ wakatime tailscale \ - eza lsd bat btop dust duf prettyping most ripgrep lazygit lazydocker trash kitty wezterm + eza lsd bat btop dust duf prettyping ov ripgrep lazygit lazydocker trash kitty wezterm set -g _fdc_special \ - curl-uv rustup-installer git-cargo-fish fisher-bootstrap curl-installer fzf-update "" "" paru-build \ + curl-uv rustup-installer git-cargo-fish fisher-bootstrap curl-installer fzf-update "" "" paru-build yay-build \ wakatime-binary "" \ "" "" "" "" "" "" "" "" "" "" curl-lazydocker "" "" "" end diff --git a/functions/_fish_deps_install.fish b/functions/_fish_deps_install.fish index 03db4e3..c241935 100644 --- a/functions/_fish_deps_install.fish +++ b/functions/_fish_deps_install.fish @@ -100,6 +100,15 @@ function _fish_deps_install set -a methods special-paru set -a method_labels "build from AUR (makepkg)" end + case yay-build + if type -q paru + set -a methods special-paru-yay + set -a method_labels "paru -S yay" + end + if type -q pacman + set -a methods special-yay + set -a method_labels "build from AUR (makepkg)" + end case pipx if type -q pipx set -a methods special-pipx @@ -202,6 +211,15 @@ function _fish_deps_install end case special-yay-paru yay -S --noconfirm paru + case special-paru-yay + paru -S --noconfirm yay + case special-yay + set -l _build_dir (mktemp -d) + git clone https://aur.archlinux.org/yay.git $_build_dir + and pushd $_build_dir + and makepkg -si --noconfirm + and popd + rm -rf $_build_dir case special-paru set -l _build_dir (mktemp -d) git clone https://aur.archlinux.org/paru.git $_build_dir diff --git a/functions/_fish_deps_update.fish b/functions/_fish_deps_update.fish index 1ae31f7..6d4baae 100644 --- a/functions/_fish_deps_update.fish +++ b/functions/_fish_deps_update.fish @@ -28,6 +28,21 @@ function _fish_deps_update set -l pm_pkg $_fdc_pm[$i] set -l special $_fdc_special[$i] + # yay: update via paru if available, else system PM + if test "$special" = yay-build + if type -q paru + echo "Updating $bin..." + paru -S --noconfirm yay + set updated_any 1 + else if test -n "$pm_pkg"; and test -n "$pm" + echo "Updating $bin..." + _fish_deps_pm_upgrade $pm_pkg + set updated_any 1 + end + set i (math $i + 1) + continue + end + # cargo: update via rustup if test "$special" = rustup-installer if type -q rustup diff --git a/functions/poke.fish b/functions/poke.fish new file mode 100644 index 0000000..2a5a5f0 --- /dev/null +++ b/functions/poke.fish @@ -0,0 +1,17 @@ +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +function poke --description 'touch with automatic parent directory creation' + if test (count $argv) -eq 0 + echo (set_color red)"poke: no file specified"(set_color normal) >&2 + return 1 + end + for _path in $argv + set -l _dir (dirname $_path) + if not test -d $_dir + mkdir -p $_dir + and echo (set_color --bold cyan)"Created: "(set_color cyan)"$_dir"(set_color normal) + end + touch $_path + end +end From e063763c0e47ed4b9e61fb79ab3d840a960e6c9d Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 3 Jun 2026 23:08:56 -0400 Subject: [PATCH 2/5] refactor(shell): extract _fish_mkdir_p utility; improve poke output - Add _fish_mkdir_p: reusable mkdir -p with three output modes: --path (default): "Created: ~/full/path/" on one line --tree: dimmed existing anchor + cyan tree of newly-created dirs --silent: no output HOME is substituted with ~ in all output paths - Refactor poke to delegate to _fish_mkdir_p --tree; removes inline mkdir/echo logic and gains ~ substitution and per-dir tree output --- functions/_fish_mkdir_p.fish | 62 ++++++++++++++++++++++++++++++++++++ functions/poke.fish | 5 +-- 2 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 functions/_fish_mkdir_p.fish diff --git a/functions/_fish_mkdir_p.fish b/functions/_fish_mkdir_p.fish new file mode 100644 index 0000000..eab7375 --- /dev/null +++ b/functions/_fish_mkdir_p.fish @@ -0,0 +1,62 @@ +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +# mkdir -p with configurable output. +# +# Flags: +# --path / -p (default) Print "Created: ~/full/path/" on one line +# --tree / -t Tree view: dimmed existing anchor + cyan new dirs +# --silent / -s No output +# +# Usage: _fish_mkdir_p [--path|--tree|--silent] +function _fish_mkdir_p --description 'mkdir -p with configurable verbose output' + set -l mode path + set -l target + + for _arg in $argv + switch $_arg + case -s --silent + set mode silent + case -t --tree + set mode tree + case -p --path + set mode path + case '*' + set target $_arg + end + end + + test -n "$target"; or return 1 + test -d "$target"; and return 0 + + # Walk up to find deepest existing ancestor; collect dirs to create (shallowest first). + set -l to_create + set -l cursor $target + while not test -d $cursor + set -p to_create $cursor + set -l up (dirname $cursor) + test "$up" = "$cursor"; and break # filesystem root guard + set cursor $up + end + + mkdir -p $target; or return $status + test $mode = silent; and return 0 + + if test $mode = path + set -l display (string replace -- "$HOME" "~" $target)"/" + echo (set_color --bold cyan)"Created: "(set_color cyan)"$display"(set_color normal) + return 0 + end + + # Tree mode: dimmed existing anchor, then cyan new dirs. + echo (set_color --bold cyan)"Created:"(set_color normal) + set -l anchor (string replace -- "$HOME" "~" $cursor)"/" + echo (set_color brblack)" $anchor"(set_color normal) + set -l i 1 + while test $i -le (count $to_create) + set -l spaces (string repeat -n (math "($i - 1) * 4") " ") + set -l name (basename $to_create[$i])"/" + echo (set_color cyan)" $spaces└── $name"(set_color normal) + set i (math $i + 1) + end +end diff --git a/functions/poke.fish b/functions/poke.fish index 2a5a5f0..76f10b7 100644 --- a/functions/poke.fish +++ b/functions/poke.fish @@ -8,10 +8,7 @@ function poke --description 'touch with automatic parent directory creation' end for _path in $argv set -l _dir (dirname $_path) - if not test -d $_dir - mkdir -p $_dir - and echo (set_color --bold cyan)"Created: "(set_color cyan)"$_dir"(set_color normal) - end + _fish_mkdir_p --tree $_dir touch $_path end end From 4df10a7a2cc4919e21979174aa72db986185a571 Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 3 Jun 2026 23:11:02 -0400 Subject: [PATCH 3/5] fix(shell): clarify poke tree header to 'Created missing directories:' --- functions/_fish_mkdir_p.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/_fish_mkdir_p.fish b/functions/_fish_mkdir_p.fish index eab7375..21507ad 100644 --- a/functions/_fish_mkdir_p.fish +++ b/functions/_fish_mkdir_p.fish @@ -49,7 +49,7 @@ function _fish_mkdir_p --description 'mkdir -p with configurable verbose output' end # Tree mode: dimmed existing anchor, then cyan new dirs. - echo (set_color --bold cyan)"Created:"(set_color normal) + echo (set_color --bold cyan)"Created missing directories:"(set_color normal) set -l anchor (string replace -- "$HOME" "~" $cursor)"/" echo (set_color brblack)" $anchor"(set_color normal) set -l i 1 From c2afa1201f78726136db4738dfbe51ca4ebad8c0 Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 3 Jun 2026 23:22:30 -0400 Subject: [PATCH 4/5] feat(shell): integrate _fish_mkdir_p into mkdir and mkcd - mkdir: loop over path args calling _fish_mkdir_p --path; falls back to command mkdir -p when flag args (e.g. -m 755) are present - mkcd: default to _fish_mkdir_p --tree for new dirs; add -s/--silent flag to suppress tree output (mkcd's own status message still prints) --- functions/_fish_mkdir_p.fish | 4 ++-- functions/mkcd.fish | 21 ++++++++++++++++----- functions/mkdir.fish | 11 ++++++++++- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/functions/_fish_mkdir_p.fish b/functions/_fish_mkdir_p.fish index 21507ad..1943893 100644 --- a/functions/_fish_mkdir_p.fish +++ b/functions/_fish_mkdir_p.fish @@ -44,12 +44,12 @@ function _fish_mkdir_p --description 'mkdir -p with configurable verbose output' if test $mode = path set -l display (string replace -- "$HOME" "~" $target)"/" - echo (set_color --bold cyan)"Created: "(set_color cyan)"$display"(set_color normal) + echo (set_color --bold cyan)"Created directory: "(set_color cyan)"$display"(set_color normal) return 0 end # Tree mode: dimmed existing anchor, then cyan new dirs. - echo (set_color --bold cyan)"Created missing directories:"(set_color normal) + echo (set_color --bold yellow)"Created directories:"(set_color normal) set -l anchor (string replace -- "$HOME" "~" $cursor)"/" echo (set_color brblack)" $anchor"(set_color normal) set -l i 1 diff --git a/functions/mkcd.fish b/functions/mkcd.fish index 9a06fe1..fcc3bd9 100644 --- a/functions/mkcd.fish +++ b/functions/mkcd.fish @@ -22,6 +22,7 @@ function mkcd --description 'Create a directory (with parents) and cd into it' echo echo "$c_head""Flags:$c_rst" echo " $c_flag-h$c_rst, $c_flag--help$c_rst Show this help message" + echo " $c_flag-s$c_rst, $c_flag--silent$c_rst Suppress directory creation output" echo echo "$c_head""Examples:$c_rst" echo " $c_cmd""mkcd$c_rst $c_arg~/projects/myapp$c_rst" @@ -29,13 +30,23 @@ function mkcd --description 'Create a directory (with parents) and cd into it' return 0 end - set -l dir $argv[1] + set -l silent 0 + set -l dir + for _arg in $argv + switch $_arg + case -s --silent + set silent 1 + case '*' + set dir $_arg + end + end set -l is_new 0 - if not test -d $dir - set is_new 1 - command mkdir -p $dir - or return $status + test -d $dir; or set is_new 1 + if test $silent -eq 1 + _fish_mkdir_p --silent $dir; or return $status + else + _fish_mkdir_p --tree $dir; or return $status end cd $dir diff --git a/functions/mkdir.fish b/functions/mkdir.fish index 541c2a9..4f768b8 100644 --- a/functions/mkdir.fish +++ b/functions/mkdir.fish @@ -4,7 +4,16 @@ # Execute mkdir function mkdir --description 'Execute mkdir' if status is-interactive - command mkdir -p $argv + # Fall back to command mkdir -p when flags are present (e.g. -m 755) + for _arg in $argv + if string match -q -- '-*' $_arg + command mkdir -p $argv + return $status + end + end + for _dir in $argv + _fish_mkdir_p --path $_dir + end else command mkdir $argv end From 13b9ba58286be19d1ee7c1aa06f7a7c3e0af46e9 Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 3 Jun 2026 23:24:29 -0400 Subject: [PATCH 5/5] docs(readme): update mkdir, mkcd, poke entries for _fish_mkdir_p integration --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a140bfb..ffa0abc 100644 --- a/README.md +++ b/README.md @@ -241,7 +241,7 @@ These functions wrap modern alternatives with graceful fallbacks to standard too | `rg` | `rg` | ripgrep with `--hyperlink-format=kitty` | | `ssh` | `ssh` | `kitten ssh` when inside Kitty | | `du` | `du` | `duf` (disks) / `dust` (directories) — auto-detected by argument | -| `mkdir` | `mkdir` | Always passes `-p` in interactive mode | +| `mkdir` | `mkdir` | Always passes `-p` in interactive mode; reports created directories as `Created directory: ~/path/` (falls back silently when flags like `-m` are present) | | `copy` | `cp` | Strips trailing `/` from a source directory before `cp -r`; falls through to `cp` for all other cases | #### `du` — Smart Disk Usage @@ -270,8 +270,8 @@ rm -f file.txt # Falls through to standard rm -f | Function | Description | |---|---| -| `mkcd ` | Create directory (including missing parents) and `cd` into it | -| `poke ...` | `touch` with automatic parent directory creation; prints a colored notice when new directories are created | +| `mkcd [-s]` | Create directory (including missing parents) and `cd` into it; shows a tree of newly-created dirs by default; `-s`/`--silent` suppresses the tree | +| `poke ...` | `touch` with automatic parent directory creation; shows a tree of newly-created dirs | | `ls` | `eza` — long listing, all files, icons, color, hyperlinks | | `lss` | `eza` — size-sorted long listing with gradient color scale | | `lsr` | `eza` — reversed time-sorted oneline listing |