feat: fish config: migrate alias to functions & alter themes loading

This commit is contained in:
grassblock 2025-02-10 16:56:35 +08:00
parent 50509d4b92
commit 4dc09b3d11
5 changed files with 44 additions and 17 deletions

View file

@ -9,15 +9,15 @@ if status is-interactive
# zellij init for alacritty end # zellij init for alacritty end
# starship custom conf # starship custom conf
set -gx STARSHIP_CONFIG $__fish_config_dir/starship.toml #set -gx STARSHIP_CONFIG $__fish_config_dir/starship.toml
# starship custom conf end # starship custom conf end
starship init fish | source #starship init fish | source
# set theme # set theme
if string match -q -- light (darkman get) if string match -q -- light (darkman get)
yes | fish_config theme save "ayu Light" fish_config theme choose "Nord Light"
else else
yes | fish_config theme save "Nord" fish_config theme choose "Nord"
end end
end end
@ -32,43 +32,50 @@ end
# greeting end # greeting end
# pnpm # pnpm
set -gx PNPM_HOME "/home/grassblock/.local/share/pnpm" set -gx PNPM_HOME "$HOME/.local/share/pnpm"
if not string match -q -- $PNPM_HOME $PATH if not string match -q -- $PNPM_HOME $PATH
set -gx PATH "$PNPM_HOME" $PATH set -gx PATH "$PNPM_HOME" $PATH
end end
# pnpm end # pnpm end
# nvm managed npm # nvm managed npm
set -gx PATH "/home/grassblock/.local/share/npm/bin" $PATH set -gx PATH "$HOME/.local/share/npm/bin" $PATH
# ssh agent with rbw # ssh agent with rbw
set -gx SSH_ASKPASS_REQUIRE prefer set -gx SSH_ASKPASS_REQUIRE prefer
set -gx SSH_ASKPASS "$HOME/.local/bin/rbw-ssh-askpass" set -gx SSH_ASKPASS "$HOME/.local/bin/rbw-ssh-askpass"
# Created by `pipx` on 2023-10-13 01:41:55 # Created by `pipx` on 2023-10-13 01:41:55
set PATH $PATH /home/grassblock/.local/bin set PATH $PATH $HOME/.local/bin
# pipx end # pipx end
# >>> mamba initialize >>> # >>> mamba initialize >>>
# !! Contents within this block are managed by 'mamba init' !! # !! Contents within this block are managed by 'mamba init' !!
set -gx MAMBA_EXE "/usr/bin/micromamba" set -gx MAMBA_EXE "/usr/bin/micromamba"
set -gx MAMBA_ROOT_PREFIX "/home/grassblock/.local/share/micromamba" set -gx MAMBA_ROOT_PREFIX "$HOME/.local/share/micromamba"
$MAMBA_EXE shell hook --shell fish --root-prefix $MAMBA_ROOT_PREFIX | source $MAMBA_EXE shell hook --shell fish --root-prefix $MAMBA_ROOT_PREFIX | source
# <<< mamba initialize <<< # <<< mamba initialize <<<
# asdf # asdf
set -gx ASDF_CONFIG_FILE $XDG_CONFIG_HOME/asdf/asdfrc set -gx ASDF_CONFIG_FILE $XDG_CONFIG_HOME/asdf/asdfrc
set -gx ASDF_DATA_DIR $XDG_DATA_HOME/asdf set -gx ASDF_DATA_DIR $XDG_DATA_HOME/asdf
source /opt/asdf-vm/asdf.fish # not needed since it's implemented by the package itself
# source /opt/asdf-vm/asdf.fish
# asdf end # asdf end
# alias # alias
alias wget "wget --hsts-file="$XDG_DATA_HOME/wget-hsts"" # some aliases are turned into fuctions so they are commented out, will be removed soon.
alias "yarn" "yarn $1 --use-yarnrc $XDG_CONFIG_HOME/yarn/config" # -- 2025-02-10 --
if [ $TERM = xterm-kitty ] # alias wget "wget --hsts-file="$XDG_DATA_HOME/wget-hsts""
alias "ssh" "kitten ssh" # alias "yarn" "yarn $1 --use-yarnrc $XDG_CONFIG_HOME/yarn/config"
end # if [ $TERM = xterm-kitty ]
alias "nya" "echo nya && meow" # alias "ssh" "kitten ssh"
alias bat="bat --theme=\$( test $(darkman get) = 'dark' && echo Nord || echo ansi)" # end
alias hg="kitten hyperlinked-grep" # alias "nya" "echo nya && meow"
#
# https://github.com/sharkdp/bat?tab=readme-ov-file#highlighting-theme
# now we get auto themes
# alias bat="bat --theme=\$( test $(darkman get) = 'dark' && echo Nord || echo ansi)"
#
# alias hg="kitten hyperlinked-grep"
# alias end # alias end

View file

@ -0,0 +1,4 @@
function hg --wraps='kitten hyperlinked-grep' --description 'alias hg=kitten hyperlinked-grep'
kitten hyperlinked-grep $argv
end

View file

@ -0,0 +1,3 @@
function nya --wraps='echo nya && meow' --description 'alias nya echo nya && meow'
echo nya && meow
end

View file

@ -0,0 +1,9 @@
function ssh --description 'handy helper to make use of `kitten`'
if test $TERM = xterm-kitty
kitten ssh $argv
or command ssh $argv
# in case kitten unable to work in certain conditions like connecting to a openwrt.
else
command ssh $argv
end
end

View file

@ -0,0 +1,4 @@
function wget --description 'alias wget wget --hsts-file=/home/grassblock/.local/share/wget-hsts'
command wget --hsts-file=/home/grassblock/.local/share/wget-hsts $argv
end