-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Allow disabling autosuggestions and syntax highlighting #8376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This adds a variable, $fish_autosuggestion_enabled. When set to 0, it will turn off autosuggestions/highlighting. Setting it to anything else will enable it (which also means this remains enabled by default).
This basically disables syntax highlighting. That doesn't mean we use absolutely no colors - the search match, suggestion, selection and the pager have coloring, but only reverse or brblack. The idea is that this disables anything that tells you about the *syntax*, but it still tells you about the state of the commandline. If we didn't highlight the selection it would be entirely invisible, and if we didn't highlight the suggestion you would have no idea where it begins. So this basically brings colors on-par with bash, where the search match is colored (in reverse) and suggestions aren't a thing. An alternative is to add a $fish_highlighting_enabled variable like the one for suggestions. That's still possible, but would require some internal changes to avoid coloring some things with $fish_color_normal and other things with the normal terminal color. One thing this also does not do is set the git prompt colors. These are currently disallowed from being set in theme files because they start with `__fish` instead of just `fish`. We should probably rename them.
Also add more mentions of `fish_config` in general.
|
Note: A bunch of prompts will have their own coloring. I think for coloring things like $PWD or user@host normally, we might want to move these to the common variables. That's excluding places where the prompts do their own thing - e.g. scales has that three-colored fish display, disco has a $PWD color derived from the hash. |
| @@ -0,0 +1,31 @@ | |||
| # name: '(Almost) No Colors' | |||
| # preferred_background: 'black' | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this theme - I like to read code on my grayscale e-ink screen, and I sometimes can't read text if the background and foreground are too similar. This fixes those issues, very nice!
Actually the one issue I have in mind is that search matches (fish_color_search_match) are combined with other syntax highlighting (instead of overriding them), which can make them hard to read, even on a screen that already supports colors.
So if I type echo Up and the matching echo is in command position, the default theme will give it dark blue foreground, and as a search match it has black background background (on a light-themed terminal).
If the search match is an argument, it's better because that's lighter by default.
I wonder if we can/should disable our semantic syntax highlighting inside search matches.
I want to try if this makes things better.
| fish_pager_color_description brblack | ||
| fish_pager_color_prefix '--underline' | ||
| fish_pager_color_progress brblack | ||
| fish_pager_color_selected_background --background=brblack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be
| fish_pager_color_selected_background --background=brblack | |
| fish_pager_color_selected_background -r |
Otherwise I can't read the selected completion (+ description) in the pager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using gnome-terminal which likes to draw bright colors a little bit darker than other terminals 😕
with -r
to get rid of the inconsistency with the description, we could use nevermind, this screenshot looks fine to meset fish_pager_color_description normal on top of that. Sadly that removes the nice gray tone for descriptions.. so I'd leave it.
(technically introduced after this)
Otherwise, with a light-theme, the selected entry uses black text with "bright black" background, which can be low contrast thus hard to read. The description background is different, maybe we can fix that later. See #8376




Description
This allows essentially disabling autosuggestions and syntax highlighting.
For autosuggestions, it adds a variable $fish_autosuggestion_enabled. If set to 0, this will disable suggestions. If set to anything else (or unset), it will keep them enabled.
For highlighting, it adds a "none" theme that disables most colors. It keeps colors for the search match, selection, suggestions and pager descriptions, but sets them to either brblack or --reverse. Everything else is set to "normal". Especially the selection and pager need to have color or they aren't discernable at all.
The rationale here is that these features don't impact any scripting. They don't create a language dialect. They also aren't hard to implement, especially since the suggestions change is already implemented (to allow for interactive
read).So we should allow for simple matters of taste.
One issue here is that the git prompt colors currently can't be set via a theme file,
so most likely the git branch will still show up as green(EDIT: This is incorrect, the branch isn't colored by default, please ignore the green in the below screenshots - it's left over from my config). This would either require us to rename the color variables tofish_color_gitor similar, or allow__fishvariables to be set in themes (this was quite locked down on purpose, so people don't try to put other things in).Screenshots:
(as a personal note, I absolutely hate using fish without suggestions - I feel like I have my arm tied behind my back!)
Fixes #1363.
TODOs: