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
# 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 init fish | source
#starship init fish | source
# set theme
if string match -q -- light (darkman get)
yes | fish_config theme save "ayu Light"
fish_config theme choose "Nord Light"
else
yes | fish_config theme save "Nord"
fish_config theme choose "Nord"
end
end
@ -32,43 +32,50 @@ end
# greeting end
# 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
set -gx PATH "$PNPM_HOME" $PATH
end
# pnpm end
# 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
set -gx SSH_ASKPASS_REQUIRE prefer
set -gx SSH_ASKPASS "$HOME/.local/bin/rbw-ssh-askpass"
# 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
# >>> mamba initialize >>>
# !! Contents within this block are managed by 'mamba init' !!
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 initialize <<<
# asdf
set -gx ASDF_CONFIG_FILE $XDG_CONFIG_HOME/asdf/asdfrc
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
# alias
alias wget "wget --hsts-file="$XDG_DATA_HOME/wget-hsts""
alias "yarn" "yarn $1 --use-yarnrc $XDG_CONFIG_HOME/yarn/config"
if [ $TERM = xterm-kitty ]
alias "ssh" "kitten ssh"
end
alias "nya" "echo nya && meow"
alias bat="bat --theme=\$( test $(darkman get) = 'dark' && echo Nord || echo ansi)"
alias hg="kitten hyperlinked-grep"
# some aliases are turned into fuctions so they are commented out, will be removed soon.
# -- 2025-02-10 --
# alias wget "wget --hsts-file="$XDG_DATA_HOME/wget-hsts""
# alias "yarn" "yarn $1 --use-yarnrc $XDG_CONFIG_HOME/yarn/config"
# if [ $TERM = xterm-kitty ]
# alias "ssh" "kitten ssh"
# end
# 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

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