mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 22:44:01 +00:00
Repaint all prompts if the variables change
This is a good idea in general and simplifies the Classic + VCS prompt.
This commit is contained in:
parent
00fc36c3eb
commit
d91b0f86f4
2 changed files with 15 additions and 40 deletions
|
@ -139,7 +139,11 @@ function __fish_config_interactive -d "Initializations that should be performed
|
||||||
# fish_color_cwd{,_root} changes value. Like all event handlers, it can't be
|
# fish_color_cwd{,_root} changes value. Like all event handlers, it can't be
|
||||||
# autoloaded.
|
# autoloaded.
|
||||||
#
|
#
|
||||||
function __fish_repaint -v fish_color_cwd -v fish_color_cwd_root -d "Event handler, repaints the prompt when fish_color_cwd* changes"
|
set -l varargs --on-variable fish_key_bindings
|
||||||
|
for var in user host cwd{,_root} status
|
||||||
|
set -a varargs --on-variable fish_color_$var
|
||||||
|
end
|
||||||
|
function __fish_repaint $varargs -d "Event handler, repaints the prompt when fish_color_cwd* changes"
|
||||||
if status --is-interactive
|
if status --is-interactive
|
||||||
set -e __fish_prompt_cwd
|
set -e __fish_prompt_cwd
|
||||||
commandline -f repaint 2>/dev/null
|
commandline -f repaint 2>/dev/null
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# name: Classic + Vcs
|
# name: Classic + Vcs
|
||||||
# author: Kevin Ballard
|
# author: Lily Ballard
|
||||||
# vim: set noet:
|
# vim: set noet:
|
||||||
|
|
||||||
function fish_prompt --description 'Write out the prompt'
|
function fish_prompt --description 'Write out the prompt'
|
||||||
|
@ -7,34 +7,6 @@ function fish_prompt --description 'Write out the prompt'
|
||||||
set -l last_status $status
|
set -l last_status $status
|
||||||
set -l normal (set_color normal)
|
set -l normal (set_color normal)
|
||||||
|
|
||||||
# Hack; fish_config only copies the fish_prompt function (see #736)
|
|
||||||
if not set -q -g __fish_classic_git_functions_defined
|
|
||||||
set -g __fish_classic_git_functions_defined
|
|
||||||
|
|
||||||
function __fish_repaint_user --on-variable fish_color_user --description "Event handler, repaint when fish_color_user changes"
|
|
||||||
if status --is-interactive
|
|
||||||
commandline -f repaint 2>/dev/null
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function __fish_repaint_host --on-variable fish_color_host --description "Event handler, repaint when fish_color_host changes"
|
|
||||||
if status --is-interactive
|
|
||||||
commandline -f repaint 2>/dev/null
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function __fish_repaint_status --on-variable fish_color_status --description "Event handler; repaint when fish_color_status changes"
|
|
||||||
if status --is-interactive
|
|
||||||
commandline -f repaint 2>/dev/null
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function __fish_repaint_bind_mode --on-variable fish_key_bindings --description "Event handler; repaint when fish_key_bindings changes"
|
|
||||||
if status --is-interactive
|
|
||||||
commandline -f repaint 2>/dev/null
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# initialize our new variables
|
# initialize our new variables
|
||||||
if not set -q __fish_classic_git_prompt_initialized
|
if not set -q __fish_classic_git_prompt_initialized
|
||||||
set -qU fish_color_user
|
set -qU fish_color_user
|
||||||
|
@ -45,7 +17,6 @@ function fish_prompt --description 'Write out the prompt'
|
||||||
or set -U fish_color_status red
|
or set -U fish_color_status red
|
||||||
set -U __fish_classic_git_prompt_initialized
|
set -U __fish_classic_git_prompt_initialized
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
set -l color_cwd
|
set -l color_cwd
|
||||||
set -l prefix
|
set -l prefix
|
||||||
|
|
Loading…
Reference in a new issue