I lost some time on it so I'm creating this Q&A.
I'm using an omf theme and I would like to make a change in the theme prompt. Unfortunately, the change I want to do is not possible by setting the theme config variables.
I tried to edit fish_prompt
function using funced fish_prompt; funcsave fish_prompt
but if I do so the theme is not loaded anymore so I can't use the functions defined within the theme. The same happens if I just create a fish_prompt
function in my config.fish.
tldr
add these lines before you define your own
fish_prompt
functionexplanation
When omf is loaded, it add the theme functions files to the
$fish_function_path
. (source code)According to fish documentation
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:
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 sureomf.fish
is in an alphabetical order lesser than your file.