diff options
author | 2015-08-17 17:32:45 +0200 | |
---|---|---|
committer | 2015-08-30 18:30:03 +0200 | |
commit | f71e877f18037f71c00f81e30c1173f51c42a58c (patch) | |
tree | 73a88a49c05770d144c14f67e66fb773252eac05 /share/functions/__fish_config_interactive.fish | |
parent | d6c97a6a1379526bc2c84210efc5f562a61ffb6d (diff) |
Improve situation for linux in-kernel VTs (TERM = "linux")
This adds a special colorscheme and prompt function guaranteed to work
on a VT and activates them automatically if $TERM = "linux".
set_color is overridden to only allow the 8 colors VTs have (under the
assumption those are always the same) and the color variables are
shadowed with global ones so they don't pollute our nice capable terms.
Diffstat (limited to 'share/functions/__fish_config_interactive.fish')
-rw-r--r-- | share/functions/__fish_config_interactive.fish | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 26eb690d..fa1e140d 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -254,4 +254,62 @@ function __fish_config_interactive -d "Initializations that should be performed end __fish_command_not_found_handler $argv end + if test $TERM = "linux" # A linux in-kernel VT with 8 colors and 256/512 glyphs + # In a VT we have + # black (invisible) + # red + # green + # yellow + # blue + # magenta + # cyan + # white + + # Pretty much just set at random + set -g fish_color_normal normal + set -g fish_color_command yellow + set -g fish_color_param cyan + set -g fish_color_redirection normal + set -g fish_color_comment red + set -g fish_color_error red + set -g fish_color_escape cyan + set -g fish_color_operator cyan + set -g fish_color_quote blue + set -g fish_color_autosuggestion yellow + set -g fish_color_valid_path + set -g fish_color_cwd green + set -g fish_color_cwd_root red + set -g fish_color_match cyan + set -g fish_color_history_current cyan + set -g fish_color_search_match cyan + set -g fish_color_selection blue + set -g fish_color_end yellow + set -g fish_color_host normal + set -g fish_color_status red + set -g fish_color_user green + set -g fish_pager_color_prefix cyan + set -g fish_pager_color_completion normal + set -g fish_pager_color_description yellow + set -g fish_pager_color_progress cyan + + # Don't allow setting color other than what linux offers (see #2001) + functions -e set_color + function set_color + set -l term_colors black red green yellow blue magenta cyan white normal + for a in $argv + if not contains -- $a $term_colors + echo "Color not valid in TERM = linux: $a" + return 1 + end + end + builtin set_color $argv + return $status + end + + # Set fish_prompt to a VT-friendly version + # without color or unicode + function fish_prompt + fish_fallback_prompt + end + end end |