fish: add helper functions
This commit is contained in:
parent
97eb64c307
commit
48a7512889
12
fish/functions/_confirmation.fish
Normal file
12
fish/functions/_confirmation.fish
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
function _confirmation --description "Ask for user confirmation"
|
||||||
|
while true
|
||||||
|
read --local --prompt-str='Are you sure you want to continue? [y/N] ' confirm
|
||||||
|
|
||||||
|
switch $confirm
|
||||||
|
case Y y
|
||||||
|
return 0
|
||||||
|
case '' N n
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
5
fish/functions/_set_global_if_unset.fish
Normal file
5
fish/functions/_set_global_if_unset.fish
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
function _set_global_if_unset --argument-names variable_name variable_value
|
||||||
|
if not set --query $variable_name
|
||||||
|
set --global $variable_name $variable_value
|
||||||
|
end
|
||||||
|
end
|
@ -1,38 +1,15 @@
|
|||||||
function fish_prompt_git_settings --description 'Configure the git prompt'
|
function fish_prompt_git_settings --description 'Configure the git prompt'
|
||||||
# Toggles
|
# Toggles
|
||||||
#if not set -q __fish_git_prompt_showcolorhints
|
_set_global_if_unset __fish_git_prompt_showdirtystate 1
|
||||||
# set -g __fish_git_prompt_showcolorhints 1
|
_set_global_if_unset __fish_git_prompt_showstashstate 1
|
||||||
#end
|
_set_global_if_unset __fish_git_prompt_showuntrackedfiles 1
|
||||||
if not set -q __fish_git_prompt_showdirtystate
|
_set_global_if_unset __fish_git_prompt_showupstream "none"
|
||||||
set -g __fish_git_prompt_showdirtystate 1
|
|
||||||
end
|
|
||||||
if not set -q __fish_git_prompt_showstashstate
|
|
||||||
set -g __fish_git_prompt_showstashstate 1
|
|
||||||
end
|
|
||||||
if not set -q __fish_git_prompt_showuntrackedfiles
|
|
||||||
set -g __fish_git_prompt_showuntrackedfiles 1
|
|
||||||
end
|
|
||||||
if not set -q __fish_git_prompt_showupstream
|
|
||||||
set -g __fish_git_prompt_showupstream "none"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
if not set -q __fish_git_prompt_color_branch
|
_set_global_if_unset __fish_git_prompt_color_branch magenta
|
||||||
set -g __fish_git_prompt_color_branch cyan
|
_set_global_if_unset __fish_git_prompt_color_dirtystate cyan
|
||||||
end
|
_set_global_if_unset __fish_git_prompt_color_invalidstate red
|
||||||
if not set -q __fish_git_prompt_color_dirtystate
|
_set_global_if_unset __fish_git_prompt_color_stagedstate cyan
|
||||||
set -g __fish_git_prompt_color_dirtystate cyan
|
_set_global_if_unset __fish_git_prompt_color_stashstate cyan
|
||||||
end
|
_set_global_if_unset __fish_git_prompt_color_untrackedfiles cyan
|
||||||
if not set -q __fish_git_prompt_color_invalidstate
|
|
||||||
set -g __fish_git_prompt_color_invalidstate red
|
|
||||||
end
|
|
||||||
if not set -q __fish_git_prompt_color_stagedstate
|
|
||||||
set -g __fish_git_prompt_color_stagedstate cyan
|
|
||||||
end
|
|
||||||
if not set -q __fish_git_prompt_color_stashstate
|
|
||||||
set -g __fish_git_prompt_color_stashstate cyan
|
|
||||||
end
|
|
||||||
if not set -q __fish_git_prompt_color_untrackedfiles
|
|
||||||
set -g __fish_git_prompt_color_untrackedfiles cyan
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user