Skip to content
Jean-Philippe Roemer edited this page Mar 2, 2016 · 2 revisions

##### :construction: This page is deprecated with the release of Fishline v2.0.0 and need to be updated :construction:

As fishline uses a lot of function and variable, we decided to define a naming convention to make code more readable and clearer for everyone.

Segments

Segment names MUST begin with FLSEG_ and his name MUST be in UPPERCASE. His name is used in FLINE_PROMT to call the right function.

Filename should be the the name of the segment in lowercase followed by .fish.

This has been added to be sure that none of the segment overides shell internals/commands.

Example:

# File: name.fish
function FLSEG_NAME
    ...
end

Theme and Colors

Theme file should be called theme_name.fish, the user will have to source it manually so it's up to you to choose the name. Every color variables in your themes/segments should begin with FLCR_ followed by the segment name in UPPERCASE then FG or BG and additonally if needed the part that it colorize in UPPERCASE.

Example:

# File: theme.fish
set FLCLR_GIT_FG_CLEAN    black

Internals and events

You might want to add your own events or internals to the project, events name should begin with FLEVENT_ and then the segment/the event related to in UPPERCASE. The second part of the function name should be the file name followed by .fish and written in lowercase.

Inernals should begin with FLINT_ followed by the variable name in UPPERCASE.

Example:

# File: segv.fish
function FLEVENT_SEGV --on-variable status
   if [ $status -eq 139 ]
      set FLINT_SEGV True
   end
end

Segment Variable

If you need custom variables in the global scope for you segment, they MUST begin with FLVAR_ followed by the segment name in UPPERCASE and then the variable name in UPPERCASE

Example:

set -g FLVAR_NAME_VAR content

Glyph and Symbols

Glyph and symbol should be added to the segment's file they belong to, the should be named 'FLSYM_' followed by segment names in UPPERCASE followed by the glyp/symbol name in UPPERCASE.

Example:

#File: segment.fish
set FLSYM_SEGMENT_GLYPH "··"

function FLSEG_NAME
    ---
end