From b0294cecf697874683ca91356ed42f5e3c204993 Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Fri, 20 Dec 2024 02:33:58 -0700 Subject: [PATCH] fish: Use '~' for fisher plugins to allow reloading to always work Signed-off-by: Nathan Chancellor --- fish/functions/esc_home.fish | 7 +++++++ fish/functions/rld.fish | 2 +- fish/functions/upd.fish | 5 +++-- fish/functions/user_setup.fish | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 fish/functions/esc_home.fish diff --git a/fish/functions/esc_home.fish b/fish/functions/esc_home.fish new file mode 100644 index 000000000..5e8f3712b --- /dev/null +++ b/fish/functions/esc_home.fish @@ -0,0 +1,7 @@ +#!/usr/bin/env fish +# SPDX-License-Identifier: MIT +# Copyright (C) 2024 Nathan Chancellor + +function esc_home -d "Replace $HOME with ~" + string replace $HOME \~ $argv +end diff --git a/fish/functions/rld.fish b/fish/functions/rld.fish index b10df04b0..8053ab824 100644 --- a/fish/functions/rld.fish +++ b/fish/functions/rld.fish @@ -3,6 +3,6 @@ # Copyright (C) 2021-2023 Nathan Chancellor function rld -d "Reload fish configuration" - fisher update $ENV_FOLDER/fish 1>/dev/null + fisher update (esc_home $ENV_FOLDER/fish) 1>/dev/null source $__fish_config_dir/config.fish end diff --git a/fish/functions/upd.fish b/fish/functions/upd.fish index 7b271b8b2..196880b97 100644 --- a/fish/functions/upd.fish +++ b/fish/functions/upd.fish @@ -28,7 +28,8 @@ function upd -d "Runs the update command for the current distro or downloads/upd continue case fisher - fisher update 1>/dev/null; or return + # Use output of 'fisher list' to ensure '~' stays escaped + fisher update (fisher list) 1>/dev/null; or return continue case hydro @@ -47,7 +48,7 @@ function upd -d "Runs the update command for the current distro or downloads/upd end switch $target case hydro - fisher update $repo 1>/dev/null; or return + fisher update (esc_home $repo) 1>/dev/null; or return end case forks diff --git a/fish/functions/user_setup.fish b/fish/functions/user_setup.fish index 52fccf150..2c989cb53 100644 --- a/fish/functions/user_setup.fish +++ b/fish/functions/user_setup.fish @@ -185,7 +185,7 @@ function user_setup -d "Setup a user account, downloading all files and placing set -a fisher_plugins jethrokuan/z end for fisher_plugin in $fisher_plugins - fisher install $fisher_plugin; or return + fisher install (esc_home $fisher_plugin); or return end # config.fish