Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fish Shell: How can I customize the colors for the autocomplete feature?

I started using Fish (and oh-my-fish) a couple of weeks ago and one of the things that I find somewhat visually hard is the default background color of the autocomplete options (see the purple background in the image). I tried looking in the Fish page, but couldn't find anything related to that. I'd like to know how that background color can be changed. In case you're wondering, I'm using LXTerminal in LUbuntu (a Ubuntu distro with LXDE).

enter image description here

like image 669
Roberto S. Avatar asked Mar 22 '17 15:03

Roberto S.


People also ask

How do I customize my fish shell prompt?

fish is empty by default. To create a custom prompt create a file ~/. config/fish/functions/fish_prompt. fish and fill it with your prompt.

How do you set up a fish shell?

Simply run fish_config to open the web client. From there, you can choose the themes, colors, prompts, inspect the FSH functions and variables, and see the history of commands used. Changes are, in turn, stored in the ~/. config/fish folder and can be accessed and edited there to dodge the optional web configuration.

How do you set a variable in a fish shell?

To give a variable to an external command, it needs to be “exported”. Unlike other shells, fish does not have an export command. Instead, a variable is exported via an option to set , either --export or just -x .


3 Answers

it's more convenient to setup all color configuration via fish web UI, which can be done from cli:

fish_config colors, which launches the config server of fish, and there are already tons of predefined color suggestion

For more info, check out The Fish Shell

like image 63
LarryK Avatar answered Oct 19 '22 00:10

LarryK


I found it, after checking these docs, and doing some trial and error with different environment variables that might be responsible for that feature. The environment variable is fish_color_search_match

and the solution is changing the variable like:

$ set fish_color_search_match --background='333'

Where '333' is the color code. It is also possible to use predefined colors like cyan, green, blue, etc. that are available.

Also, I'm aware that maybe this belongs better in Unix&Linux StackExchange (which might have been the reason for the downvote?)

Edit: Take into account that colors will not look correctly if your terminal is not using 256 colors.

like image 22
Roberto S. Avatar answered Oct 18 '22 22:10

Roberto S.


Adding to top voted answer. The command fish_config colors has been removed and you should instead use the following:

$ fish_config browse
like image 2
Alexander Törnvall Avatar answered Oct 18 '22 22:10

Alexander Törnvall