github-theme-contrib icon indicating copy to clipboard operation
github-theme-contrib copied to clipboard

Extra: fish shell syntax

Open adrian5 opened this issue 3 years ago • 1 comments

Would be nice to have matching fish shell highlights for the GitHub theme. The shell theme applies to interactively typed commands (e.g. echo -e "Foo\nBar"), not the output of the terminal, which is covered by terminal themes of course.

I'm currently trying the light variant of github-nvim-theme and really like it so far. If you want, I could try creating at least a light variant and maybe extend from there to dark and the sub-variants. Unlike terminal colors, it's not quite so obvious how to display all the items that need to be styled.

Edit: just saw you're generating these from a script, for all variants. Would have to figure out good defaults first I guess, and then apply them across the board.

adrian5 avatar Jun 09 '22 14:06 adrian5

This turns out to be rather involved, and the fish documentation is not very instructive on how to trigger all these items. I've tried adding descriptions that should help. Some items already have a fitting default color, so could be left out in theory.

One good thing is that fish can use the terminal's palette, so one doesn't need to redefine all colors. For more control, that's possible however.

~/.config/fish/config.fish:

# Theme
source ~/.config/fish/themes/github.fish

~/.config/fish/theme/github.fish:

# GitHub Color palette
# (Taken from 'github-nvim-theme')
set -l comment 6a737d # Too dark?
set -l selection dbe9f9

# Shell highlight groups
# (https://fishshell.com/docs/current/interactive.html#variables-color)

set -g fish_color_normal brwhite  # Default text
set -g fish_color_command brwhite  # `cd`, `ls`, `echo`
# set -g fish_color_keyword red  # `if`   NOTE: default = $fish_color_command
set -g fish_color_quote green  # "foo" in `echo "foo"`
# set -g fish_color_redirection magenta  # `>/dev/null`   NOTE: default = magenta
# set -g fish_color_end blue  # ; in `cmd1; cmd2`   NOTE: default = blue
# set -g fish_color_error red  # incomplete / non-existent commands   NOTE: default = red
set -g fish_color_param blue  # xvf in `tar xvf`, --all in `ls --all`
set -g fish_color_comment $comment  # `# a comment` # Question: Where does default come from if not set?
set -g fish_color_selection --background=$selection # Run `fish_vi_key_bindings`, type some text, <Esc> then `v` to select text
set -g fish_color_operator red  # * in `ls ./*`
# set -g fish_color_escape cyan  # \u2586 in `echo \u2586` NOTE: default = cyan
set -g fish_color_autosuggestion $comment  # Appended virtual text, e.g. `cd  ` displaying `cd ~/some/path`
# set -g fish_color_search_match --background=red   # TODO: How to trigger?

set -g fish_pager_color_completion $fish_color_param # List of suggested items for `ls <Tab>`
set -g fish_pager_color_description green  # (command) in list of commands for `c<Tab>`
set -g fish_pager_color_prefix red --underline  # Leading 'c' in list of completions for `c<Tab>`
set -g fish_pager_color_progress brwhite  # '…and nn more rows' for `c<Tab>`
set -g fish_pager_color_selected_background --background=$selection # Cursor when <Tab>ing through `ls <Tab>`

adrian5 avatar Jun 10 '22 17:06 adrian5