Skip to content

Commit

Permalink
Merge pull request #22 from acomagu/configurable-shlvl
Browse files Browse the repository at this point in the history
Make SHLVL correction can be disabled by configuration
  • Loading branch information
acomagu authored Nov 1, 2019
2 parents aff9c3c + aee599c commit 75c2a14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If your prompt don't work correctly, try changeing the configuration.

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

**Default:** `status`
**Default:** `status SHLVL`

### Variable: `async_prompt_functions`

Expand Down
16 changes: 11 additions & 5 deletions conf.d/__async_prompt.fish
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,24 @@ if status is-interactive
end

function __async_prompt_spawn
set -l envs
begin
set st $argv[1]
while read line
contains $line FISH_VERSION PWD SHLVL _ history
contains $line FISH_VERSION PWD _ history
and continue

if test "$line" = status
switch "$line"
case status
echo status $st
else
or echo $line (string escape -- $$line)
case SHLVL
set envs $envs SHLVL=(math $SHLVL - 1)
case '*'
echo $line (string escape -- $$line)
end
end
end | env SHLVL=(math "$SHLVL-1") fish -c 'function __async_prompt_ses
end | read -lz vars
echo $vars | env $envs fish -c 'function __async_prompt_ses
return $argv
end
while read -a line
Expand Down Expand Up @@ -116,6 +121,7 @@ if status is-interactive
end
else
echo status
echo SHLVL
end
end

Expand Down

0 comments on commit 75c2a14

Please sign in to comment.