fish cached source

ima genius
This commit is contained in:
2026-01-02 14:38:41 +02:00
parent 0c526b070d
commit 1ccccfc2de
3 changed files with 30 additions and 3 deletions
+28 -2
View File
@@ -1,2 +1,28 @@
command -q zoxide; and command zoxide init fish | source
command -q direnv; and command direnv hook fish | source
function cached_source -d 'cache the command result for sourcing'
set -l cache_dir $__fish_config_dir/source
test -e $cache_dir; or mkdir $cache_dir; or return
command -q -- $argv[1]; or return
set -l cache_file $cache_dir/$argv[1].fish
if status is-login; or not test -e $cache_file
command $argv >$cache_file; or return
end
source $cache_file
end
function cached_source_static -d 'source the cached command result'
test -e $__fish_config_dir/source/$argv[1].fish
and source $__fish_config_dir/source/$argv[1].fish
or cached_source $argv
end
cached_source direnv hook fish
status is-interactive; or return
cached_source zoxide init fish
cached_source trashy completions fish
cached_source sqlx completions fish
cached_source_static zmk --show-completion