Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make SHLVL correction can be disabled by configuration #22

Merged
merged 1 commit into from
Nov 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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