From 96f7924661016a29231c2523f68c794dcb2e5a89 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 7 Jan 2019 17:24:17 +0100 Subject: [PATCH] Fix nim prompt (via web_config) This had a helper function defined outside of the fish_prompt function, so `funcsave` missed it (see #736). Fixes #5490. [ci skip] --- .../tools/web_config/sample_prompts/nim.fish | 83 ++++++++++--------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/share/tools/web_config/sample_prompts/nim.fish b/share/tools/web_config/sample_prompts/nim.fish index b935f8413..93c574dd5 100644 --- a/share/tools/web_config/sample_prompts/nim.fish +++ b/share/tools/web_config/sample_prompts/nim.fish @@ -1,49 +1,50 @@ # name: Nim # author: Guilhem "Nim" Saurel − https://github.com/nim65s/dotfiles/ -# This prompt shows: -# - green lines if the last return command is OK, red otherwise -# - your user name, in red if root or yellow otherwise -# - your hostname, in cyan if ssh or blue otherwise -# - the current path (with prompt_pwd) -# - date +%X -# - the current virtual environment, if any -# - the current git status, if any, with __fish_git_prompt -# - the current battery state, if any, and if your power cable is unplugged, and if you have "acpi" -# - current background jobs, if any - -# It goes from: -# ┬─[nim@Hattori:~]─[11:39:00] -# ╰─>$ echo here - -# To: -# ┬─[nim@Hattori:~/w/dashboard]─[11:37:14]─[V:django20]─[G:master↑1|●1✚1…1]─[B:85%, 05:41:42 remaining] -# │ 2 15054 0% arrêtée sleep 100000 -# │ 1 15048 0% arrêtée sleep 100000 -# ╰─>$ echo there - -set __fish_git_prompt_showupstream auto - -function _nim_prompt_wrapper - set retc $argv[1] - set field_name $argv[2] - set field_value $argv[3] - - set_color normal - set_color $retc - echo -n '─' - set_color -o green - echo -n '[' - set_color normal - test -n $field_name - and echo -n $field_name: - set_color $retc - echo -n $field_value - set_color -o green - echo -n ']' -end function fish_prompt + # This prompt shows: + # - green lines if the last return command is OK, red otherwise + # - your user name, in red if root or yellow otherwise + # - your hostname, in cyan if ssh or blue otherwise + # - the current path (with prompt_pwd) + # - date +%X + # - the current virtual environment, if any + # - the current git status, if any, with __fish_git_prompt + # - the current battery state, if any, and if your power cable is unplugged, and if you have "acpi" + # - current background jobs, if any + + # It goes from: + # ┬─[nim@Hattori:~]─[11:39:00] + # ╰─>$ echo here + + # To: + # ┬─[nim@Hattori:~/w/dashboard]─[11:37:14]─[V:django20]─[G:master↑1|●1✚1…1]─[B:85%, 05:41:42 remaining] + # │ 2 15054 0% arrêtée sleep 100000 + # │ 1 15048 0% arrêtée sleep 100000 + # ╰─>$ echo there + + set -q __fish_git_prompt_showupstream + or set -g __fish_git_prompt_showupstream auto + + function _nim_prompt_wrapper + set retc $argv[1] + set field_name $argv[2] + set field_value $argv[3] + + set_color normal + set_color $retc + echo -n '─' + set_color -o green + echo -n '[' + set_color normal + test -n $field_name + and echo -n $field_name: + set_color $retc + echo -n $field_value + set_color -o green + echo -n ']' + end and set retc green or set retc red