Introduce set_color_custom. Close #144.

This commit is contained in:
Jorge Bucaran 2016-03-06 03:04:49 +09:00
parent ef0cb93853
commit d57ad028e6
No known key found for this signature in database
GPG key ID: E54BA3C0E646DB30
5 changed files with 104 additions and 2 deletions

View file

@ -1,5 +1,17 @@
# Change Log
## [1.2.0][v120] - Not released yet
* Introduce set_color_custom function that prompts can define to customize *fish_color_* variables. The user current color palette is saved to $fisher_config/fish_colors and restored when the prompt is disabled #144.
## [1.1.0][v110] - 2016-03-02
* Fix regression causing update to fail in some plugins. aa8a98a
* Be more secretive about index updates. c0c7f6a
* Move debug from __fisher_plugin_source to before call. 8fd8dc0
* Add ascii cast. c4c9577
## [1.0.0][v100] - 2016-03-01
* Deprecate fisher --list in favor of a new command fisher list. The behavior is roughly the same. See fisher help list for usage. tl;dr: Use list to query the local system / cache and search to query the index.
@ -336,6 +348,8 @@
<!-- Links -->
[v120]: https://github.com/fisherman/fisherman/releases/tag/1.2.0
[v110]: https://github.com/fisherman/fisherman/releases/tag/1.1.0
[v100]: https://github.com/fisherman/fisherman/releases/tag/1.0.0
[v090]: https://github.com/fisherman/fisherman/releases/tag/0.9.0
[v080]: https://github.com/fisherman/fisherman/releases/tag/0.8.0

View file

@ -0,0 +1,53 @@
function __fisher_config_color_reset
if test ! -f "$fisher_config/fish_colors"
set -U fish_color_normal normal
set -U fish_color_command 005fd7 purple
set -U fish_color_param 00afff cyan
set -U fish_color_redirection normal
set -U fish_color_comment red
set -U fish_color_error red --bold
set -U fish_color_escape cyan
set -U fish_color_operator cyan
set -U fish_color_quote brown
set -U fish_color_autosuggestion 555 yellow
set -U fish_color_valid_path --underline
set -U fish_color_cwd green
set -U fish_color_cwd_root red
set -U fish_color_match cyan
set -U fish_color_search_match --background=purple
set -U fish_color_selection --background=purple
set -U fish_pager_color_prefix cyan
set -U fish_pager_color_completion normal
set -U fish_pager_color_description 555 yellow
set -U fish_pager_color_progress cyan
set -U fish_color_history_current cyan
return
end
read -laz fish_colors < $fisher_config/fish_colors
set -U fish_color_normal $fish_colors[1]
set -U fish_color_command $fish_colors[2]
set -U fish_color_param $fish_colors[3]
set -U fish_color_redirection $fish_colors[4]
set -U fish_color_comment $fish_colors[5]
set -U fish_color_error $fish_colors[6]
set -U fish_color_escape $fish_colors[7]
set -U fish_color_operator $fish_colors[8]
set -U fish_color_quote $fish_colors[9]
set -U fish_color_autosuggestion $fish_colors[10]
set -U fish_color_valid_path $fish_colors[11]
set -U fish_color_cwd $fish_colors[12]
set -U fish_color_cwd_root $fish_colors[13]
set -U fish_color_match $fish_colors[14]
set -U fish_color_search_match $fish_colors[15]
set -U fish_color_selection $fish_colors[16]
set -U fish_pager_color_prefix $fish_colors[17]
set -U fish_pager_color_completion $fish_colors[18]
set -U fish_pager_color_description $fish_colors[19]
set -U fish_pager_color_progress $fish_colors[20]
set -U fish_color_history_current $fish_colors[21]
rm -f $fisher_config/fish_colors
end

View file

@ -0,0 +1,26 @@
function __fisher_config_color_save
if test ! -f "$fisher_config/fish_colors"
printf "%s\n" \
$fish_color_normal \
$fish_color_command \
$fish_color_param \
$fish_color_redirection \
$fish_color_comment \
$fish_color_error \
$fish_color_escape \
$fish_color_operator \
$fish_color_quote \
$fish_color_autosuggestion \
$fish_color_valid_path \
$fish_color_cwd \
$fish_color_cwd_root \
$fish_color_match \
$fish_color_search_match \
$fish_color_selection \
$fish_pager_color_prefix \
$fish_pager_color_completion \
$fish_pager_color_description \
$fish_pager_color_progress \
$fish_color_history_current > "$fisher_config/fish_colors"
end
end

View file

@ -12,6 +12,10 @@ function __fisher_plugin_disable -a plugin path option
case \*
__fisher_plugin_unlink $fisher_config/$target $name
if test "$name" = set_color_custom
__fisher_config_color_reset
end
end
end

View file

@ -3,7 +3,7 @@ function __fisher_plugin_enable -a plugin path
if __fisher_path_is_prompt $path
if test ! -z "$fisher_prompt"
debug "Enable prompt %s" $plugin
debug "Disable prompt %s" $fisher_prompt
__fisher_plugin_disable "$fisher_prompt" "$fisher_cache/$fisher_prompt"
end
@ -16,7 +16,7 @@ function __fisher_plugin_enable -a plugin path
set link -sfF
end
__fisher_plugin_walk "$plugin" "$path" | while read -l class source target __unused
__fisher_plugin_walk "$plugin" "$path" | while read -l class source target name
switch "$class"
case --bind
debug "Bind %s" $source
@ -35,6 +35,11 @@ function __fisher_plugin_enable -a plugin path
if test "$class" = --source
debug "Source %s" "$fisher_config/$target"
__fisher_plugin_source $plugin $fisher_config/$target
if test "$name" = set_color_custom
__fisher_config_color_save
set_color_custom
end
end
end
end