Compare commits
41 Commits
9467d2c206
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e766b3326 | |||
|
a7510cc8ea
|
|||
|
a351e62a17
|
|||
|
7936a0966e
|
|||
|
fee2d99bea
|
|||
|
7d4e33bc7e
|
|||
|
782ef833c2
|
|||
|
8917442089
|
|||
|
8d9e7ae43f
|
|||
|
9e7539d863
|
|||
|
6fd1e3221e
|
|||
|
df7c921bc6
|
|||
|
abbbf20b40
|
|||
|
a70e88c344
|
|||
|
a7c6b9097d
|
|||
|
0e7e824085
|
|||
|
a3d99eec3f
|
|||
|
a86f797627
|
|||
|
1a6f1f3f2c
|
|||
|
b82766ad52
|
|||
|
9b342114aa
|
|||
|
f09006846b
|
|||
|
2df665a537
|
|||
|
46be262f92
|
|||
| a442315312 | |||
|
6530935652
|
|||
|
bdbdf2e8e0
|
|||
|
d7471e2eca
|
|||
|
7acd099b3e
|
|||
|
e502cff8cb
|
|||
| 50979acc1f | |||
|
4aea2f4e2c
|
|||
| be051daf1e | |||
|
05139354cf
|
|||
|
d2e7c799c4
|
|||
| 233d75434c | |||
|
520217d4a9
|
|||
|
4e255f4502
|
|||
|
6d91f49521
|
|||
|
2e3230974c
|
|||
|
f93f9844dc
|
@@ -36,3 +36,10 @@ OLD/
|
||||
# Auto-managed by fish; contains machine-local state and universal vars
|
||||
fish_variables
|
||||
.claude
|
||||
|
||||
# Personal testing/temporary files
|
||||
[Tt][Mm][Pp]/
|
||||
[Tt][Ee][Mm][Pp]/
|
||||
[Tt][Ee][Mm][Pp][Oo][Rr][Aa][Rr][Yy]/
|
||||
[Tt][Ee][Ss][Tt][Ii][Nn][Gg]/
|
||||
[Dd][Ee][Bb][Uu][Gg]/
|
||||
|
||||
@@ -15,7 +15,7 @@ A feature-rich Fish shell configuration for CachyOS (Arch Linux), built around a
|
||||
- [Dependencies](#dependencies)
|
||||
- [Installation](#installation)
|
||||
- [Personalization](#personalization)
|
||||
- [Full Requirements](#full-requirements)
|
||||
- [Attribution](#attribution)
|
||||
- [License](#license)
|
||||
|
||||
---
|
||||
@@ -103,11 +103,19 @@ See [FZF Bindings](#fzf-bindings) under Key Bindings for the default FZF shortcu
|
||||
|
||||
## Integrations
|
||||
|
||||
> **Note:** All integrations listed below are designed to gracefully fallback to basic commands or safely ignore their configuration if their required external dependencies are not installed on the system.
|
||||
> [!NOTE]
|
||||
> All integrations listed below are designed to gracefully fallback to basic commands or safely ignore their configuration if their required external dependencies are not installed on the system.
|
||||
|
||||
### Zoxide
|
||||
|
||||
Smart `cd` replacement. `cd` (or `z`) `<keyword>` jumps to the best frecency match; `cdi` (or `zi`) opens an interactive selector.
|
||||
Smart `cd` replacement powered by frecency scoring. `cd`, `z`, and `cdi`/`zi` are all mapped to zoxide-backed navigation functions.
|
||||
|
||||
| Command | Description |
|
||||
|---|---|
|
||||
| `cd <path>` / `z <path>` | Jump to a matching directory by frecency; falls back to exact path |
|
||||
| `cdi` / `zi` | Open an interactive fzf selector across all frecency-ranked directories |
|
||||
|
||||
Tab completions for `cd` and `z` blend standard directory entries (CWD and `CDPATH`) with zoxide frecency results, so familiar paths and frequently-visited destinations appear together in a single list. Full tab completions for the `zoxide` CLI itself (subcommands: `add`, `query`, `remove`, `import`, `init`) are provided via `completions/zoxide.fish`.
|
||||
|
||||
### DirEnv
|
||||
|
||||
@@ -115,7 +123,11 @@ Automatically loads `.envrc` files on directory change. Takes priority over the
|
||||
|
||||
### Auto Python Venv
|
||||
|
||||
When entering a directory containing a `.venv/`, the virtualenv is automatically activated. It is deactivated when you leave the project tree. DirEnv-managed directories are skipped to avoid conflicts.
|
||||
When entering a directory containing a `.venv/`, the virtualenv is automatically activated.
|
||||
It is automatically deactivated when you leave the project tree.
|
||||
|
||||
> [!TIP]
|
||||
> DirEnv-managed directories are skipped by the auto-venv logic to avoid conflicts.
|
||||
|
||||
### WakaTime
|
||||
|
||||
@@ -229,6 +241,24 @@ rm -f file.txt # Falls through to standard rm -f
|
||||
| `upgrade` | Full system upgrade: `paru -Syu --noconfirm` |
|
||||
| `cleanup` | Log and remove orphaned packages |
|
||||
|
||||
### Dependency Management
|
||||
|
||||
`fish-deps` is a unified command for checking, installing, and updating all tools this config depends on.
|
||||
|
||||
| Command | Description |
|
||||
|---|---|
|
||||
| `fish-deps` / `fish-deps status` | Show installed/missing status for all deps, grouped by tier |
|
||||
| `fish-deps install` | Interactively install each missing dep (prompts per-dep, prompts method when multiple exist) |
|
||||
| `fish-deps update` | Update all installed deps using their preferred install method |
|
||||
| `fish-deps sync` | Install missing deps then update installed ones |
|
||||
| `fzf-update` | Install or upgrade fzf from git HEAD into `~/.fzf` (guarantees the latest build) |
|
||||
| `check_fish_deps` | Legacy alias — delegates to `fish-deps status` |
|
||||
|
||||
Install method priority: **git+cargo source build** (fish) → **cargo** (other Rust tools, gets latest crate) → **system PM** (paru/apt/brew/etc.) → **git clone** (fzf) → **curl installer** (starship, fisher) → **pipx** (Python tools). When multiple methods are available for a tool, you are prompted to choose.
|
||||
|
||||
> [!NOTE]
|
||||
> Upgrading Fish from source requires **cargo** and **[uv](https://docs.astral.sh/uv/)**. Both are managed dependencies — `fish-deps install` will offer to install them before attempting the Fish build. If both are unavailable, `fish-deps update` falls back to the system package manager.
|
||||
|
||||
### Docker
|
||||
|
||||
| Function | Description |
|
||||
@@ -464,20 +494,27 @@ Named context shortcuts (e.g. `dcr`, `dck`) live in `~/.config/.user-dots/fish/l
|
||||
|
||||
### Required
|
||||
|
||||
| Tool | Purpose |
|
||||
|---|---|
|
||||
| [Fish](https://fishshell.com/) | Shell |
|
||||
| [Fisher](https://github.com/jorgebucaran/fisher) | Plugin manager |
|
||||
| [Starship](https://starship.rs/) | Prompt |
|
||||
| [fzf](https://github.com/junegunn/fzf) | Fuzzy finder |
|
||||
| [zoxide](https://github.com/ajeetdsouza/zoxide) | Smart directory jumper |
|
||||
| [direnv](https://direnv.net/) | Per-directory env loading |
|
||||
| [paru](https://github.com/Morganamilo/paru) | AUR helper |
|
||||
| Tool | Version | Purpose |
|
||||
|---|---|---|
|
||||
| [uv](https://docs.astral.sh/uv/) | any | Python runner (needed to build Fish from source) |
|
||||
| [Rust / cargo](https://www.rust-lang.org/tools/install) | any | Installs Rust-based tools; required to build Fish |
|
||||
| [Fish](https://fishshell.com/) | **≥ 4.0** | Shell |
|
||||
| [Fisher](https://github.com/jorgebucaran/fisher) | any | Plugin manager |
|
||||
| [Starship](https://starship.rs/) | any | Prompt |
|
||||
| [fzf](https://github.com/junegunn/fzf) | any | Fuzzy finder |
|
||||
| [zoxide](https://github.com/ajeetdsouza/zoxide) | any | Smart directory jumper |
|
||||
| [direnv](https://direnv.net/) | any | Per-directory env loading |
|
||||
|
||||
> [!WARNING]
|
||||
> Fish **4.0 or newer is required.** This config uses `test` syntax and other constructs that are incompatible with Fish 3.x. Older versions will produce errors on startup.
|
||||
> Run `fish-deps install` or `fish-deps update` to upgrade — it will install `uv` and `cargo` automatically if missing, then build the latest Fish from source.
|
||||
|
||||
### Recommended
|
||||
|
||||
| Tool | Replaces |
|
||||
|---|---|
|
||||
| [Rust / cargo](https://www.rust-lang.org/tools/install) | Build tool for Rust-based CLI replacements below |
|
||||
| [paru](https://github.com/Morganamilo/paru) / [yay](https://github.com/Jguer/yay) | AUR helper (Arch only) |
|
||||
| [eza](https://github.com/eza-community/eza) | `ls` (preferred) |
|
||||
| [lsd](https://github.com/lsd-rs/lsd) | `ls` (fallback) |
|
||||
| [bat](https://github.com/sharkdp/bat) | `cat` |
|
||||
@@ -493,6 +530,10 @@ Named context shortcuts (e.g. `dcr`, `dck`) live in `~/.config/.user-dots/fish/l
|
||||
| [Kitty](https://sw.kovidgoyal.net/kitty/) / [WezTerm](https://wezfurlong.org/wezterm/) | Terminal emulator |
|
||||
| [WakaTime](https://wakatime.com/) | Activity tracking |
|
||||
|
||||
### Full Requirements
|
||||
|
||||
For a complete, categorized list of all non-standard tools required or used by this configuration, see [requirements.md](requirements.md).
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
@@ -512,7 +553,6 @@ Then open a new Fish shell — Fisher and all plugins will be installed automati
|
||||
A [chezmoi](https://www.chezmoi.io/) dotfile manager is also configured — secrets are sourced from `~/.config/.user-dots/fish/secrets.fish` and excluded from version control.
|
||||
|
||||
---
|
||||
|
||||
## Personalization
|
||||
|
||||
Sensitive credentials and machine-specific paths are kept out of version control via a secondary private directory at `~/.config/.user-dots/fish/`. Two files are sourced automatically by `config.fish` if they exist:
|
||||
@@ -585,9 +625,9 @@ end
|
||||
|
||||
---
|
||||
|
||||
## Full Requirements
|
||||
## Attribution
|
||||
|
||||
For a complete, categorized list of all non-standard tools required or used by this configuration, see [requirements.md](requirements.md).
|
||||
The core of the [Zoxide integration](#zoxide) in this repository was originally adapted from the [icezyclon/zoxide.fish](https://github.com/icezyclon/zoxide.fish) plugin (MIT Licensed) and has since been heavily customized for performance and Fish 4.x compatibility.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
# Sourced from icezyclon/zoxide.fish (MIT)
|
||||
|
||||
set -l commands add help import init query remove
|
||||
|
||||
# disable normal all-files completion
|
||||
complete -c zoxide -f
|
||||
|
||||
# onyl show base options if none was used already
|
||||
complete -c zoxide -n __fish_use_subcommand -a add -d "Add a new directory or increment its rank"
|
||||
complete -c zoxide -n __fish_use_subcommand -a help -d "Prints this message or the help of the given subcommand(s)"
|
||||
complete -c zoxide -n __fish_use_subcommand -a import -d "Import from z database"
|
||||
complete -c zoxide -n __fish_use_subcommand -a init -d "Generates shell configuration"
|
||||
complete -c zoxide -n __fish_use_subcommand -a query -d "Search for a directory"
|
||||
complete -c zoxide -n __fish_use_subcommand -a remove -d "Remove a directory"
|
||||
|
||||
# zoxide add
|
||||
complete -c zoxide -n "_zoxide_equals_first_token add" -n "__fish_is_nth_token 2" -a "(__fish_complete_directories)"
|
||||
|
||||
# zoxide help
|
||||
complete -c zoxide -n "_zoxide_equals_first_token help" -n "__fish_is_nth_token 2" -a "$commands"
|
||||
|
||||
# zoxide import
|
||||
complete -c zoxide -r -F -n "_zoxide_equals_first_token import" -n "__fish_is_nth_token 2"
|
||||
complete -c zoxide -r -n "_zoxide_equals_first_token import" -l merge -d "Merge entries into existing database"
|
||||
|
||||
# zoxide init
|
||||
set -l initshells bash fish posix powershell zsh
|
||||
complete -c zoxide -n "_zoxide_equals_first_token init" -n "__fish_is_nth_token 2" -a "$initshells"
|
||||
complete -c zoxide -n "_zoxide_equals_first_token init" -l cmd -d "Renames the 'z' command and corresponding aliases [default: z]"
|
||||
complete -c zoxide -n "_zoxide_equals_first_token init" -l hook -a "none prompt pwd" -d "Chooses event on which an entry is added to the database [default: pwd]"
|
||||
complete -c zoxide -n "_zoxide_equals_first_token init" -l no-aliases -d "Prevents zoxide from defining any commands other than 'z'"
|
||||
|
||||
# zoxide query
|
||||
complete -c zoxide -r -n "_zoxide_equals_first_token query" -s i -l interactive -d "Opens an interactive selection menu using fzf"
|
||||
complete -c zoxide -r -n "_zoxide_equals_first_token query" -s l -l list -d "List all matching directories"
|
||||
complete -c zoxide -r -n "_zoxide_equals_first_token query" -s s -l score -d "Display score along with result"
|
||||
|
||||
# zoxide remove
|
||||
complete -c zoxide -n "_zoxide_equals_first_token remove" -n "__fish_is_nth_token 2" -a "(zoxide query -l)"
|
||||
|
||||
# Always possible
|
||||
complete -c zoxide -x -s h -l help -d "Prints help information"
|
||||
complete -c zoxide -x -s V -l version -d "Prints version information"
|
||||
+2
-1
@@ -9,7 +9,8 @@ end
|
||||
# This variable is global so that it can be referenced by fzf_configure_bindings and in tests
|
||||
set --global _fzf_search_vars_command '_fzf_search_variables (set --show | psub) (set --names | psub)'
|
||||
|
||||
# Install the default bindings, which are mnemonic and minimally conflict with fish's preset bindings
|
||||
# Install the default bindings only if fzf is available
|
||||
type -q fzf || exit
|
||||
fzf_configure_bindings
|
||||
|
||||
# Doesn't erase autoloaded _fzf_* functions because they are not easily accessible once key bindings are erased
|
||||
|
||||
@@ -52,7 +52,7 @@ function fish_user_key_bindings
|
||||
bind ctrl-g __insert_previous_path_head
|
||||
bind ctrl-f __interactive_history_sub
|
||||
bind ctrl-alt-u _replace_command_token
|
||||
bind ctrl-alt-= _qalc_eval
|
||||
type -q qalc && bind ctrl-alt-= _qalc_eval
|
||||
bind ctrl-enter _smart_execute
|
||||
|
||||
# Set bindings for all Vi modes:
|
||||
@@ -61,7 +61,7 @@ function fish_user_key_bindings
|
||||
bind --mode $mode ctrl-g __insert_previous_path_head
|
||||
bind --mode $mode ctrl-f __interactive_history_sub
|
||||
bind --mode $mode ctrl-alt-u _replace_command_token
|
||||
bind --mode $mode ctrl-alt-= _qalc_eval
|
||||
type -q qalc && bind --mode $mode ctrl-alt-= _qalc_eval
|
||||
bind --mode $mode ctrl-enter _smart_execute
|
||||
end
|
||||
end
|
||||
|
||||
+68
-91
@@ -1,106 +1,83 @@
|
||||
# =============================================================================
|
||||
#
|
||||
#
|
||||
# Utility functions for zoxide.
|
||||
#
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Adapted from icezyclon/zoxide.fish (MIT)
|
||||
# Heavily customized for Fish 4.x compatibility and performance
|
||||
|
||||
if not type -q zoxide
|
||||
return
|
||||
end
|
||||
if status is-interactive
|
||||
|
||||
# pwd based on the value of _ZO_RESOLVE_SYMLINKS.
|
||||
function __zoxide_pwd
|
||||
builtin pwd -L
|
||||
end
|
||||
if type -q zoxide
|
||||
|
||||
# A copy of fish's internal cd function. This makes it possible to use
|
||||
# `alias cd=z` without causing an infinite loop.
|
||||
if ! builtin functions --query __zoxide_cd_internal
|
||||
string replace --regex -- '^function cd\s' 'function __zoxide_cd_internal ' <$__fish_data_dir/functions/cd.fish | source
|
||||
end
|
||||
# -------------
|
||||
# 'zoxide init fish' is very different for different versions of zoxide
|
||||
# to guarantee the same behavior we define these functions ourself,
|
||||
# especially because the apt package is so old
|
||||
# most of these functions were taken from https://github.com/ajeetdsouza/zoxide
|
||||
# from version 0.8.1
|
||||
|
||||
# cd + custom logic based on the value of _ZO_ECHO.
|
||||
function __zoxide_cd
|
||||
if set -q __zoxide_loop
|
||||
builtin echo "zoxide: infinite loop detected"
|
||||
builtin echo "Avoid aliasing `cd` to `z` directly, use `zoxide init --cmd=cd fish` instead"
|
||||
return 1
|
||||
end
|
||||
__zoxide_loop=1 __zoxide_cd_internal $argv
|
||||
end
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# Hook configuration for zoxide.
|
||||
#
|
||||
|
||||
# Initialize hook to add new entries to the database.
|
||||
function __zoxide_hook --on-variable PWD
|
||||
test -z "$fish_private_mode"
|
||||
and command zoxide add -- (__zoxide_pwd)
|
||||
end
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# When using zoxide with --no-cmd, alias these internal functions as desired.
|
||||
#
|
||||
|
||||
# Jump to a directory using only keywords.
|
||||
function __zoxide_z
|
||||
set -l argc (builtin count $argv)
|
||||
if test $argc -eq 0
|
||||
__zoxide_cd $HOME
|
||||
else if test "$argv" = -
|
||||
__zoxide_cd -
|
||||
else if test $argc -eq 1 -a -d $argv[1]
|
||||
__zoxide_cd $argv[1]
|
||||
else if test $argc -eq 2 -a $argv[1] = --
|
||||
__zoxide_cd -- $argv[2]
|
||||
if ! builtin functions -q _zoxide_cd
|
||||
if builtin functions -q cd
|
||||
builtin functions -c cd _zoxide_cd
|
||||
else
|
||||
set -l result (command zoxide query --exclude (__zoxide_pwd) -- $argv)
|
||||
and __zoxide_cd $result
|
||||
alias _zoxide_cd='builtin cd'
|
||||
end
|
||||
end
|
||||
|
||||
# Completions.
|
||||
function __zoxide_z_complete
|
||||
set -l tokens (builtin commandline --current-process --tokenize)
|
||||
set -l curr_tokens (builtin commandline --cut-at-cursor --current-process --tokenize)
|
||||
|
||||
if test (builtin count $tokens) -le 2 -a (builtin count $curr_tokens) -eq 1
|
||||
# If there are < 2 arguments, use `cd` completions.
|
||||
complete --do-complete "'' "(builtin commandline --cut-at-cursor --current-token) | string match --regex -- '.*/$'
|
||||
else if test (builtin count $tokens) -eq (builtin count $curr_tokens)
|
||||
# If the last argument is empty, use interactive selection.
|
||||
set -l query $tokens[2..-1]
|
||||
set -l result (command zoxide query --exclude (__zoxide_pwd) --interactive -- $query)
|
||||
and __zoxide_cd $result
|
||||
and builtin commandline --function cancel-commandline repaint
|
||||
end
|
||||
end
|
||||
complete --command __zoxide_z --no-files --arguments '(__zoxide_z_complete)'
|
||||
|
||||
# Jump to a directory using interactive search.
|
||||
function __zoxide_zi
|
||||
set -l result (command zoxide query --interactive -- $argv)
|
||||
and __zoxide_cd $result
|
||||
function _zoxide_hook --on-variable PWD
|
||||
test -z "$fish_private_mode"
|
||||
and command zoxide add -- (builtin pwd -L)
|
||||
end
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# Commands for zoxide. Disable these using --no-cmd.
|
||||
#
|
||||
function z
|
||||
set argc (count $argv)
|
||||
if test $argc -eq 0
|
||||
_zoxide_cd $HOME
|
||||
else if test "$argv" = -
|
||||
_zoxide_cd -
|
||||
else
|
||||
# Check if the argument is a directory (respecting CDPATH)
|
||||
set -l is_dir 1
|
||||
if test -d $argv[-1]
|
||||
set is_dir 0
|
||||
else if not string match -rq '^\.?\.?/' -- $argv[-1]
|
||||
for i in $CDPATH
|
||||
if test -n "$i" -a -d "$i/$argv[-1]"
|
||||
set is_dir 0
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
abbr --erase z &>/dev/null
|
||||
alias z=__zoxide_z
|
||||
if test $is_dir -eq 0
|
||||
_zoxide_cd $argv[-1]
|
||||
else
|
||||
set -l result (command zoxide query -- $argv)
|
||||
and _zoxide_cd $result
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
abbr --erase zi &>/dev/null
|
||||
alias zi=__zoxide_zi
|
||||
function zi
|
||||
set -l result (command zoxide query -i -- $argv)
|
||||
and _zoxide_cd $result
|
||||
end
|
||||
|
||||
abbr --erase cdi &>/dev/null
|
||||
alias cdi=__zoxide_zi
|
||||
# -------------
|
||||
|
||||
# =============================================================================
|
||||
# Initialize zoxide:
|
||||
alias cd=z
|
||||
|
||||
zoxide init --cmd=cd fish | source
|
||||
# use custom completion
|
||||
complete -c z -f # disable files by default
|
||||
complete -c z -x -a '(_zoxide_z_complete)'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function _zoxide_uninstall --on-event zoxide_uninstall
|
||||
if alias | grep "alias cd z" >/dev/null
|
||||
functions -e cd
|
||||
end
|
||||
if builtin functions -q _zoxide_cd && not functions -q cd
|
||||
# restore old cd
|
||||
builtin functions -c _zoxide_cd cd
|
||||
end
|
||||
end
|
||||
|
||||
+21
-4
@@ -74,6 +74,8 @@ fish_add_path -mg --move $CARGO_HOME/bin
|
||||
fish_add_path $BUN_INSTALL/bin
|
||||
fish_add_path $XDG_DATA_HOME/npm-global/bin
|
||||
fish_add_path $HOME/.lmstudio/bin
|
||||
fish_add_path $HOME/.resend/bin
|
||||
fish_add_path $HOME/.fzf/bin
|
||||
|
||||
# ───────────────────────── CDPATH projects dir ──────────────────────────
|
||||
# Allows cd-ing to directories within $HOME/projects or $HOME without needing to specify the full path.
|
||||
@@ -110,10 +112,25 @@ if status is-interactive
|
||||
set -g fish_key_bindings fish_vi_key_bindings
|
||||
|
||||
# ──────────────────────── Source FZF integration ────────────────────────
|
||||
# Sources the FZF integration script, which provides enhanced command history
|
||||
# searching and file finding capabilities.
|
||||
if test -f "$__fish_config_dir/integrations/fzf.fish"
|
||||
source "$__fish_config_dir/integrations/fzf.fish"
|
||||
# Prefer fzf's own fish integration (fzf --fish, available since fzf 0.48)
|
||||
# which is always version-matched to the installed binary. Fall back to our
|
||||
# bundled integrations/fzf.fish for older builds.
|
||||
# Run `fzf-update` to install/upgrade fzf from git HEAD.
|
||||
if type -q fzf
|
||||
set -l _fzf_minor (fzf --version | string match -r '^\d+\.(\d+)')[2]
|
||||
if test -n "$_fzf_minor" -a "$_fzf_minor" -ge 48
|
||||
fzf --fish | source
|
||||
else
|
||||
test -f "$__fish_config_dir/integrations/fzf.fish"
|
||||
and source "$__fish_config_dir/integrations/fzf.fish"
|
||||
end
|
||||
else
|
||||
# conf.d/fzf.fish is managed by Fisher and may be restored on fisher
|
||||
# update, so this is the reliable place to strip its bindings when
|
||||
# fzf is not installed.
|
||||
if functions -q _fzf_uninstall_bindings
|
||||
_fzf_uninstall_bindings
|
||||
end
|
||||
end
|
||||
|
||||
# ──────────────────────────────── DirENV ────────────────────────────────
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# Populates parallel arrays describing every managed dependency.
|
||||
# Callers must invoke this function before accessing _fdc_* arrays.
|
||||
#
|
||||
# Array layout (same index across all sets):
|
||||
# _fdc_bins — binary name (what `type -q` checks)
|
||||
# _fdc_tiers — req | int | rec
|
||||
# _fdc_cargo — cargo crate name, or "" if not on crates.io
|
||||
# _fdc_pm — system PM package name, or "" if not in repos
|
||||
# _fdc_special — special install key: rustup-installer | fisher-bootstrap |
|
||||
# fzf-update | paru-build | pipx | curl-installer |
|
||||
# git-cargo-fish | curl-uv | "" (none)
|
||||
#
|
||||
# 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 \
|
||||
wakatime tailscale \
|
||||
eza lsd bat btop dust duf prettyping most rg lazygit lazydocker trash kitty wezterm
|
||||
|
||||
set -g _fdc_tiers \
|
||||
req req req req req req req req rec \
|
||||
int int \
|
||||
rec rec rec rec rec rec rec rec rec rec rec rec rec rec
|
||||
|
||||
set -g _fdc_cargo \
|
||||
"" "" "" "" starship "" zoxide "" "" \
|
||||
"" "" \
|
||||
eza lsd bat "" du-dust "" "" "" ripgrep "" "" trashy "" ""
|
||||
|
||||
set -g _fdc_pm \
|
||||
uv cargo fish "" starship fzf zoxide direnv "" \
|
||||
wakatime tailscale \
|
||||
eza lsd bat btop dust duf prettyping most 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 \
|
||||
wakatime-binary "" \
|
||||
"" "" "" "" "" "" "" "" "" "" curl-lazydocker "" "" ""
|
||||
end
|
||||
|
||||
# Returns the index (1-based) of $argv[1] in the catalog, or "" if not found.
|
||||
function _fish_deps_catalog_idx --argument-names bin
|
||||
_fish_deps_catalog
|
||||
set -l i 1
|
||||
for b in $_fdc_bins
|
||||
if test "$b" = "$bin"
|
||||
echo $i
|
||||
return
|
||||
end
|
||||
set i (math $i + 1)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# Detect the first available system package manager.
|
||||
function _fish_deps_detect_pm
|
||||
for pm in paru yay pacman apt brew pkg dnf yum
|
||||
if type -q $pm
|
||||
echo $pm
|
||||
return
|
||||
end
|
||||
end
|
||||
echo ""
|
||||
end
|
||||
@@ -0,0 +1,265 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# Interactively install missing deps.
|
||||
# For each missing dep: prompts yes/no, then prompts install method when multiple exist.
|
||||
function _fish_deps_install
|
||||
_fish_deps_catalog
|
||||
|
||||
set -l pm (_fish_deps_detect_pm)
|
||||
set -l installed_any 0
|
||||
|
||||
set -l i 1
|
||||
for bin in $_fdc_bins
|
||||
# Determine if this dep needs attention: missing, or fish < 4.0
|
||||
set -l needs_install 0
|
||||
set -l upgrade_label Install
|
||||
if not type -q $bin
|
||||
set needs_install 1
|
||||
else if test "$bin" = fish
|
||||
set -l _major (fish --version 2>&1 | string match -r 'version (\d+)')[2]
|
||||
if test -n "$_major"; and test "$_major" -lt 4
|
||||
set needs_install 1
|
||||
set upgrade_label "Upgrade"
|
||||
end
|
||||
end
|
||||
|
||||
if test $needs_install -eq 1
|
||||
set -l cargo_crate $_fdc_cargo[$i]
|
||||
set -l pm_pkg $_fdc_pm[$i]
|
||||
set -l special $_fdc_special[$i]
|
||||
|
||||
# Build list of available install methods
|
||||
set -l methods
|
||||
set -l method_labels
|
||||
|
||||
# Cargo — preferred for Rust tools; gets the latest crate version
|
||||
if test -n "$cargo_crate"
|
||||
if type -q cargo
|
||||
set -a methods cargo
|
||||
set -a method_labels "cargo ($cargo_crate)"
|
||||
else
|
||||
set_color brblack
|
||||
echo " note: cargo not found — install cargo first for the latest $bin"
|
||||
set_color normal
|
||||
end
|
||||
end
|
||||
|
||||
# Preferred special methods — listed before system PM so they are the default
|
||||
switch $special
|
||||
case curl-uv
|
||||
set -a methods special-uv
|
||||
set -a method_labels "curl installer (official script)"
|
||||
case git-cargo-fish
|
||||
if type -q cargo; and type -q uv
|
||||
set -a methods special-git-cargo-fish
|
||||
set -a method_labels "build from source (git + cargo)"
|
||||
else
|
||||
set_color brblack
|
||||
set -l _need
|
||||
type -q cargo; or set -a _need cargo
|
||||
type -q uv; or set -a _need uv
|
||||
echo " note: "(string join " and " $_need)" not found — install them first to build fish from source"
|
||||
set_color normal
|
||||
end
|
||||
case rustup-installer
|
||||
set -a methods special-rustup
|
||||
set -a method_labels "rustup installer (curl | sh)"
|
||||
case curl-lazydocker
|
||||
set -a methods special-lazydocker
|
||||
set -a method_labels "curl installer (official script)"
|
||||
case wakatime-binary
|
||||
set -a methods special-wakatime
|
||||
set -a method_labels "binary download (github releases)"
|
||||
end
|
||||
|
||||
# System PM — after cargo and preferred specials
|
||||
if test -n "$pm_pkg"; and test -n "$pm"
|
||||
set -a methods pm
|
||||
set -a method_labels "$pm ($pm_pkg)"
|
||||
end
|
||||
|
||||
# Supplemental special methods (fallbacks, Arch-only, etc.)
|
||||
switch $special
|
||||
case fzf-update
|
||||
set -a methods special-fzf
|
||||
set -a method_labels "git clone (~/.fzf)"
|
||||
case fisher-bootstrap
|
||||
set -a methods special-fisher
|
||||
set -a method_labels "curl bootstrap (fisher)"
|
||||
case curl-installer
|
||||
set -a methods special-curl
|
||||
set -a method_labels "curl installer"
|
||||
case paru-build
|
||||
# Only offered on Arch-based systems where pacman is present
|
||||
if type -q yay
|
||||
set -a methods special-yay-paru
|
||||
set -a method_labels "yay -S paru"
|
||||
end
|
||||
if type -q pacman
|
||||
set -a methods special-paru
|
||||
set -a method_labels "build from AUR (makepkg)"
|
||||
end
|
||||
case pipx
|
||||
if type -q pipx
|
||||
set -a methods special-pipx
|
||||
set -a method_labels "pipx ($bin)"
|
||||
else if type -q pip
|
||||
set -a methods special-pip
|
||||
set -a method_labels "pip install --user ($bin)"
|
||||
end
|
||||
end
|
||||
|
||||
if test (count $methods) -eq 0
|
||||
set_color yellow
|
||||
echo " $bin: no install method available on this system — skipping"
|
||||
set_color normal
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
# Prompt: install/upgrade this dep?
|
||||
read -l -P (set_color cyan)"$upgrade_label $bin?"(set_color normal)" [Y/n] " _reply
|
||||
if test "$_reply" = n; or test "$_reply" = N
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
# Choose install method
|
||||
set -l chosen_method $methods[1]
|
||||
if test (count $methods) -gt 1
|
||||
echo " Available methods:"
|
||||
set -l m 1
|
||||
for lbl in $method_labels
|
||||
set_color brblack; echo -n " $m) "; set_color normal
|
||||
echo $lbl
|
||||
set m (math $m + 1)
|
||||
end
|
||||
read -l -P " Choose [1-"(count $methods)"] (default 1 = $method_labels[1]): " _choice
|
||||
if string match -qr '^\d+$' "$_choice"; and test "$_choice" -ge 1; and test "$_choice" -le (count $methods)
|
||||
set chosen_method $methods[$_choice]
|
||||
end
|
||||
else
|
||||
set_color brblack; echo " "(string lower $upgrade_label)"ing via $method_labels[1]"; set_color normal
|
||||
end
|
||||
|
||||
# Execute chosen method
|
||||
switch $chosen_method
|
||||
case cargo
|
||||
cargo install $cargo_crate
|
||||
case pm
|
||||
_fish_deps_pm_install $pm_pkg
|
||||
case special-rustup
|
||||
curl https://sh.rustup.rs -sSf | sh
|
||||
# Add cargo to PATH for the rest of this session without restarting.
|
||||
# Try CARGO_HOME first (set in config.fish), then the rustup default.
|
||||
for _d in "$CARGO_HOME/bin" "$HOME/.cargo/bin"
|
||||
if test -d "$_d"
|
||||
fish_add_path "$_d"
|
||||
break
|
||||
end
|
||||
end
|
||||
if not type -q cargo
|
||||
set_color yellow
|
||||
echo " cargo not yet in PATH — restart your shell if subsequent installs fail."
|
||||
set_color normal
|
||||
end
|
||||
case special-lazydocker
|
||||
curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash
|
||||
case special-wakatime
|
||||
set -l _arch (uname -m)
|
||||
switch $_arch
|
||||
case x86_64
|
||||
set _arch amd64
|
||||
case aarch64 arm64
|
||||
set _arch arm64
|
||||
case armv7l
|
||||
set _arch arm
|
||||
case '*'
|
||||
set _arch amd64
|
||||
end
|
||||
set -l _zip "wakatime-cli-linux-$_arch.zip"
|
||||
set -l _bin_src "wakatime-cli-linux-$_arch"
|
||||
set -l _wt_dir "$HOME/.config/wakatime"
|
||||
set -l _wt_bin "$_wt_dir/wakatime"
|
||||
set -l _tmpdir (mktemp -d)
|
||||
curl -L "https://github.com/wakatime/wakatime-cli/releases/latest/download/$_zip" \
|
||||
-o "$_tmpdir/$_zip"
|
||||
and unzip -o "$_tmpdir/$_zip" -d "$_tmpdir"
|
||||
and mkdir -p "$_wt_dir" "$HOME/.local/bin"
|
||||
and cp "$_tmpdir/$_bin_src" "$_wt_bin"
|
||||
and chmod +x "$_wt_bin"
|
||||
and ln -sf "$_wt_bin" "$HOME/.local/bin/wakatime"
|
||||
rm -rf "$_tmpdir"
|
||||
case special-fzf
|
||||
fzf-update
|
||||
case special-fisher
|
||||
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source
|
||||
fisher update
|
||||
case special-curl
|
||||
if test "$bin" = starship
|
||||
curl -sS https://starship.rs/install.sh | sh
|
||||
end
|
||||
case special-yay-paru
|
||||
yay -S --noconfirm paru
|
||||
case special-paru
|
||||
set -l _build_dir (mktemp -d)
|
||||
git clone https://aur.archlinux.org/paru.git $_build_dir
|
||||
and pushd $_build_dir
|
||||
and makepkg -si --noconfirm
|
||||
and popd
|
||||
rm -rf $_build_dir
|
||||
case special-uv
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
# Add uv to PATH for the rest of this session
|
||||
for _d in "$HOME/.local/bin" "$HOME/.cargo/bin"
|
||||
if test -d "$_d"
|
||||
fish_add_path "$_d"
|
||||
break
|
||||
end
|
||||
end
|
||||
if not type -q uv
|
||||
set_color yellow
|
||||
echo " uv not yet in PATH — restart your shell if subsequent installs fail."
|
||||
set_color normal
|
||||
end
|
||||
case special-git-cargo-fish
|
||||
set -l _tmpdir (mktemp -d)
|
||||
set -l _build_ok 0
|
||||
git clone https://github.com/fish-shell/fish-shell "$_tmpdir"
|
||||
and begin
|
||||
set -l _tag (git -C "$_tmpdir" tag --list 'fish-*' --sort=version:refname | tail -1)
|
||||
test -n "$_tag"; and git -C "$_tmpdir" checkout "$_tag"
|
||||
true
|
||||
end
|
||||
and pushd "$_tmpdir"
|
||||
and uv run --no-managed-python cargo install --path .
|
||||
and set _build_ok 1
|
||||
popd 2>/dev/null
|
||||
rm -rf "$_tmpdir"
|
||||
test $_build_ok -eq 1
|
||||
case special-pipx
|
||||
pipx install $bin
|
||||
case special-pip
|
||||
pip install --user $bin
|
||||
end
|
||||
|
||||
if test $status -eq 0
|
||||
set installed_any 1
|
||||
set_color green; echo " $bin "(string lower $upgrade_label)"ed."; set_color normal
|
||||
if test "$bin" = fish
|
||||
set_color yellow
|
||||
echo " Fish upgraded — restart your shell to use the new version."
|
||||
set_color normal
|
||||
end
|
||||
else
|
||||
set_color red; echo " $bin "(string lower $upgrade_label)" failed."; set_color normal
|
||||
end
|
||||
end
|
||||
set i (math $i + 1)
|
||||
end
|
||||
|
||||
if test $installed_any -eq 0
|
||||
echo "Nothing to install."
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,28 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# Install a package via the system PM.
|
||||
# Usage: _fish_deps_pm_install <pkg>
|
||||
function _fish_deps_pm_install --argument-names pkg
|
||||
set -l pm (_fish_deps_detect_pm)
|
||||
if test -z "$pm"
|
||||
echo "No supported package manager found." >&2
|
||||
return 1
|
||||
end
|
||||
switch $pm
|
||||
case paru yay
|
||||
$pm -S --noconfirm $pkg
|
||||
case pacman
|
||||
sudo pacman -S --noconfirm $pkg
|
||||
case apt
|
||||
sudo apt install -y $pkg
|
||||
case brew
|
||||
brew install $pkg
|
||||
case pkg
|
||||
sudo pkg install -y $pkg
|
||||
case dnf
|
||||
sudo dnf install -y $pkg
|
||||
case yum
|
||||
sudo yum install -y $pkg
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,28 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# Upgrade an already-installed package via the system PM.
|
||||
# Usage: _fish_deps_pm_upgrade <pkg>
|
||||
function _fish_deps_pm_upgrade --argument-names pkg
|
||||
set -l pm (_fish_deps_detect_pm)
|
||||
if test -z "$pm"
|
||||
echo "No supported package manager found." >&2
|
||||
return 1
|
||||
end
|
||||
switch $pm
|
||||
case paru yay
|
||||
$pm -S --noconfirm $pkg
|
||||
case pacman
|
||||
sudo pacman -S --noconfirm $pkg
|
||||
case apt
|
||||
sudo apt install --only-upgrade -y $pkg
|
||||
case brew
|
||||
brew upgrade $pkg
|
||||
case pkg
|
||||
sudo pkg upgrade -y $pkg
|
||||
case dnf
|
||||
sudo dnf upgrade -y $pkg
|
||||
case yum
|
||||
sudo yum update -y $pkg
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,50 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# Print colored installed/missing status for all deps, grouped by tier.
|
||||
function _fish_deps_status
|
||||
_fish_deps_catalog
|
||||
|
||||
function __fds_print_dep --argument-names bin tier
|
||||
if type -q $bin
|
||||
# Special version check: fish < 4.0 is functionally incompatible
|
||||
if test "$bin" = fish
|
||||
set -l _major (fish --version 2>&1 | string match -r 'version (\d+)')[2]
|
||||
if test -n "$_major"; and test "$_major" -lt 4
|
||||
set -l _ver (fish --version 2>&1 | string replace 'fish, ' '')
|
||||
set_color yellow; echo -n " ⚠ "; set_color normal
|
||||
echo -n "$bin "
|
||||
set_color brblack; echo "($_ver — upgrade to 4.0+ required)"; set_color normal
|
||||
return
|
||||
end
|
||||
end
|
||||
set_color green; echo -n " ✓ "; set_color normal
|
||||
echo -n "$bin "
|
||||
set_color brblack; echo "(Found at "(type -p $bin)")"; set_color normal
|
||||
else if test "$tier" = rec
|
||||
set_color yellow; echo -n " ⚠ "; set_color normal
|
||||
echo -n "$bin "
|
||||
set_color brblack; echo "(Not installed)"; set_color normal
|
||||
else
|
||||
set_color red; echo -n " ✗ "; set_color normal
|
||||
echo -n "$bin "
|
||||
set_color brblack; echo "(Not installed)"; set_color normal
|
||||
end
|
||||
end
|
||||
|
||||
for tier_label in "Required Dependencies:req" "Integrations:int" "Recommended Dependencies:rec"
|
||||
set -l label (string split : $tier_label)[1]
|
||||
set -l tier (string split : $tier_label)[2]
|
||||
set_color cyan; echo $label; set_color normal
|
||||
set -l i 1
|
||||
for bin in $_fdc_bins
|
||||
if test "$_fdc_tiers[$i]" = $tier
|
||||
__fds_print_dep $bin $tier
|
||||
end
|
||||
set i (math $i + 1)
|
||||
end
|
||||
echo ""
|
||||
end
|
||||
|
||||
functions -e __fds_print_dep
|
||||
end
|
||||
@@ -0,0 +1,177 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# Update all installed deps using their known install method.
|
||||
# Priority: cargo > system PM > special (fzf-update, fisher, pipx).
|
||||
function _fish_deps_update
|
||||
_fish_deps_catalog
|
||||
|
||||
set -l pm (_fish_deps_detect_pm)
|
||||
set -l updated_any 0
|
||||
|
||||
# Fisher plugins — always update if fisher is present
|
||||
if type -q fisher
|
||||
echo "Updating fisher plugins..."
|
||||
fisher update
|
||||
set updated_any 1
|
||||
end
|
||||
|
||||
set -l i 1
|
||||
for bin in $_fdc_bins
|
||||
# Skip fisher itself (handled above) and tools that aren't installed
|
||||
if test "$bin" = fisher; or not type -q $bin
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
set -l cargo_crate $_fdc_cargo[$i]
|
||||
set -l pm_pkg $_fdc_pm[$i]
|
||||
set -l special $_fdc_special[$i]
|
||||
|
||||
# cargo: update via rustup
|
||||
if test "$special" = rustup-installer
|
||||
if type -q rustup
|
||||
echo "Updating $bin..."
|
||||
rustup update
|
||||
set updated_any 1
|
||||
end
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
# fzf: always use fzf-update (git-based)
|
||||
if test "$special" = fzf-update
|
||||
echo "Updating $bin..."
|
||||
fzf-update
|
||||
set updated_any 1
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
# lazydocker: re-run the official install/update script
|
||||
if test "$special" = curl-lazydocker
|
||||
echo "Updating $bin..."
|
||||
curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash
|
||||
set updated_any 1
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
# wakatime: re-download the binary from github releases
|
||||
if test "$special" = wakatime-binary
|
||||
echo "Updating $bin..."
|
||||
set -l _arch (uname -m)
|
||||
switch $_arch
|
||||
case x86_64; set _arch amd64
|
||||
case aarch64 arm64; set _arch arm64
|
||||
case armv7l; set _arch arm
|
||||
case '*'; set _arch amd64
|
||||
end
|
||||
set -l _zip "wakatime-cli-linux-$_arch.zip"
|
||||
set -l _bin_src "wakatime-cli-linux-$_arch"
|
||||
set -l _wt_bin "$HOME/.config/wakatime/wakatime"
|
||||
set -l _tmpdir (mktemp -d)
|
||||
curl -L "https://github.com/wakatime/wakatime-cli/releases/latest/download/$_zip" \
|
||||
-o "$_tmpdir/$_zip"
|
||||
and unzip -o "$_tmpdir/$_zip" -d "$_tmpdir"
|
||||
and cp "$_tmpdir/$_bin_src" "$_wt_bin"
|
||||
and chmod +x "$_wt_bin"
|
||||
rm -rf "$_tmpdir"
|
||||
and set updated_any 1
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
# pipx tools
|
||||
if test "$special" = pipx
|
||||
if type -q pipx
|
||||
echo "Updating $bin..."
|
||||
pipx upgrade $bin
|
||||
set updated_any 1
|
||||
end
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
# uv: use built-in self-updater
|
||||
if test "$special" = curl-uv
|
||||
echo "Updating $bin..."
|
||||
uv self update
|
||||
set updated_any 1
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
# fish: prefer build from source via git + cargo; fall back to PM
|
||||
if test "$special" = git-cargo-fish
|
||||
if type -q cargo; and type -q uv
|
||||
echo "Updating $bin..."
|
||||
set -l _tmpdir (mktemp -d)
|
||||
set -l _build_ok 0
|
||||
git clone https://github.com/fish-shell/fish-shell "$_tmpdir"
|
||||
and begin
|
||||
set -l _tag (git -C "$_tmpdir" tag --list 'fish-*' --sort=version:refname | tail -1)
|
||||
test -n "$_tag"; and git -C "$_tmpdir" checkout "$_tag"
|
||||
true
|
||||
end
|
||||
and pushd "$_tmpdir"
|
||||
and uv run --no-managed-python cargo install --path .
|
||||
and set _build_ok 1
|
||||
popd 2>/dev/null
|
||||
rm -rf "$_tmpdir"
|
||||
if test $_build_ok -eq 1
|
||||
set updated_any 1
|
||||
set_color yellow
|
||||
echo " Fish updated — restart your shell to use the new version."
|
||||
set_color normal
|
||||
end
|
||||
else if test -n "$pm_pkg"; and test -n "$pm"
|
||||
echo "Updating $bin (cargo/uv unavailable, using system PM)..."
|
||||
_fish_deps_pm_upgrade $pm_pkg
|
||||
set updated_any 1
|
||||
set_color yellow
|
||||
echo " Fish updated — restart your shell to use the new version."
|
||||
set_color normal
|
||||
else
|
||||
set_color yellow
|
||||
echo " fish: cannot update — install cargo and uv to build from source"
|
||||
set_color normal
|
||||
end
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
# curl-installer tools (starship etc.): re-run install script, which upgrades in place
|
||||
if test "$special" = curl-installer
|
||||
if test "$bin" = starship
|
||||
echo "Updating $bin..."
|
||||
curl -sS https://starship.rs/install.sh | sh -s -- --yes
|
||||
set updated_any 1
|
||||
end
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
# Cargo: prefer for Rust tools
|
||||
if test -n "$cargo_crate"; and type -q cargo
|
||||
echo "Updating $bin..."
|
||||
cargo install --force $cargo_crate
|
||||
set updated_any 1
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
# System PM fallback
|
||||
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)
|
||||
end
|
||||
|
||||
if test $updated_any -eq 0
|
||||
echo "Nothing to update."
|
||||
end
|
||||
end
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
# Returns the result of a qalc calculation
|
||||
function _qalc_eval
|
||||
type -q qalc || return 1
|
||||
|
||||
# Get the current command line buffer
|
||||
set -l cmd (commandline)
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ function _smart_execute --description 'Execute different functions based on the
|
||||
# 2. Dispatch based on buffer content
|
||||
switch "$cmd"
|
||||
case '*='
|
||||
# If it ends in =, run qalc
|
||||
_qalc_eval
|
||||
# If it ends in =, run qalc; fall back to normal execute if qalc is absent
|
||||
_qalc_eval; or commandline -f execute
|
||||
|
||||
# case 'g *'
|
||||
# # EXAMPLE FUTURE EXTENSION
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
function cdi --wraps zi --description 'Interactively jump to a directory using zoxide (alias for zi)'
|
||||
zi $argv
|
||||
end
|
||||
@@ -1,50 +1,7 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# Check all fish-related dependencies
|
||||
# Thin wrapper kept for backwards compatibility.
|
||||
function check_fish_deps --description 'Check all fish-related dependencies'
|
||||
set -l required fish fisher starship fzf zoxide direnv paru
|
||||
set -l integrations wakatime tailscale
|
||||
set -l recommended eza lsd bat btop dust duf prettyping most rg lazygit lazydocker trash kitty wezterm
|
||||
|
||||
function __print_dep
|
||||
set -l dep $argv[1]
|
||||
if type -q $dep
|
||||
set_color green
|
||||
echo -n " "
|
||||
set_color normal
|
||||
echo -n "$dep "
|
||||
set_color brblack
|
||||
echo "(Found at "(type -p $dep)")"
|
||||
set_color normal
|
||||
else
|
||||
set_color red
|
||||
echo -n " "
|
||||
set_color normal
|
||||
echo -n "$dep "
|
||||
set_color brblack
|
||||
echo "(Not installed)"
|
||||
set_color normal
|
||||
end
|
||||
end
|
||||
|
||||
set_color cyan; echo "Required Dependencies:"; set_color normal
|
||||
for dep in $required
|
||||
__print_dep $dep
|
||||
end
|
||||
echo ""
|
||||
|
||||
set_color cyan; echo "Integrations:"; set_color normal
|
||||
for dep in $integrations
|
||||
__print_dep $dep
|
||||
end
|
||||
echo ""
|
||||
|
||||
set_color cyan; echo "Recommended Dependencies:"; set_color normal
|
||||
for dep in $recommended
|
||||
__print_dep $dep
|
||||
end
|
||||
echo ""
|
||||
|
||||
functions -e __print_dep
|
||||
fish-deps status
|
||||
end
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
function fish-deps --description 'Manage fish shell dependencies'
|
||||
set -l subcmd $argv[1]
|
||||
|
||||
switch $subcmd
|
||||
case status ''
|
||||
_fish_deps_status
|
||||
case install
|
||||
_fish_deps_install
|
||||
case update
|
||||
_fish_deps_update
|
||||
case sync
|
||||
echo "=== Installing missing deps ==="
|
||||
_fish_deps_install
|
||||
echo ""
|
||||
echo "=== Updating installed deps ==="
|
||||
_fish_deps_update
|
||||
case '*'
|
||||
set_color red
|
||||
echo "Unknown subcommand: $subcmd"
|
||||
set_color normal
|
||||
echo ""
|
||||
__fish_deps_help
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_deps_help
|
||||
set_color cyan; echo "fish-deps — manage fish shell dependencies"; set_color normal
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " fish-deps [status] Check installed/missing deps (default)"
|
||||
echo " fish-deps install Install missing deps interactively"
|
||||
echo " fish-deps update Update all installed deps"
|
||||
echo " fish-deps sync Install missing, then update all"
|
||||
echo ""
|
||||
echo "Install method priority: cargo > system PM > git/curl/pipx"
|
||||
echo "When multiple methods are available, you will be prompted to choose."
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# Installs or upgrades fzf from git HEAD into ~/.fzf
|
||||
function fzf-update --description 'Install or upgrade fzf from git HEAD'
|
||||
if test -d ~/.fzf
|
||||
echo "Updating fzf..."
|
||||
git -C ~/.fzf pull --ff-only
|
||||
else
|
||||
echo "Installing fzf..."
|
||||
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
||||
end
|
||||
and ~/.fzf/install --bin
|
||||
and echo "fzf $(fzf --version) ready. Restart your shell to activate."
|
||||
end
|
||||
+11
-4
@@ -3,16 +3,23 @@
|
||||
|
||||
# Interactively search and remove an installed package using fzf
|
||||
function parur --description 'Interactively search and remove an installed package using fzf'
|
||||
# 1. Use command substitution to get the package list from fzf
|
||||
set -l aur ""
|
||||
if type -q paru
|
||||
set aur paru
|
||||
else if type -q yay
|
||||
set aur yay
|
||||
else
|
||||
echo "No AUR helper found (install paru or yay)" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l pkg_list (
|
||||
pacman -Qqs \
|
||||
| fzf --preview 'pacman -Qi {}' --multi
|
||||
)
|
||||
|
||||
# 2. Check if a package was selected.
|
||||
if test (count $pkg_list) -gt 0
|
||||
# 3. Pass the selected packages directly to paru -R
|
||||
paru -R $pkg_list
|
||||
$aur -R $pkg_list
|
||||
else
|
||||
echo "No packages selected for removal."
|
||||
end
|
||||
|
||||
+11
-6
@@ -1,10 +1,15 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# Function for installing packages with paru.
|
||||
# This runs `paru` with the `-S` flag to install one or more packages.
|
||||
# The `$argv` variable passes all arguments given to the `pkg` function
|
||||
# directly to the `paru` command.
|
||||
function pkg --wraps='paru' --description 'directly to the `paru` command.'
|
||||
paru -S $argv
|
||||
function pkg --description 'Install packages via paru or yay'
|
||||
set -l aur ""
|
||||
if type -q paru
|
||||
set aur paru
|
||||
else if type -q yay
|
||||
set aur yay
|
||||
else
|
||||
echo "No AUR helper found (install paru or yay)" >&2
|
||||
return 1
|
||||
end
|
||||
$aur -S $argv
|
||||
end
|
||||
|
||||
+11
-6
@@ -1,10 +1,15 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# Function for searching for packages to install with paru.
|
||||
# This runs `paru` with the search flags.
|
||||
# The `$argv` variable passes all arguments given to the `search` function
|
||||
# directly to the `paru` command.
|
||||
function search --wraps='paru' --description 'directly to the `paru` command.'
|
||||
paru $argv
|
||||
function search --description 'Search/install packages interactively via paru or yay'
|
||||
set -l aur ""
|
||||
if type -q paru
|
||||
set aur paru
|
||||
else if type -q yay
|
||||
set aur yay
|
||||
else
|
||||
echo "No AUR helper found (install paru or yay)" >&2
|
||||
return 1
|
||||
end
|
||||
$aur $argv
|
||||
end
|
||||
|
||||
+11
-5
@@ -1,9 +1,15 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# Function for upgrading the system with paru.
|
||||
# This runs `paru` with the `-Syu` flags to sync, refresh, and upgrade all
|
||||
# packages, and adds `--no-confirm` to bypass the confirmation prompt.
|
||||
function upgrade --wraps='paru' --description 'packages, and adds `--no-confirm` to bypass the confirmation prompt.'
|
||||
paru -Syu --noconfirm
|
||||
function upgrade --description 'Full system upgrade via paru or yay'
|
||||
set -l aur ""
|
||||
if type -q paru
|
||||
set aur paru
|
||||
else if type -q yay
|
||||
set aur yay
|
||||
else
|
||||
echo "No AUR helper found (install paru or yay)" >&2
|
||||
return 1
|
||||
end
|
||||
$aur -Syu --noconfirm
|
||||
end
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Adapted from icezyclon/zoxide.fish (MIT)
|
||||
# Heavily customized for Fish 4.x compatibility and performance
|
||||
|
||||
function _zoxide_z_complete -d "Complete directory first or zoxide queries otherwise" --argument-names comp desc
|
||||
# comp is the currently completing token
|
||||
if not set -q comp[1]
|
||||
set comp (commandline -ct)
|
||||
end
|
||||
# cmd are all tokens including the current one except the command
|
||||
set -l cmd (commandline -opc) $comp
|
||||
set -e cmd[1]
|
||||
|
||||
# 1. Get standard completions (CWD, CDPATH, etc.)
|
||||
# We call the underlying functions directly to avoid recursion.
|
||||
if test (count $cmd) -le 1
|
||||
# CDPATH results
|
||||
__fish_complete_cd
|
||||
# Local directory results (CWD)
|
||||
__fish_complete_directories "$comp" ""
|
||||
end
|
||||
|
||||
# 2. Get zoxide results
|
||||
# Cap results to 25 to avoid overwhelming the completion engine
|
||||
set -l zresults (zoxide query -l $cmd | head -n 25)
|
||||
for res in $zresults
|
||||
set -l bname (basename $res)
|
||||
# If the basename matches the prefix, show it as a short name.
|
||||
if string match -qi "$comp*" -- $bname
|
||||
printf "%s/\tzoxide: %s\n" $bname $res
|
||||
end
|
||||
# Also provide the absolute path. Fish will filter it if it doesn't match.
|
||||
printf "%s/\tzoxide\n" $res
|
||||
end
|
||||
end
|
||||
|
||||
function _zoxide_equals_first_token -a check -d "Test if first non-switch token equals given one"
|
||||
set -l tokens (commandline -co)
|
||||
set -e tokens[1]
|
||||
set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens)
|
||||
if set -q tokens[1]
|
||||
test $tokens[1] = $check
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
+27
-3
@@ -31,6 +31,14 @@ function fzf_key_bindings
|
||||
return 1
|
||||
end
|
||||
|
||||
# bg-transform runs the preview toggle in a background thread (non-blocking).
|
||||
# It was added after fzf 0.60; fall back to the synchronous transform on older builds.
|
||||
set -l _fzf_ver (fzf --version | string match -r '^(\d+)\.(\d+)')
|
||||
set -l _fzf_transform_action transform
|
||||
if test -n "$_fzf_ver[3]"; and test "$_fzf_ver[3]" -ge 62
|
||||
set _fzf_transform_action bg-transform
|
||||
end
|
||||
|
||||
#----BEGIN INCLUDE common.fish
|
||||
# NOTE: Do not directly edit this section, which is copied from "common.fish".
|
||||
# To modify it, one can edit "common.fish" and run "./update.sh" to apply
|
||||
@@ -177,17 +185,25 @@ function fzf_key_bindings
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function fzf-history-widget -d "Show command history"
|
||||
function fzf-history-widget --inherit-variable _fzf_transform_action -d "Show command history"
|
||||
set -l -- command_line (commandline)
|
||||
set -l -- current_line (commandline -L)
|
||||
set -l -- total_lines (count $command_line)
|
||||
set -l -- fzf_query (string escape -- $command_line[$current_line])
|
||||
|
||||
# These options require newer fzf; omit them on older builds
|
||||
set -l _fzf_preview_wrap_sign ''
|
||||
set -l _fzf_toggle_raw ''
|
||||
if test "$_fzf_transform_action" = bg-transform
|
||||
set _fzf_preview_wrap_sign ' --preview-wrap-sign="↳ "'
|
||||
set _fzf_toggle_raw ,alt-r:toggle-raw
|
||||
end
|
||||
|
||||
set -lx -- FZF_DEFAULT_OPTS (__fzf_defaults '' \
|
||||
'--nth=2..,.. --scheme=history --multi --no-multi-line --no-wrap --wrap-sign="\t\t\t↳ " --preview-wrap-sign="↳ "' \
|
||||
'--nth=2..,.. --scheme=history --multi --no-multi-line --no-wrap --wrap-sign="\t\t\t↳ "'$_fzf_preview_wrap_sign \
|
||||
'--bind=\'shift-delete:execute-silent(for i in (string split0 -- <{+f}); eval builtin history delete --exact --case-sensitive -- (string escape -n -- $i | string replace -r "^\d*\\\\\\t" ""); end)+reload(eval $FZF_DEFAULT_COMMAND)\'' \
|
||||
'--bind="alt-enter:become(string join0 -- (string collect -- {+2..} | fish_indent -i))"' \
|
||||
"--bind=ctrl-r:toggle-sort,alt-r:toggle-raw --highlight-line $FZF_CTRL_R_OPTS" \
|
||||
"--bind=ctrl-r:toggle-sort$_fzf_toggle_raw --highlight-line $FZF_CTRL_R_OPTS" \
|
||||
'--accept-nth=2.. --delimiter="\t" --tabstop=4 --read0 --print0 --with-shell='(status fish-path)\\ -c)
|
||||
|
||||
# Add dynamic preview options if preview command isn't already set by user
|
||||
@@ -205,10 +221,18 @@ function fzf_key_bindings
|
||||
end
|
||||
|
||||
# Prepend the options to allow user customizations
|
||||
if test "$_fzf_transform_action" = bg-transform
|
||||
# Newer fzf: dynamic show/hide preview based on terminal width
|
||||
set -p -- FZF_DEFAULT_OPTS \
|
||||
'--bind="focus,resize:bg-transform:if test \\"$FZF_COLUMNS\\" -gt 100 -a \\\\( \\"$FZF_SELECT_COUNT\\" -gt 0 -o \\\\( -z \\"$FZF_WRAP\\" -a (string length -- {}) -gt (math $FZF_COLUMNS - 4) \\\\) -o (string collect -- {2..} | fish_indent | count) -gt 1 \\\\); echo show-preview; else echo hide-preview; end"' \
|
||||
'--preview="string collect -- (test \\"$FZF_SELECT_COUNT\\" -gt 0; and string collect -- {+2..}) \\"\\n# \\"'$date_cmd' {2..} | fish_indent --ansi"' \
|
||||
'--preview-window="right,50%,wrap-word,follow,info,hidden"'
|
||||
else
|
||||
# Older fzf: static preview; focus/resize events not reliably supported
|
||||
set -p -- FZF_DEFAULT_OPTS \
|
||||
'--preview="string collect -- (test \\"$FZF_SELECT_COUNT\\" -gt 0; and string collect -- {+2..}) \\"\\n# \\"'$date_cmd' {2..} | fish_indent --ansi"' \
|
||||
'--preview-window="right,50%,wrap,follow,info"'
|
||||
end
|
||||
end
|
||||
|
||||
set -lx FZF_DEFAULT_OPTS_FILE
|
||||
|
||||
Reference in New Issue
Block a user