Closed mec07 closed 5 years ago
Some extra info for you:
fish, version 2.7.1
Mac OSX 10.13.6
Iterm2 Build 3.2.3
Thank you for feedback. Please tell me some more.
set -U | grep __async_prompt
I fixed a bug temporary universal variables are not removed so could you update the plugin and try again?
Hi Yuki,
Thanks! :) That seems to have resolved the issue.
There now seems to be a new issue though. What it's doing now is printing the following every time I hit enter:
fish: option requires an argument -- c
cat: /proc/self/stat: No such file or directory
fish: option requires an argument -- c
It looks like this line is the cause: https://github.com/acomagu/fish-async-prompt/blob/master/conf.d/__async_prompt.fish#L142 Probably caused by the fact that you're developing for linux and I'm on Mac OSX.
To answer your first questions:
I didn't configure the plugin. I just added it with fisher (in fact you
should update your README.md to be fisher add acomagu/fish-async-prompt
as it's missing the add
).
Fish prompt file:
function fish_prompt
set -l last_command_status $status
set -l cwd
if test "$theme_short_path" = 'yes'
set cwd (basename (prompt_pwd))
else
set cwd (prompt_pwd)
end
set -l fish "⋊>"
set -l ahead "↑"
set -l behind "↓"
set -l diverged "⥄ "
set -l dirty "⨯"
set -l none "◦"
set -l normal_color (set_color normal)
set -l success_color (set_color $fish_pager_color_progress ^/dev/null;
or set_color cyan)
set -l error_color (set_color $fish_color_error ^/dev/null; or
set_color red --bold)
set -l directory_color (set_color $fish_color_quote ^/dev/null; or
set_color brown)
set -l repository_color (set_color $fish_color_cwd ^/dev/null; or
set_color green)
if test $last_command_status -eq 0
echo -n -s $success_color $fish $normal_color
else
echo -n -s $error_color $fish $normal_color
end
if git_is_repo
if test "$theme_short_path" = 'yes'
set root_folder (command git rev-parse --show-toplevel ^/dev/null)
set parent_root_folder (dirname $root_folder)
set cwd (echo $PWD | sed -e "s|$parent_root_folder/||")
echo -n -s " " $directory_color $cwd $normal_color
else
echo -n -s " " $directory_color $cwd $normal_color
end
echo -n -s " on " $repository_color (git_branch_name) $normal_color " "
if git_is_touched
echo -n -s $dirty
else
echo -n -s (git_ahead $ahead $behind $diverged $none)
end
else
echo -n -s " " $directory_color $cwd $normal_color
end
#######################
# Virtual environment
#######################
echo -n -s " "
if set -q VIRTUAL_ENV
echo -n -s (set_color -b blue white) "(" (basename "$VIRTUAL_ENV") ")"
(set_color normal) " "
end
#######################
# Kubernetes context
#######################
set -l k8s_color (set_color blue)
set -l K8_CONTEXT (kubectl config current-context)
# Extract GCP metadata from the kubectl context name
switch $K8_CONTEXT
case 'gke_*'
# kubectl context isn't a custom one
set FULL_CONTEXT $K8_CONTEXT
case '*'
set FULL_CONTEXT (kubectl config get-contexts $K8_CONTEXT | grep
$K8_CONTEXT | awk '{print $3}' )
end
set -l CLUSTER (echo $FULL_CONTEXT | cut -d_ -f4)
set -l k8s_context $CLUSTER
echo -e -n -s " " $k8s_color "($k8s_context)"
#######################
# New line
#######################
echo -n -s "
> "
end
Getting the kubernetes info is slow but it is very useful -- hence why I want to use your async prompt
The response to the command:
> set -U | grep __async_prompt
__async_prompt_fish_prompt_text_32278 \e\[97m\e\[46m⋊\>\e\[30m\e\(B\e\[m\
\e\[33m\~/d/thesis\e\[30m\e\(B\e\[m\ on\ \e\[32mm…
__async_prompt_fish_prompt_text_5231 \e\[91m⋊\>\e\[30m\e\(B\e\[m\
\e\[33m\~/i/groupon-api-adapter\e\[30m\e\(B\e\[m\ o…
__async_prompt_fish_right_prompt_text_32278
__async_prompt_fish_right_prompt_text_5231
On Wed, 17 Oct 2018 at 04:53, Yuki Ito notifications@github.com wrote:
I fixed a bug temporary universal variables are not removed so could you update the plugin and try again?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/acomagu/fish-async-prompt/issues/3#issuecomment-430480657, or mute the thread https://github.com/notifications/unsubscribe-auth/AG77vPzfu5cABd9P_nRqRik3kLLlCfYTks5ulqm8gaJpZM4XXguP .
Hi,
I've looked into it a little more and I've found an autogenerated file called ~/.config/fish/fishd.f07960158f86
which has the following contents:
# This file is automatically generated by the fish.
# Do NOT edit it directly, your changes will be overwritten.
SET __async_prompt_fish_prompt_text_26996:\x1b\x5b97m\x1b\x5b46m\u22ca\x3e\x1b\x5b30m\x1b\x28B\x1b\x5bm\x20\x1b\x5b33m\x7e/d/thesis\x1b\x5b30m\x1b\x28B\x1b\x5bm\x20on\x20\x1b\x5b32mmaster\x1b\x5b30m\x1b\x28B\x1b\x5bm\x20\u2a2f\x20\x20\x1b\x5b34m\x28london\x29\x1e\x3e\x20
SET __async_prompt_fish_prompt_text_32278:\x1b\x5b97m\x1b\x5b46m\u22ca\x3e\x1b\x5b30m\x1b\x28B\x1b\x5bm\x20\x1b\x5b33m\x7e/d/thesis\x1b\x5b30m\x1b\x28B\x1b\x5bm\x20on\x20\x1b\x5b32mmaster\x1b\x5b30m\x1b\x28B\x1b\x5bm\x20\u2a2f\x20\x20\x1b\x5b34m\x28draco\x29\x1e\x3e\x20
SET __async_prompt_fish_right_prompt_text_32278:\x1d
SET __fish_init_2_39_8:\x1d
SET __fish_init_2_3_0:\x1d
SET fish_color_autosuggestion:555\x1ebrblack
SET fish_color_command:\x2d\x2dbold
SET fish_color_comment:red
SET fish_color_cwd:green
SET fish_color_cwd_root:red
SET fish_color_end:brmagenta
SET fish_color_error:brred
SET fish_color_escape:bryellow\x1e\x2d\x2dbold
SET fish_color_history_current:\x2d\x2dbold
SET fish_color_host:normal
SET fish_color_match:\x2d\x2dbackground\x3dbrblue
SET fish_color_normal:normal
SET fish_color_operator:bryellow
SET fish_color_param:cyan
SET fish_color_quote:yellow
SET fish_color_redirection:brblue
SET fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
SET fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
SET fish_color_user:brgreen
SET fish_color_valid_path:\x2d\x2dunderline
SET fish_greeting:\x1d
SET fish_key_bindings:fish_default_key_bindings
SET fish_pager_color_completion:\x1d
SET fish_pager_color_description:B3A06D\x1eyellow
SET fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SET fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SET fish_user_paths:/Users/mcoury/\x2efzf/bin
It seems like something is going slightly wrong...
Actually when I open up a new terminal now I no longer have a prompt, I only have the error!
cat: /proc/self/stat: No such file or directory
fish: option requires an argument -- c
cat: /proc/self/stat: No such file or directory
fish: option requires an argument -- c
I can enter commands, but I don't see a prompt anymore.
I've made a PR to fix this issue: #4 Please review when you get a moment :)
Thank you for PR! I'm really sorry for breaking your shell by an other change. I don't have any macOS PC so it's really hard to test...
Unfortunately I still seem to be getting
fish: Locking the universal var file took too long (0.577 seconds).
Hmm. I'll try to reproduce the problem with your configuration file. Thank you for giving the informations.
I created another branch has only related changes: warn-looking-var
On this branch, the problem missing /proc/stat
won't occur.
Thanks. I've had a look at the fish github and I think you'll find this interesting: https://github.com/fish-shell/fish-shell/blob/786c0c5abb936eeb10eae45b508132a313bc8abc/CHANGELOG.md#notable-non-backward-compatible-changes
Perhaps we could just make the function check the new format $fish_pid
and if that is empty then return the old format %self
. I'll update the PR.
I merged #4. Thanks a lot!
Awesome plugin. I really like it. There are a couple of issues. If you hit enter several times you get this error message (after which it blocks for a little bit):
<W> fish: Locking the universal var file took too long (1.001 seconds).
Also it ignores new lines in my fish prompt :(
Thanks for making it!