From ced735e8ba651a989a18b5d10b3b7507a8b70a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Wed, 17 Jan 2024 15:29:16 +0100 Subject: [PATCH] Fix `_tide_pwd` when the user's `HOME` contains spaces. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On my Windows system, for whatever reason, my `HOME` is `C:\Users\Alex Rønne Petersen` rather than the usual `C:\Users\alex` kind of thing you'd expect. (And yes, this has found a great many bugs in various pieces of software. 😄) This would lead to more and more errors the deeper into a directory I went: ``` ❯ cd /z ❯ cd Source string replace: too many arguments ❯ cd tests string replace: too many arguments string replace: too many arguments ❯ cd cs string replace: too many arguments string replace: too many arguments string replace: too many arguments ❯ cd bin string replace: too many arguments string replace: too many arguments string replace: too many arguments string replace: too many arguments ``` Quoting the use of `$HOME` here fixes the issue. --- functions/_tide_pwd.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/_tide_pwd.fish b/functions/_tide_pwd.fish index 5447dd4..2a5a3b7 100644 --- a/functions/_tide_pwd.fish +++ b/functions/_tide_pwd.fish @@ -18,7 +18,7 @@ eval "function _tide_pwd string join / -- \$split_output | string length -V | read -g _tide_pwd_len i=1 for dir_section in \$split_pwd[2..-2] - string join -- / \$split_pwd[..\$i] | string replace '~' $HOME | read -l parent_dir # Uses i before increment + string join -- / \$split_pwd[..\$i] | string replace '~' \"$HOME\" | read -l parent_dir # Uses i before increment math \$i+1 | read i