diff --git a/config.fish b/config.fish index 1a11572..3e0196c 100644 --- a/config.fish +++ b/config.fish @@ -1,5 +1,14 @@ set fish_greeting "" +function y + set tmp (mktemp -t "yazi-cwd.XXXXXX") + yazi $argv --cwd-file="$tmp" + if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] + builtin cd -- "$cwd" + end + rm -f -- "$tmp" +end + function filesize for file in $argv if [ -f "$file" ] @@ -20,10 +29,6 @@ function _fetch end function _set_env - if [ "$TERM" = "foot" ] || [ "$TERM" = "xterm-kitty" ] - which ssh > /dev/null 2>&1 && alias ssh="TERM=xterm-256color $(which ssh)" - which gg > /dev/null 2>&1 && alias gg="TERM=xterm-256color $(which gg)" - end set -gx VIRTUAL_ENV_DISABLE_PROMPT set -gx PF_INFO "ascii title os host kernel uptime memory de" set -gx FZF_DEFAULT_OPTS "\ @@ -36,6 +41,13 @@ function _set_env end function _set_aliases + if [ "$TERM" = "foot" ] || [ "$TERM" = "xterm-kitty" ] + if which ssh > /dev/null 2>&1 + alias ssh="TERM=xterm-256color $(which ssh)" + alias homessh="ssh -p 48001 tx0.su" + end + which gg > /dev/null 2>&1 && alias gg="TERM=xterm-256color $(which gg)" + end if which eza > /dev/null 2>&1 alias ls="eza --icons=auto" else if which exa > /dev/null 2>&1 @@ -85,11 +97,14 @@ if status is-interactive zoxide init --cmd cd fish | source end - if [ "$reload" = "" ] + if not set -q _fish_reloaded _fetch + else + printf "%s\n" "config reloaded" + fish_prompt end - set reload "done" + set _fish_reloaded _set_aliases end _set_env