perf(conf.d): stop re-running expensive setup on tricks.fish's second source
tricks.fish is sourced twice per shell on CachyOS: once by the conf.d autoload, once forced by config.fish to re-win over the distro's own tricks.fish (measured 4.55ms for the second pass, see startup-latency-JOB-BRIEF-FINDINGS.md §1). The bang-bang functions, aliases, and history override further down need to re-run on both passes since those are what re-assert over the distro config, but the PATH/MANPAGER setup does not. Gates fish_add_path and the type -q bat probe behind a once-per-session global, guarding only that block. Everything else in the file, and the coupling with config.fish's own cachyos-tricks guard, is unchanged.
This commit is contained in:
+24
-12
@@ -18,20 +18,32 @@ if test -f ~/.fish_profile
|
|||||||
source ~/.fish_profile
|
source ~/.fish_profile
|
||||||
end
|
end
|
||||||
|
|
||||||
# Append unique directories to $PATH (fish_add_path handles duplicates automatically)
|
# This file is sourced twice per shell on CachyOS (once by the conf.d
|
||||||
fish_add_path ~/.local/bin
|
# autoload, once forced by config.fish to re-win over the distro's own
|
||||||
fish_add_path ~/Applications/depot_tools
|
# tricks.fish). The PATH/MANPAGER setup below doesn't need to repeat on
|
||||||
|
# the second pass -- only the functions/aliases further down do, since
|
||||||
|
# those are what re-assert over the distro config. Gate the expensive
|
||||||
|
# calls (fish_add_path, type -q bat) behind a once-per-session guard.
|
||||||
|
# ponytail: per-session guard, not per-value; if this file grows more
|
||||||
|
# expensive one-time setup, extend the same guard rather than adding more.
|
||||||
|
if not set -q __fish_config_tricks_env_applied
|
||||||
|
set -g __fish_config_tricks_env_applied 1
|
||||||
|
|
||||||
# Expose user-local man pages
|
# Append unique directories to $PATH (fish_add_path handles duplicates automatically)
|
||||||
if not contains ~/.local/share/man $MANPATH
|
fish_add_path ~/.local/bin
|
||||||
set -gx MANPATH ~/.local/share/man $MANPATH
|
fish_add_path ~/Applications/depot_tools
|
||||||
end
|
|
||||||
|
|
||||||
# Format man pages using bat (only if bat is installed)
|
# Expose user-local man pages
|
||||||
# Overriding $MANPAGER is opinionated (C3 overrides)
|
if not contains ~/.local/share/man $MANPATH
|
||||||
if type -q bat; and __fish_config_op_enabled (status basename) tricks-manpager
|
set -gx MANPATH ~/.local/share/man $MANPATH
|
||||||
set -gx MANROFFOPT -c
|
end
|
||||||
set -gx MANPAGER "sh -c 'col -bx | bat -l man -p'"
|
|
||||||
|
# Format man pages using bat (only if bat is installed)
|
||||||
|
# Overriding $MANPAGER is opinionated (C3 overrides)
|
||||||
|
if type -q bat; and __fish_config_op_enabled (status basename) tricks-manpager
|
||||||
|
set -gx MANROFFOPT -c
|
||||||
|
set -gx MANPAGER "sh -c 'col -bx | bat -l man -p'"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set settings for https://github.com/franciscolourenco/done
|
# Set settings for https://github.com/franciscolourenco/done
|
||||||
|
|||||||
Reference in New Issue
Block a user