A Fish prompt that automatically adds OS-flavored symbols to your prompt.
Install with Fisher.
$ fisher install eholic/osflavor
Use (__osflavor)
to customize your ~/config/fish/functions/fish_prompt.fish
.
Then osflavor
will automatically uses OS-flavored symbols. Here's an example.
function fish_prompt
set -g __osflavor_last_status $status # must be first line of code
# the rest of your prompt...
echo -n -s (__osflavor) (__fish_git_prompt " %s") ' '
end
If you are using Nerd Font
You can use a single character os icon by adding the following option in your ~/.config/fish/config.fish
.
set -g __osflavor_use_nerd_font_icon 1
# must be before using (__osflavor)
🙏 I got all definitions from IlanCosman/tide.
Add the following option in your ~/.config/fish/config.fish
.
set -g tide_character_icon (__osflavor)
set -g pure_symbol_prompt (__osflavor)
set -g hydro_symbol_prompt (__osflavor)
Default symbols are defined in conf.d/osflavor.fish and conf.d/__osflavor_nerd.fish.
If you want to change the default symbols, see Customization.
osflavor list
lists pre-defined symbols.osflavor set
<name>
sets prompt as the other distribution.osflavor set
clears aboveset <name>
.
The prompt symbols for each distribution can be specified using __osflavor_dist_<name>
(global variable).
<name>
should be a lowercased substring contained within uname -a
.
# ~/.config/fish/config.fish
set -g __osflavor_dist_xlinxmint (set_color red)">"
# Overwrite pre-defined symbols.
set -g __osflavor_dist_darwin ">"
set -g __osflavor_dist_centos (set_color 9ccd2a)"⬉"(set_color a14f8c)"⬈"(set_color efa724)"⬊"(set_color 262577)"⬋"