tldr
add these lines before you define your own fish_prompt
function
source $OMF_PATH/init.fish
# Read current theme
test -f $OMF_CONFIG/theme
and read -l theme < $OMF_CONFIG/theme
or set -l theme default
set -l theme_functions_path {$OMF_CONFIG,$OMF_PATH}/themes*/$theme/functions/
for conf in $theme_functions_path/*.fish
source $conf
end
explanation
When omf is loaded, it add the theme functions files to the $fish_function_path
. (source code)
According to fish documentation
When fish needs to load a function, it searches through any directories in the list variable $fish_function_path for a file with a name consisting of the name of the function plus the suffix .fish and loads the first it finds.
What the documentation doesn't explicitly say is if the function is already defined (in config.fish, for example) it will not try to load from $fish_function_path
.
So the issue is, when you creates your own fish_prompt
function, it shadows the .../<theme>/functions/fish_prompt.fish
.
What you need to do to work around it is force loading the theme function file before you redefine it.
For example:
# Read current theme
test -f $OMF_CONFIG/theme
and read -l theme < $OMF_CONFIG/theme
or set -l theme default
set -l theme_functions_path {$OMF_CONFIG,$OMF_PATH}/themes*/$theme/functions/fish_prompt.fish
for conf in $theme_functions_path
source $conf
end
function fish_prompt
# prompt_theme_foo
# prompt_theme_bar
end
Be sure to run it after omf init.fish is loaded.
You can assure by sourcing omf manually source $OMF_PATH/init.fish
or be sure omf.fish
is in an alphabetical order lesser than your file.