Back to Fish

fish_mode_prompt - define the appearance of the mode indicator¶

docs/docs/4.0b1/cmds/fish_mode_prompt.html

latest1.6 KB
Original Source

fish_mode_prompt - define the appearance of the mode indicator

Synopsis

fish\_mode\_prompt
function fish\_mode\_promptecho -n "$fish\_bind\_mode "end

Description

The fish_mode_prompt function outputs the mode indicator for use in vi mode.

The default fish_mode_prompt function will output indicators about the current vi editor mode displayed to the left of the regular prompt. Define your own function to customize the appearance of the mode indicator. The $fish_bind_mode variable can be used to determine the current mode. It will be one of default, insert, replace_one, or visual.

You can also define an empty fish_mode_prompt function to remove the vi mode indicators:

function fish\_mode\_prompt; endfuncsave fish\_mode\_prompt

fish_mode_prompt will be executed when the vi mode changes. If it produces any output, it is displayed and used. If it does not, the other prompt functions (fish_prompt and fish_right_prompt) will be executed as well in case they contain a mode display.

Example

function fish\_mode\_promptswitch $fish\_bind\_modecase defaultset\_color --bold redecho 'N'case insertset\_color --bold greenecho 'I'case replace\_oneset\_color --bold greenecho 'R'case visualset\_color --bold brmagentaecho 'V'case '\*'set\_color --bold redecho '?'endset\_color normalend

Outputting multiple lines is not supported in fish_mode_prompt.