Skip to content

Commit 75c2a14

Browse files
authored
Merge pull request #22 from acomagu/configurable-shlvl
Make SHLVL correction can be disabled by configuration
2 parents aff9c3c + aee599c commit 75c2a14

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ If your prompt don't work correctly, try changeing the configuration.
2424

2525
Define variables inherited to prompt functions. Set `all` to pass all global variables.
2626

27-
**Default:** `status`
27+
**Default:** `status SHLVL`
2828

2929
### Variable: `async_prompt_functions`
3030

conf.d/__async_prompt.fish

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,24 @@ if status is-interactive
7373
end
7474

7575
function __async_prompt_spawn
76+
set -l envs
7677
begin
7778
set st $argv[1]
7879
while read line
79-
contains $line FISH_VERSION PWD SHLVL _ history
80+
contains $line FISH_VERSION PWD _ history
8081
and continue
8182

82-
if test "$line" = status
83+
switch "$line"
84+
case status
8385
echo status $st
84-
else
85-
or echo $line (string escape -- $$line)
86+
case SHLVL
87+
set envs $envs SHLVL=(math $SHLVL - 1)
88+
case '*'
89+
echo $line (string escape -- $$line)
8690
end
8791
end
88-
end | env SHLVL=(math "$SHLVL-1") fish -c 'function __async_prompt_ses
92+
end | read -lz vars
93+
echo $vars | env $envs fish -c 'function __async_prompt_ses
8994
return $argv
9095
end
9196
while read -a line
@@ -116,6 +121,7 @@ if status is-interactive
116121
end
117122
else
118123
echo status
124+
echo SHLVL
119125
end
120126
end
121127

0 commit comments

Comments
 (0)