Skip to content

Commit 437aecf

Browse files
committed
Fix / not showing at start of pwd
1 parent 77cea6c commit 437aecf

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

conf.d/_tide_pwd_var_change.fish

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function _tide_pwd_var_change -v PWD
22
set -l preDirNumberPwd (string replace $HOME '~' $PWD)
3-
set -l preDirNumberPwdSplit (string split --no-empty '/' $preDirNumberPwd)
3+
set -l preDirNumberPwdSplit (string split '/' $preDirNumberPwd)
44

55
set -g _tide_split_pwd $preDirNumberPwdSplit[(math -s0 -$tide_pwd_max_dirs)..-1]
66
set -g _tide_pwd (string join '/' $_tide_split_pwd)
@@ -10,13 +10,17 @@ function _tide_pwd_var_change -v PWD
1010
set -g _tide_pwd_anchors
1111

1212
if contains 'first' $tide_pwd_anchors
13-
set -a _tide_pwd_anchors $_tide_split_pwd[1]
13+
if test -n "$_tide_split_pwd[1]"
14+
set -a _tide_pwd_anchors $_tide_split_pwd[1]
15+
else
16+
set -a _tide_pwd_anchors $_tide_split_pwd[2]
17+
end
1418
end
1519
if contains 'last' $tide_pwd_anchors
1620
set -a _tide_pwd_anchors $_tide_split_pwd[-1]
1721
end
1822
if contains 'git' $tide_pwd_anchors
19-
set -a _tide_pwd_anchors (string replace $HOME '~' $_tide_git_dir | string split --no-empty -r -m1 '/')[2]
23+
set -a _tide_pwd_anchors (string replace $HOME '~' $_tide_git_dir | string split -r -m1 '/')[2]
2024
end
2125

2226
_tide_pwd

0 commit comments

Comments
 (0)