fishline!

This commit is contained in:
Zoe 2022-04-22 16:15:09 +02:00
parent 32babacd09
commit da454a7247
46 changed files with 1507 additions and 6 deletions

7
completions/fisher.fish Normal file
View file

@ -0,0 +1,7 @@
complete --command fisher --exclusive --long help --description "Print help"
complete --command fisher --exclusive --long version --description "Print version"
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins"
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins"
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins"
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex"
complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)"

View file

@ -0,0 +1,8 @@
complete -c fishline --no-files
complete -c fishline -a "(fishline -x)"
complete -c fishline -x -n __fish_use_subcommand -s s -d "Set the last command status exit code"
complete -c fishline -n __fish_use_subcommand -s l -d "Generate a fish_prompt"
complete -c fishline -n __fish_use_subcommand -s r -d "Generate a fish_right_prompt"
complete -c fishline -x -n __fish_use_subcommand -s x -d "Print the list of availlable segment and exit"
complete -c fishline -x -n __fish_use_subcommand -s v -d "Print the software version and exit"
complete -c fishline -x -n __fish_use_subcommand -s h -d "Print help message"

View file

@ -0,0 +1,87 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
# Color for PWD and FULLPWD segment
set FLCLR_PWD_BG_HOME cyan
set FLCLR_PWD_FG_HOME black
set FLCLR_PWD_BG cyan
set FLCLR_PWD_FG black
set FLCLR_FULLPWD_BG $FLCLR_PWD_BG
set FLCLR_FULLPWD_FG $FLCLR_PWD_FG
# Color for STATUS segment
set FLCLR_STATUS_BG red
set FLCLR_STATUS_FG normal
# Color for WRITE segment
set FLCLR_WRITE_BG red
set FLCLR_WRITE_FG normal
# Color for ARROW segment
set FLCLR_ARROW_BG brblack
set FLCLR_ARROW_FG white
# Color for ROOT segment
set FLCLR_ROOT_BG_USER white
set FLCLR_ROOT_FG_USER black
set FLCLR_ROOT_BG_ROOT red
set FLCLR_ROOT_FG_ROOT normal
# Color for VFISH segment
set FLCLR_VFISH_BG green
set FLCLR_VFISH_FG black
# Color for CONDA segment
set FLCLR_CONDA_BG $FLCLR_VFISH_BG
set FLCLR_CONDA_FG $FLCLR_VFISH_FG
# Color for GIT segment
set FLCLR_GIT_BG_CLEAN yellow
set FLCLR_GIT_FG_CLEAN black
set FLCLR_GIT_BG_DIRTY magenta
set FLCLR_GIT_FG_DIRTY black
set FLCLR_GIT_BG_DETACHED red
set FLCLR_GIT_FG_DETACHED normal
# Color for CLOCK segment
set FLCLR_CLOCK_BG yellow
set FLCLR_CLOCK_FG black
# Color for USER and USERHOST segments
set FLCLR_USER_BG blue
set FLCLR_USER_FG black
set FLCLR_USERHOST_BG blue
set FLCLR_USERHOST_FG black
# Color for JOBS segment
set FLCLR_JOBS_BG yellow
set FLCLR_JOBS_FG normal
# Color for EXECTIME segment
set FLCLR_EXECTIME_BG red
set FLCLR_EXECTIME_FG black
# Color for SCREEN segment
set FLCLR_SCREEN_BG cyan
set FLCLR_SCREEN_FG white
# Color for VIMODE segment
set FLCLR_VIMODE_DEFAULT_BG blue
set FLCLR_VIMODE_DEFAULT_FG black
set FLCLR_VIMODE_INSERT_BG green
set FLCLR_VIMODE_INSERT_FG black
set FLCLR_VIMODE_REPLACE_BG red
set FLCLR_VIMODE_REPLACE_FG black
set FLCLR_VIMODE_VISUAL_BG orange
set FLCLR_VIMODE_VISUAL_FG normal
# Color for SEPARATOR segment
set FLCLR_SEPARATOR_BG black
set FLCLR_SEPARATOR_FG white
# Color for FISH segment
set FLCLR_FISH yellow
# Color for FISH segment when not using Powerline glyph in your theme
set FLCLR_FISH_FG yellow
set FLCLR_FISH_BG normal

50
conf.d/dracula.fish Normal file
View file

@ -0,0 +1,50 @@
# Dracula Color Palette
set -l foreground f8f8f2
set -l selection 44475a
set -l comment 6272a4
set -l red ff5555
set -l orange ffb86c
set -l yellow f1fa8c
set -l green 50fa7b
set -l purple bd93f9
set -l cyan 8be9fd
set -l pink ff79c6
# Syntax Highlighting Colors
set -g fish_color_normal $foreground
set -g fish_color_command $cyan
set -g fish_color_keyword $pink
set -g fish_color_quote $yellow
set -g fish_color_redirection $foreground
set -g fish_color_end $orange
set -g fish_color_error $red
set -g fish_color_param $purple
set -g fish_color_comment $comment
set -g fish_color_selection --background=$selection
set -g fish_color_search_match --background=$selection
set -g fish_color_operator $green
set -g fish_color_escape $pink
set -g fish_color_autosuggestion $comment
set -g fish_color_cancel $red --reverse
set -g fish_color_option $orange
# Default Prompt Colors
set -g fish_color_cwd $green
set -g fish_color_host $purple
set -g fish_color_host_remote $purple
set -g fish_color_user $cyan
# Completion Pager Colors
set -g fish_pager_color_progress $comment
set -g fish_pager_color_background
set -g fish_pager_color_prefix $cyan
set -g fish_pager_color_completion $foreground
set -g fish_pager_color_description $comment
set -g fish_pager_color_selected_background --background=$selection
set -g fish_pager_color_selected_prefix $cyan
set -g fish_pager_color_selected_completion $foreground
set -g fish_pager_color_selected_description $comment
set -g fish_pager_color_secondary_background
set -g fish_pager_color_secondary_prefix $cyan
set -g fish_pager_color_secondary_completion $foreground
set -g fish_pager_color_secondary_description $comment

34
conf.d/fishline-init.fish Normal file
View file

@ -0,0 +1,34 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
if not set -q FLINE_THEME_DIR
if type -q realpath
set FLINE_THEME_DIR (dirname (realpath (status -f)))/fishline-themes
else
set FLINE_THEME_DIR (dirname (status -f))/fishline-themes
end
end
# Load default symbols
source $FLINE_THEME_DIR/default_symbols.fish
# Load default color theme depending on terminal capabilities
if begin; [ (uname) != "Darwin" ]; and tty | grep tty > /dev/null; end
# Emable a TTY safe default theme if a TTY is detected
source $FLINE_THEME_DIR/tty_compatible.fish
else if begin; not command -s tput > /dev/null; or [ (tput colors) -lt 256 ]; end
# Assume ANSI 8 Colors when tput is not availlable & tput colors < 256
source $FLINE_THEME_DIR/default_ansi_colors.fish
else
# Load default 256 colors theme otherwise
source $FLINE_THEME_DIR/default_256_colors.fish
end
# Default Fishline Prompt
set FLINE_DEFAULT_PROMPT vimode sigstatus jobs pwd git write n root
# Set Signal Code list for internal use
set FLSEG_STATUS_NAME (command kill -l| tr ' [a-z]' '\n[A-Z]')
# Set internal initialization flag
set _fishline_init true

View file

@ -0,0 +1,96 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
set -l __256_blue 08f
set -l __256_red d00
set -l __256_grey 4e4e4e
set -l __256_green 5d5
set -l __256_yellow fd0
set -l __256_purple 868
set -l __256_cyan 688
set -l __256_white eee
# Color for PWD and FULLPWD segment
set FLCLR_PWD_BG_HOME $__256_blue
set FLCLR_PWD_FG_HOME white
set FLCLR_PWD_BG $__256_grey
set FLCLR_PWD_FG white
set FLCLR_FULLPWD_BG $FLCLR_PWD_BG
set FLCLR_FULLPWD_FG $FLCLR_PWD_FG
# Color for STATUS segment
set FLCLR_STATUS_BG $__256_red
set FLCLR_STATUS_FG white
# Color for WRITE segment
set FLCLR_WRITE_BG $__256_red
set FLCLR_WRITE_FG white
# Color for ARROW segment
set FLCLR_ARROW_BG 4e4e4e
set FLCLR_ARROW_FG white
# Color for ROOT segment
set FLCLR_ROOT_BG_USER $__256_grey
set FLCLR_ROOT_FG_USER white
set FLCLR_ROOT_BG_ROOT $__256_red
set FLCLR_ROOT_FG_ROOT white
# Color for VFISH segment
set FLCLR_VFISH_BG $__256_green
set FLCLR_VFISH_FG black
# Color for CONDA segment
set FLCLR_CONDA_BG $FLCLR_VFISH_BG
set FLCLR_CONDA_FG $FLCLR_VFISH_FG
# Color for GIT segment
set FLCLR_GIT_BG_CLEAN $__256_yellow
set FLCLR_GIT_FG_CLEAN black
set FLCLR_GIT_BG_DIRTY $__256_purple
set FLCLR_GIT_FG_DIRTY white
set FLCLR_GIT_BG_DETACHED $__256_red
set FLCLR_GIT_FG_DETACHED white
# Color for CLOCK segment
set FLCLR_CLOCK_BG $__256_blue
set FLCLR_CLOCK_FG white
# Color for USER and USERHOST segments
set FLCLR_USER_BG $__256_white
set FLCLR_USER_FG black
set FLCLR_USERHOST_BG $__256_white
set FLCLR_USERHOST_FG black
# Color for JOBS segment
set FLCLR_JOBS_BG $__256_yellow
set FLCLR_JOBS_FG black
# Color for EXECTIME segment
set FLCLR_EXECTIME_BG $__256_red
set FLCLR_EXECTIME_FG white
# Color for SCREEN segment
set FLCLR_SCREEN_BG $__256_cyan
set FLCLR_SCREEN_FG white
# Color for VIMODE segment
set FLCLR_VIMODE_DEFAULT_BG $__256_green
set FLCLR_VIMODE_DEFAULT_FG black
set FLCLR_VIMODE_INSERT_BG $__256_white
set FLCLR_VIMODE_INSERT_FG black
set FLCLR_VIMODE_REPLACE_BG $__256_red
set FLCLR_VIMODE_REPLACE_FG white
set FLCLR_VIMODE_VISUAL_BG $__256_yellow
set FLCLR_VIMODE_VISUAL_FG white
# Color for SEPARATOR segment
set FLCLR_SEPARATOR_BG black
set FLCLR_SEPARATOR_FG white
# Color for FISH segment
set FLCLR_FISH $__256_yellow
# Color for FISH segment when not using Powerline glyph in your theme
set FLCLR_FISH_FG $__256_yellow
set FLCLR_FISH_BG normal

View file

@ -0,0 +1,87 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
# Color for PWD and FULLPWD segment
set FLCLR_PWD_BG_HOME blue
set FLCLR_PWD_FG_HOME normal
set FLCLR_PWD_BG white
set FLCLR_PWD_FG black
set FLCLR_FULLPWD_BG $FLCLR_PWD_BG
set FLCLR_FULLPWD_FG $FLCLR_PWD_FG
# Color for STATUS segment
set FLCLR_STATUS_BG red
set FLCLR_STATUS_FG normal
# Color for WRITE segment
set FLCLR_WRITE_BG red
set FLCLR_WRITE_FG normal
# Color for ARROW segment
set FLCLR_ARROW_BG white
set FLCLR_ARROW_FG black
# Color for ROOT segment
set FLCLR_ROOT_BG_USER white
set FLCLR_ROOT_FG_USER black
set FLCLR_ROOT_BG_ROOT red
set FLCLR_ROOT_FG_ROOT normal
# Color for VFISH segment
set FLCLR_VFISH_BG green
set FLCLR_VFISH_FG black
# Color for CONDA segment
set FLCLR_CONDA_BG $FLCLR_VFISH_BG
set FLCLR_CONDA_FG $FLCLR_VFISH_FG
# Color for GIT segment
set FLCLR_GIT_BG_CLEAN yellow
set FLCLR_GIT_FG_CLEAN black
set FLCLR_GIT_BG_DIRTY magenta
set FLCLR_GIT_FG_DIRTY black
set FLCLR_GIT_BG_DETACHED red
set FLCLR_GIT_FG_DETACHED normal
# Color for CLOCK segment
set FLCLR_CLOCK_BG white
set FLCLR_CLOCK_FG black
# Color for USER and USERHOST segments
set FLCLR_USER_BG cyan
set FLCLR_USER_FG normal
set FLCLR_USERHOST_BG cyan
set FLCLR_USERHOST_FG normal
# Color for JOBS segment
set FLCLR_JOBS_BG yellow
set FLCLR_JOBS_FG normal
# Color for EXECTIME segment
set FLCLR_EXECTIME_BG red
set FLCLR_EXECTIME_FG black
# Color for SCREEN segment
set FLCLR_SCREEN_BG cyan
set FLCLR_SCREEN_FG white
# Color for VIMODE segment
set FLCLR_VIMODE_DEFAULT_BG green
set FLCLR_VIMODE_DEFAULT_FG black
set FLCLR_VIMODE_INSERT_BG white
set FLCLR_VIMODE_INSERT_FG black
set FLCLR_VIMODE_REPLACE_BG red
set FLCLR_VIMODE_REPLACE_FG normal
set FLCLR_VIMODE_VISUAL_BG orange
set FLCLR_VIMODE_VISUAL_FG normal
# Color for SEPARATOR segment
set FLCLR_SEPARATOR_BG black
set FLCLR_SEPARATOR_FG white
# Color for FISH segment
set FLCLR_FISH yellow
# Color for FISH segment when not using Powerline glyph in your theme
set FLCLR_FISH_FG yellow
set FLCLR_FISH_BG normal

View file

@ -0,0 +1,56 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
# Symbol for Fishline (Powerline Glyphs)
set FLSYM_LEFT_PRE " "
set FLSYM_LEFT_CLOSE "\uE0B0"
set FLSYM_LEFT_SEPARATOR " \uE0B1 "
set FLSYM_LEFT_POST " "
set FLSYM_RIGHT_PRE " "
set FLSYM_RIGHT_OPEN "\uE0B2"
set FLSYM_RIGHT_SEPARATOR " \uE0B3 "
set FLSYM_RIGHT_POST " "
# Symbol for ARROW segment
set FLSYM_ARROW "\u2192"
# Symbol for GIT segment
set FLSYM_GIT_BRANCH "\uE0A0 "
set FLSYM_GIT_DETACHED "\u21CC "
set FLSYM_GIT_UNTRACKED "\u00D7"
set FLSYM_GIT_UNSTAGED "\u002B"
set FLSYM_GIT_STAGED "\u2219"
set FLSYM_GIT_AHEAD "\u21E1"
set FLSYM_GIT_BEHIND "\u21E3"
# Symbol for JOBS segment
set FLSYM_JOBS "\u2668 "
# Symbol for ROOT segment
set FLSYM_ROOT_ROOT "\u221E"
set FLSYM_ROOT_USER "\u2192"
# Symbol for VFISH segment
set FLSYM_VFISH "\u2635 "
# Symbol for CONDA segment
set FLSYM_CONDA "\u223F "
# Symbol for SCREEN segment
set FLSYM_SCREEN "\u239A "
# Symbol for VIMODE segment
set FLSYM_VIMODE_DEFAULT "NORMAL"
set FLSYM_VIMODE_INSERT "INSERT"
set FLSYM_VIMODE_REPLACE "REPLACE"
set FLSYM_VIMODE_VISUAL "VISUAL"
# Symbol for WRITE segment
set FLSYM_WRITE_LOCK "\uE0A2"
# Symbol for SEPARATOR segment
set FLSYM_SEPARATOR_SEG ""
# Symbol for FISH segment (textual version)
set FLSYM_FISH_ASCII_LEFT ">((*>"
set FLSYM_FISH_ASCII_RIGHT "<*))<"

View file

@ -0,0 +1,14 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
#
# Part theme example for the GIT segment
#
# Symbol for GIT segment
set FLSYM_GIT_BRANCH "git:"
set FLSYM_GIT_DETACHED "det:"
set FLSYM_GIT_UNTRACKED "u"
set FLSYM_GIT_UNSTAGED "s"
set FLSYM_GIT_STAGED "c"
set FLSYM_GIT_AHEAD "A"
set FLSYM_GIT_BEHIND "B"

View file

@ -0,0 +1,74 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
# Color for PWD and FULLPWD segment
set FLCLR_PWD_BG_HOME 26A
set FLCLR_PWD_FG_HOME normal
set FLCLR_PWD_BG 444
set FLCLR_PWD_FG normal
set FLCLR_FULLPWD_BG $FLCLR_PWD_BG
set FLCLR_FULLPWD_FG $FLCLR_PWD_FG
# Color for STATUS segment
set FLCLR_STATUS_BG A22
set FLCLR_STATUS_FG normal
# Color for WRITE segment
set FLCLR_WRITE_BG A22
set FLCLR_WRITE_FG normal
# Color for ARROW segment
set FLCLR_ARROW_BG 444
set FLCLR_ARROW_FG normal
# Color for ROOT segment
set FLCLR_ROOT_BG_USER 444
set FLCLR_ROOT_FG_USER normal
set FLCLR_ROOT_BG_ROOT red
set FLCLR_ROOT_FG_ROOT normal
# Color for VFISH segment
set FLCLR_VFISH_BG green
set FLCLR_VFISH_FG black
# Color for CONDA segment
set FLCLR_CONDA_BG $FLCLR_VFISH_BG
set FLCLR_CONDA_FG $FLCLR_VFISH_FG
# Color for GIT segment
set FLCLR_GIT_BG_CLEAN yellow
set FLCLR_GIT_FG_CLEAN black
set FLCLR_GIT_BG_DIRTY purple
set FLCLR_GIT_FG_DIRTY white
set FLCLR_GIT_BG_DETACHED 800
set FLCLR_GIT_FG_DETACHED white
# Color for CLOCK segment
set FLCLR_CLOCK_BG F60
set FLCLR_CLOCK_FG black
# Color for USERHOST segment
set FLCLR_USERHOST_BG 1F1209
set FLCLR_USERHOST_FG white
# Color for JOBS segment
set FLCLR_JOBS_BG C50
set FLCLR_JOBS_FG normal
# Color for EXECTIME segment
set FLCLR_EXECTIME_BG red
set FLCLR_EXECTIME_FG black
# Color for SCREEN segment
set FLCLR_SCREEN_BG cyan
set FLCLR_SCREEN_FG white
# Color for VIMODE segment
set FLCLR_VIMODE_DEFAULT_BG green
set FLCLR_VIMODE_DEFAULT_FG black
set FLCLR_VIMODE_INSERT_BG white
set FLCLR_VIMODE_INSERT_FG black
set FLCLR_VIMODE_REPLACE_BG red
set FLCLR_VIMODE_REPLACE_FG normal
set FLCLR_VIMODE_VISUAL_BG yellow
set FLCLR_VIMODE_VISUAL_FG normal

View file

@ -0,0 +1,123 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
#
# A tty-compatible theme (does not include any glyph)
#
# Symbol for Fishline
set FLSYM_LEFT_PRE "["
set FLSYM_LEFT_CLOSE ""
set FLSYM_LEFT_SEPARATOR "/"
set FLSYM_LEFT_POST "]"
set FLSYM_RIGHT_PRE "["
set FLSYM_RIGHT_OPEN ""
set FLSYM_RIGHT_SEPARATOR "/"
set FLSYM_RIGHT_POST "]"
# Symbol for ARROW segment
set FLSYM_ARROW "\$"
# Symbol for GIT segment
set FLSYM_GIT_BRANCH "git:"
set FLSYM_GIT_DETACHED "det:"
set FLSYM_GIT_UNTRACKED "u"
set FLSYM_GIT_UNSTAGED "s"
set FLSYM_GIT_STAGED "c"
set FLSYM_GIT_AHEAD "A"
set FLSYM_GIT_BEHIND "B"
# Symbol for JOBS segment
set FLSYM_JOBS "J"
# Symbol for ROOT segment
set FLSYM_ROOT_ROOT "#"
set FLSYM_ROOT_USER "\$"
# Symbol for VFISH segment
set FLSYM_VFISH "vfish:"
# Symbol for CONDA segment
set FLSYM_CONDA "conda:"
# Symbol for SCREEN segment
set FLSYM_SCREEN "screen:"
# Symbol for VIMODE segment
set FLSYM_VIMODE_DEFAULT "NORMAL"
set FLSYM_VIMODE_INSERT "INSERT"
set FLSYM_VIMODE_REPLACE "REPLACE"
set FLSYM_VIMODE_VISUAL "VISUAL"
# Symbol for WRITE segment
set FLSYM_WRITE_LOCK "X"
# Symbol for SEPARATOR segment
set FLSYM_SEPARATOR_SEG "|"
# Color for PWD and FULLPWD segment
set FLCLR_PWD_BG_HOME normal
set FLCLR_PWD_FG_HOME normal
set FLCLR_PWD_BG normal
set FLCLR_PWD_FG normal
set FLCLR_FULLPWD_BG $FLCLR_PWD_BG
set FLCLR_FULLPWD_FG $FLCLR_PWD_FG
# Color for STATUS segment
set FLCLR_STATUS_BG normal
set FLCLR_STATUS_FG red
# Color for WRITE segment
set FLCLR_WRITE_BG normal
set FLCLR_WRITE_FG red
# Color for ARROW segment
set FLCLR_ARROW_BG normal
set FLCLR_ARROW_FG white
# Color for ROOT segment
set FLCLR_ROOT_BG_USER normal
set FLCLR_ROOT_FG_USER white
set FLCLR_ROOT_BG_ROOT normal
set FLCLR_ROOT_FG_ROOT red
# Color for VFISH segment
set FLCLR_VFISH_BG normal
set FLCLR_VFISH_FG green
# Color for CONDA segment
set FLCLR_CONDA_BG $FLCLR_VFISH_BG
set FLCLR_CONDA_FG $FLCLR_VFISH_FG
# Color for GIT segment
set FLCLR_GIT_BG_CLEAN normal
set FLCLR_GIT_FG_CLEAN yellow
set FLCLR_GIT_BG_DIRTY normal
set FLCLR_GIT_FG_DIRTY purple
set FLCLR_GIT_BG_DETACHED normal
set FLCLR_GIT_FG_DETACHED red
# Color for CLOCK segment
set FLCLR_CLOCK_BG normal
set FLCLR_CLOCK_FG yellow
# Color for USER and USERHOST segments
set FLCLR_USER_BG normal
set FLCLR_USER_FG purple
set FLCLR_USERHOST_BG normal
set FLCLR_USERHOST_FG purple
# Color for JOBS segment
set FLCLR_JOBS_BG normal
set FLCLR_JOBS_FG brown
# Color for EXECTIME segment
set FLCLR_EXECTIME_BG normal
set FLCLR_EXECTIME_FG red
# Color for SCREEN segment
set FLCLR_SCREEN_BG normal
set FLCLR_SCREEN_FG cyan
# Color for SEPARATOR segment
set FLCLR_SEPARATOR_BG normal
set FLCLR_SEPARATOR_FG white

View file

@ -0,0 +1,63 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
#
# Washed theme ported from powerline-shell
#
# Color for PWD and FULLPWD segment
set FLCLR_PWD_BG 808080
set FLCLR_PWD_FG FFFFFF
set FLCLR_PWD_BG_HOME $FLCLR_PWD_BG
set FLCLR_PWD_FG_HOME $FLCLR_PWD_FG
set FLCLR_FULLPWD_BG $FLCLR_PWD_BG
set FLCLR_FULLPWD_FG $FLCLR_PWD_FG
# Color for STATUS segment
set FLCLR_STATUS_BG red
set FLCLR_STATUS_FG white
# Color for WRITE segment
set FLCLR_WRITE_BG FF875F
set FLCLR_WRITE_FG FFFFFF
# Color for ARROW segment
set FLCLR_ARROW_BG $FLCLR_PWD_BG
set FLCLR_ARROW_FG $FLCLR_PWD_FG
# Color for ROOT segment
set FLCLR_ROOT_BG_USER $FLCLR_PWD_BG
set FLCLR_ROOT_FG_USER $FLCLR_PWD_FG
set FLCLR_ROOT_BG_ROOT red
set FLCLR_ROOT_FG_ROOT $FLCLR_PWD_FG
# Color for VFISH segment
set FLCLR_VFISH_BG AFD787
set FLCLR_VFISH_FG black
# Color for CONDA segment
set FLCLR_CONDA_BG $FLCLR_VFISH_BG
set FLCLR_CONDA_FG $FLCLR_VFISH_FG
# Color for GIT segment
set FLCLR_GIT_BG_CLEAN AFD787
set FLCLR_GIT_FG_CLEAN 262626
set FLCLR_GIT_BG_DIRTY FF5F5F
set FLCLR_GIT_FG_DIRTY FFFFFF
set FLCLR_GIT_BG_DETACHED yellow
set FLCLR_GIT_FG_DETACHED black
# Color for CLOCK segment
set FLCLR_CLOCK_BG FF8700
set FLCLR_CLOCK_FG FFFFFF
# Color for USERHOST segment
set FLCLR_USERHOST_BG c0c0c0
set FLCLR_USERHOST_FG 808080
# Color for JOBS segment
set FLCLR_JOBS_BG 808080
set FLCLR_JOBS_FG 00FFFF
# Color for SCREEN segment
set FLCLR_SCREEN_BG 608080
set FLCLR_SCREEN_FG FFFFFF

3
fish_plugins Normal file
View file

@ -0,0 +1,3 @@
jorgebucaran/fisher
0rax/fishline
dracula/fish

View file

@ -1,6 +1,10 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __fish_initialized:3400
SETUVAR _fisher_0rax_2F_fishline_files:/home/zoe/\x2econfig/fish/functions/__fishline_segment\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__fishline_segment_close\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__fishline_test\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__fishline_usage\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__fishline_version\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_arrow\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_clock\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_conda\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_exectime\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_fish\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_fullpwd\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_git\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_invert\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_jobs\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_n\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_pwd\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_root\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_screen\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_separator\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_sigstatus\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_space\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_status\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_user\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_userhost\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_vfish\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_vimode\x2efish\x1e/home/zoe/\x2econfig/fish/functions/__flseg_write\x2efish\x1e/home/zoe/\x2econfig/fish/functions/fishline\x2efish\x1e/home/zoe/\x2econfig/fish/conf\x2ed/fishline\x2dinit\x2efish\x1e/home/zoe/\x2econfig/fish/conf\x2ed/fishline\x2dthemes\x1e/home/zoe/\x2econfig/fish/completions/fishline\x2efish
SETUVAR _fisher_dracula_2F_fish_files:/home/zoe/\x2econfig/fish/conf\x2ed/dracula\x2efish
SETUVAR _fisher_jorgebucaran_2F_fisher_files:/home/zoe/\x2econfig/fish/functions/fisher\x2efish\x1e/home/zoe/\x2econfig/fish/completions/fisher\x2efish
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1e0rax/fishline\x1edracula/fish
SETUVAR fish_color_autosuggestion:\x2d\x2ditalics\x1ewhite
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:blue

View file

@ -0,0 +1,43 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __fishline_segment --argument-name bg_clr fg_clr pre post -d "open a new fishline segment"
if [ "$FLINT_INVERT" = "true" -a "$FLINT_POSITION" = "left" ]; or [ "$FLINT_INVERT" != "true" -a "$FLINT_POSITION" = "right" ]
if [ "$FLINT_FIRST" != true ]
[ "$FLINT_PRINT_POST" = true ]; and printf "$FLSYM_RIGHT_POST"
end
if [ "$FLINT_LAST" != true ]
set_color $bg_clr
printf "$FLSYM_RIGHT_OPEN"
set_color $fg_clr -b $bg_clr
[ "$pre" = false ]; or printf "$FLSYM_RIGHT_PRE"
else
set_color normal -b normal
end
else
if [ "$FLINT_FIRST" != true ]
[ "$FLINT_PRINT_POST" = true ]; and printf "$FLSYM_LEFT_POST"
set_color -b $bg_clr
set_color "$FLINT_BCOLOR"
printf $FLSYM_LEFT_CLOSE
set_color normal
end
set_color -b $bg_clr $fg_clr
if [ "$FLINT_LAST" != true ]
[ "$pre" = false ]; or printf "$FLSYM_LEFT_PRE"
end
end
set FLINT_BCOLOR $bg_clr
set FLINT_FIRST false
set FLINT_LAST false
set FLINT_INVERT false
[ "$post" = false ]; and set FLINT_PRINT_POST false; or set FLINT_PRINT_POST true
end

View file

@ -0,0 +1,12 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __fishline_segment_close -d "close the previous fishline segment"
if [ "$FLINT_FIRST" != "true" ]
set FLINT_LAST true
__fishline_segment normal normal
set FLINT_FIRST true
end
end

View file

@ -0,0 +1,25 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __fishline_test --argument-names segment -d 'test segments'
set -g FLINT_TEST_SEG $segment
if not set -q FLINT_TEST_STATUS
set -g FLINT_TEST_STATUS 0
end
function flint_test_right
fishline -r -s $FLINT_TEST_STATUS $FLINT_TEST_SEG
end
function flint_test_left
fishline -l -s $FLINT_TEST_STATUS $FLINT_TEST_SEG
end
read -R flint_test_right -p flint_test_left TEST_VAR
set -e FLINT_TEST_VAR
set -e FLINT_TEST_SEG
set -e FLINT_TEST_STATUS
end

View file

@ -0,0 +1,34 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __fishline_usage
printf "# %s (%s)\n" (fishline -v) "https://github.com/0rax/fishline"
printf "
Powerline prompt for Fish Shell in Fish Shell.
Usage:
fishline [OPTIONS] [-s \$status] [segment ...]
Examples:
# Generate a fish_prompt compatible prompt
fishline -s \$status $FLINT_DEFAULT_PROMPT
# Generate a fish_right_prompt compatible prompt
fishline -r -s 0 CLOCK
Argument and Options:
segment This argument should match the name of the segment you wish to print
in your prompt. To Make sure that this segment exist, you can list
them using `fishline -x`
-s \$num Set the last command status exit code (should be internal \$status)
This is only used by a limited number of segment but it should be
set everytime you call fishline (if not needed set it to 0)
-l Left mode: generate a fish_prompt compatible prompt (default)
-r Right mode: generate a fish_right_prompt compatible prompt
-x Print the list of availlable segment and exit
-h Print this help and exit
-v Print the software version and exit
"
end

View file

@ -0,0 +1,12 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __fishline_version
pushd $FLINE_PATH > /dev/null
set -l fline_version (git describe --tag)
popd > /dev/null
printf "fishline %s\n" $fline_version
end

View file

@ -0,0 +1,9 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_arrow
__fishline_segment $FLCLR_ARROW_BG $FLCLR_ARROW_FG
printf $FLSYM_ARROW
end

View file

@ -0,0 +1,9 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_clock
__fishline_segment $FLCLR_CLOCK_BG $FLCLR_CLOCK_FG
printf "%s" (date "+%H:%M")
end

View file

@ -0,0 +1,11 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_conda
if set -q CONDA_DEFAULT_ENV
__fishline_segment $FLCLR_CONDA_BG $FLCLR_CONDA_FG
printf "$FLSYM_CONDA"(basename $CONDA_DEFAULT_ENV)
end
end

View file

@ -0,0 +1,30 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_exectime
set -l duration "$CMD_DURATION"
if [ $duration -ge 100 ]
__fishline_segment $FLCLR_EXECTIME_BG $FLCLR_EXECTIME_FG
set -l ms (math "$duration%1000")
if [ $duration -gt 36000000 ]
set -l h (math --scale=0 "$duration/36000000")
set -l min (math --scale=0 "$duration/60000%60")
printf "%sh %sm" $h $min
else if [ $duration -gt 60000 ]
set -l min (math --scale=0 "$duration/60000")
set -l s (math --scale=0 "$duration/1000%60")
printf "%sm %ss" $min $s
else if [ $duration -gt 1000 ]
set -l s (math --scale=0 "$duration/1000")
printf "%ss %sms" $s $ms
else
printf "%sms" $ms
end
end
end

View file

@ -0,0 +1,33 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_fish
if [ "$FLSYM_LEFT_CLOSE" != "\uE0B0" -o "$FLSYM_RIGHT_OPEN" != "\uE0B2" ]
__fishline_segment $FLCLR_FISH_BG $FLCLR_FISH_FG
if [ "$FLINT_POSITION" = "right" ]
printf "$FLSYM_FISH_ASCII_RIGHT"
else
printf "$FLSYM_FISH_ASCII_LEFT"
end
else if [ "$FLINT_POSITION" = "right" ]
__fishline_segment $FLCLR_FISH normal false false
printf " "
__flseg_invert
__fishline_segment normal $FLCLR_FISH false false
__fishline_segment $FLCLR_FISH $FLCLR_FISH false false
else
__fishline_segment $FLCLR_FISH $FLCLR_FISH false false
__fishline_segment normal $FLCLR_FISH false false
__flseg_invert
__fishline_segment $FLCLR_FISH normal false false
printf " "
end
end

View file

@ -0,0 +1,9 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_fullpwd
__fishline_segment $FLCLR_FULLPWD_BG $FLCLR_FULLPWD_FG
printf $PWD | sed "s|^$HOME|~|" | tr -d '\n'
end

View file

@ -0,0 +1,69 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_git
if git rev-parse --git-dir >> /dev/null 2> /dev/null
set -l detached 0
set -l ahead 0
set -l behind 0
set -l branch (git rev-parse --abbrev-ref HEAD 2> /dev/null)
if [ "$status" -ne 0 ] # Repository is empty
set branch (git status —porcelain -b | head -n1 | cut -d' ' -f 3-)
set detached 1
else if [ "$branch" = "HEAD" ] # Repository is detached on tags / commit
set branch (git describe --tags --exact-match 2> /dev/null; or git log --format=%h --abbrev-commit -1 2> /dev/null)
set detached 1
else if git rev-parse --verify --quiet origin/$branch 2> /dev/null >> /dev/null
set ahead (git rev-list origin/$branch..$branch | wc -l)
set behind (git rev-list $branch..origin/$branch | wc -l)
end
# http://git-scm.com/docs/git-status
set -l gitstatus (git status --porcelain 2> /dev/null | cut -c 1-2 | awk 'BEGIN {s=0; n=0; u=0; t=0}; /^[MARCDU].$/ {s=1}; /^.[MDAU]$/ {n=1}; /^\?\?$/ {u=1}; {t=s+n+u} END {printf("%s\n%d\n%d\n%d", t, s, n, u)}')
# bool gitstatus[1] any changes
# bool gitstatus[2] staged changes
# bool gitstatus[3] unstaged changes
# bool gitstatus[4] untracked files
if [ $detached -eq 1 ]
set state Detached
else if [ $gitstatus[1] -gt 0 ]
set state Dirty
else
set state Clean
end
switch $state
case Dirty
__fishline_segment $FLCLR_GIT_BG_DIRTY $FLCLR_GIT_FG_DIRTY
printf "$FLSYM_GIT_BRANCH"
case Detached
__fishline_segment $FLCLR_GIT_BG_DETACHED $FLCLR_GIT_FG_DETACHED
printf "$FLSYM_GIT_DETACHED"
case '*'
__fishline_segment $FLCLR_GIT_BG_CLEAN $FLCLR_GIT_FG_CLEAN
printf "$FLSYM_GIT_BRANCH"
end
printf "$branch"
if [ $ahead -gt 0 ]
printf " %d$FLSYM_GIT_AHEAD" $ahead
end
if [ $behind -gt 0 ]
printf " %d$FLSYM_GIT_BEHIND" $behind
end
if [ $gitstatus[4] -eq 1 ]
printf " $FLSYM_GIT_UNTRACKED"
else if [ $gitstatus[3] -eq 1 ]
printf " $FLSYM_GIT_UNSTAGED"
else if [ $gitstatus[2] -eq 1 ]
printf " $FLSYM_GIT_STAGED"
end
end
end

View file

@ -0,0 +1,8 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_invert
set FLINT_INVERT true
end

View file

@ -0,0 +1,11 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_jobs
if [ (jobs | wc -l) -gt 0 ]
__fishline_segment $FLCLR_JOBS_BG $FLCLR_JOBS_FG
printf $FLSYM_JOBS
end
end

10
functions/__flseg_n.fish Normal file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_n
__fishline_segment_close
tput el
printf \n
end

View file

@ -0,0 +1,35 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_pwd
set -l pwd (prompt_pwd | sed -E 's;/?([^/]+)/?;\1'\u1F';g' | tr \u1F '\n')
set -l it 1
set -l len (expr (count $pwd) - 1)
if [ "$pwd[1]" = "~" ]
__fishline_segment $FLCLR_PWD_BG_HOME $FLCLR_PWD_FG_HOME
printf "~"
set it 2
else if [ "$pwd[1]" = "/" ]
__fishline_segment $FLCLR_PWD_BG $FLCLR_PWD_FG
printf "/"
end
if [ $it -le $len ]
__fishline_segment $FLCLR_PWD_BG $FLCLR_PWD_FG
for f in $pwd[$it..$len]
set it (expr $it + 1)
if test $it -le $len
printf "$f$FLSYM_SEPARATOR"
else
printf "$f"
end
end
end
end

View file

@ -0,0 +1,14 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_root
if [ "$USER" = "root" ]
__fishline_segment $FLCLR_ROOT_BG_ROOT $FLCLR_ROOT_FG_ROOT
printf $FLSYM_ROOT_ROOT
else
__fishline_segment $FLCLR_ROOT_BG_USER $FLCLR_ROOT_FG_USER
printf $FLSYM_ROOT_USER
end
end

View file

@ -0,0 +1,11 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_screen
if set -q STY
__fishline_segment $FLCLR_SCREEN_BG $FLCLR_SCREEN_FG
printf "$FLSYM_SCREEN"(echo $STY | cut -d'.' -f2-)
end
end

View file

@ -0,0 +1,9 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_separator
__fishline_segment "$FLCLR_SEPARATOR_BG" "$FLCLR_SEPARATOR_FG" false false
printf "$FLSYM_SEPARATOR_SEG"
end

View file

@ -0,0 +1,20 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_sigstatus
if [ $FLINT_STATUS -gt 128 -a $FLINT_STATUS -lt 160 ]
__fishline_segment $FLCLR_STATUS_BG $FLCLR_STATUS_FG
printf "SIG%s" $FLSEG_STATUS_NAME[(math "$FLINT_STATUS" - 128)]
else if [ $FLINT_STATUS -eq 126 ]
__fishline_segment $FLCLR_STATUS_BG $FLCLR_STATUS_FG
printf "NOEXEC"
else if [ $FLINT_STATUS -eq 127 ]
__fishline_segment $FLCLR_STATUS_BG $FLCLR_STATUS_FG
printf "NFOUND"
else if [ $FLINT_STATUS -gt 0 ]
__fishline_segment $FLCLR_STATUS_BG $FLCLR_STATUS_FG
printf $FLINT_STATUS
end
end

View file

@ -0,0 +1,10 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_space
__fishline_segment_close
type -q tput; and tput el
printf " "
end

View file

@ -0,0 +1,11 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_status
if [ $FLINT_STATUS -gt 0 ]
__fishline_segment $FLCLR_STATUS_BG $FLCLR_STATUS_FG
printf $FLINT_STATUS
end
end

View file

@ -0,0 +1,9 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_user
__fishline_segment $FLCLR_USER_BG $FLCLR_USER_FG
printf $USER
end

View file

@ -0,0 +1,9 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_userhost
__fishline_segment $FLCLR_USERHOST_BG $FLCLR_USERHOST_FG
printf '%s@%s' $USER (hostname)
end

View file

@ -0,0 +1,11 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_vfish
if set -q VIRTUAL_ENV
__fishline_segment $FLCLR_VFISH_BG $FLCLR_VFISH_FG
printf "$FLSYM_VFISH%s" (basename $VIRTUAL_ENV)
end
end

View file

@ -0,0 +1,27 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_vimode
if begin;
set -q __fish_vi_mode;
or [ "$__fish_active_key_bindings" = "fish_vi_key_bindings" ]
end
switch $fish_bind_mode
case default
__fishline_segment $FLCLR_VIMODE_DEFAULT_BG $FLCLR_VIMODE_DEFAULT_FG
printf $FLSYM_VIMODE_DEFAULT
case insert
__fishline_segment $FLCLR_VIMODE_INSERT_BG $FLCLR_VIMODE_INSERT_FG
printf $FLSYM_VIMODE_INSERT
case replace-one
__fishline_segment $FLCLR_VIMODE_REPLACE_BG $FLCLR_VIMODE_REPLACE_FG
printf $FLSYM_VIMODE_REPLACE
case visual
__fishline_segment $FLCLR_VIMODE_VISUAL_BG $FLCLR_VIMODE_VISUAL_FG
printf $FLSYM_VIMODE_VISUAL
end
end
end

View file

@ -0,0 +1,11 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function __flseg_write
if not test -w .
__fishline_segment $FLCLR_WRITE_BG $FLCLR_WRITE_FG
printf "$FLSYM_WRITE_LOCK"
end
end

View file

@ -0,0 +1,3 @@
function fish_mode_prompt
end

View file

@ -1,3 +1,5 @@
function fish_prompt
printf '%s%s%s♥%s %s%s%s%s%s%s☛ '(set_color $fish_color_user) $USER (set_color magenta) (set_color $fish_color_host) $hostname (set_color $fish_color_cwd) (prompt_pwd) (set_color green) (set_color normal)
source $HOME/.config/fish/conf.d/dracula-fishline.fish
fishline -s $status SIGSTATUS USERHOST FULLPWD GIT CLOCK N VIMODE
echo " "
end

View file

@ -1,7 +1,2 @@
function fish_right_prompt
set -g __fish_git_prompt_show_informative_status
set -g __fish_git_prompt_showupstream informative
set -g __fish_git_prompt_describe_style branch
set -g __fish_git_prompt_showcolorhints
fish_git_prompt
end

212
functions/fisher.fish Normal file
View file

@ -0,0 +1,212 @@
function fisher --argument-names cmd --description "A plugin manager for Fish"
set --query fisher_path || set --local fisher_path $__fish_config_dir
set --local fisher_version 4.3.1
set --local fish_plugins $__fish_config_dir/fish_plugins
switch "$cmd"
case -v --version
echo "fisher, version $fisher_version"
case "" -h --help
echo "Usage: fisher install <plugins...> Install plugins"
echo " fisher remove <plugins...> Remove installed plugins"
echo " fisher update <plugins...> Update installed plugins"
echo " fisher update Update all installed plugins"
echo " fisher list [<regex>] List installed plugins matching regex"
echo "Options:"
echo " -v or --version Print version"
echo " -h or --help Print this help message"
echo "Variables:"
echo " \$fisher_path Plugin installation path. Default: ~/.config/fish"
case ls list
string match --entire --regex -- "$argv[2]" $_fisher_plugins
case install update remove
isatty || read --local --null --array stdin && set --append argv $stdin
set --local install_plugins
set --local update_plugins
set --local remove_plugins
set --local arg_plugins $argv[2..-1]
set --local old_plugins $_fisher_plugins
set --local new_plugins
if ! set --query argv[2]
if test "$cmd" != update
echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1
else if test ! -e $fish_plugins
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
end
set arg_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
end
for plugin in $arg_plugins
test -e "$plugin" && set plugin (realpath $plugin)
contains -- "$plugin" $new_plugins || set --append new_plugins $plugin
end
if set --query argv[2]
for plugin in $new_plugins
if contains -- "$plugin" $old_plugins
test "$cmd" = remove &&
set --append remove_plugins $plugin ||
set --append update_plugins $plugin
else if test "$cmd" = install
set --append install_plugins $plugin
else
echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1
end
end
else
for plugin in $new_plugins
contains -- "$plugin" $old_plugins &&
set --append update_plugins $plugin ||
set --append install_plugins $plugin
end
for plugin in $old_plugins
contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin
end
end
set --local pid_list
set --local source_plugins
set --local fetch_plugins $update_plugins $install_plugins
echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal)
for plugin in $fetch_plugins
set --local source (command mktemp -d)
set --append source_plugins $source
command mkdir -p $source/{completions,conf.d,functions}
fish --command "
if test -e $plugin
command cp -Rf $plugin/* $source
else
set temp (command mktemp -d)
set name (string split \@ $plugin) || set name[2] HEAD
set url https://api.github.com/repos/\$name[1]/tarball/\$name[2]
set header 'Accept: application/vnd.github.v3+json'
echo Fetching (set_color --underline)\$url(set_color normal)
if curl --silent -L -H \$header \$url | tar -xzC \$temp -f - 2>/dev/null
command cp -Rf \$temp/*/* $source
else
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
command rm -rf $source
end
command rm -rf \$temp
end
set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files
" &
set --append pid_list (jobs --last --pid)
end
wait $pid_list 2>/dev/null
for plugin in $fetch_plugins
if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source
if set --local index (contains --index -- "$plugin" $install_plugins)
set --erase install_plugins[$index]
else
set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)]
end
end
end
for plugin in $update_plugins $remove_plugins
if set --local index (contains --index -- "$plugin" $_fisher_plugins)
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
if contains -- "$plugin" $remove_plugins
for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
emit {$name}_uninstall
end
printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var
end
command rm -rf $$plugin_files_var
functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
complete --erase --command $name
end
set --erase _fisher_plugins[$index]
set --erase $plugin_files_var
end
end
if set --query update_plugins[1] || set --query install_plugins[1]
command mkdir -p $fisher_path/{functions,conf.d,completions}
end
for plugin in $update_plugins $install_plugins
set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)]
set --local files $source/{functions,conf.d,completions}/*
if set --local index (contains --index -- $plugin $install_plugins)
set --local user_files $fisher_path/{functions,conf.d,completions}/*
set --local conflict_files
for file in (string replace -- $source/ $fisher_path/ $files)
contains -- $file $user_files && set --append conflict_files $file
end
if set --query conflict_files[1] && set --erase install_plugins[$index]
echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2
continue
end
end
for file in (string replace -- $source/ "" $files)
command cp -Rf $source/$file $fisher_path/$file
end
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files)
contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
contains -- $plugin $install_plugins && set --local event install || set --local event update
printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var
for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var)
source $file
if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
emit {$name}_$event
end
end
end
command rm -rf $source_plugins
set --query _fisher_plugins[1] || set --erase _fisher_plugins
set --query _fisher_plugins &&
printf "%s\n" $_fisher_plugins >$fish_plugins ||
command rm -f $fish_plugins
set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins)
test "$total" != "0 0 0" && echo (string join ", " (
test $total[1] = 0 || echo "Installed $total[1]") (
test $total[2] = 0 || echo "Updated $total[2]") (
test $total[3] = 0 || echo "Removed $total[3]")
) plugin/s
case \*
echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1
end
end
## Migrations ##
function _fisher_fish_postexec --on-event fish_postexec
if functions --query _fisher_list
fisher update >/dev/null 2>/dev/null
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
test -e $XDG_DATA_HOME/fisher && command rm -rf $XDG_DATA_HOME/fisher
functions --erase _fisher_list _fisher_plugin_parse
set --erase fisher_data
end
functions --erase _fisher_fish_postexec
end

81
functions/fishline.fish Normal file
View file

@ -0,0 +1,81 @@
#!/usr/bin/env fish
# -*- mode:fish; tab-width:4 -*-
function fishline -d "fishline prompt function"
set -g FLINT_POSITION left
set -g FLSYM_SEPARATOR $FLSYM_LEFT_SEPARATOR
set -g FLINT_FIRST true
set -g FLINT_LAST false
set -g FLINT_BCOLOR normal
set -g FLINT_PRINT_POST true
set -g FLINT_INVERT false
set -g FLINT_STATUS false
set -l prompt_segments $FLINE_DEFAULT_PROMPT
set -l args (getopt "lrxhvs:" $argv)
if [ $status -gt 0 ]
return 1
end
set args (echo $args | sed -E 's/^\s//;s/\ +/ /g' | tr ' ' '\n')
while [ (count $args) -ge 0 ]
switch $args[1]
case "-s"
set FLINT_STATUS $args[2]
set args $args[2..-1]
case "-r"
set FLINT_POSITION right
set FLSYM_SEPARATOR $FLSYM_RIGHT_SEPARATOR
case "-l"
set FLINT_POSITION left
set FLSYM_SEPARATOR $FLSYM_LEFT_SEPARATOR
case "-x"
functions -a | sed -nE 's/__flseg_([a-zA-Z_]+)/\1/p'
return 0
case "-h"
__fishline_usage
return 0
case "-v"
__fishline_version
return 0
case "--"
break
end
set args $args[2..-1]
end
if [ "$FLINT_STATUS" = "false" ]
if [ (count $args) -ge 2 ]; and [ "$args[2]" -eq "$args[2]" ]
set FLINT_STATUS $args[2]
if [ (count $args) -eq 2 ]
set args '--'
else
set args -- $args[3..-1]
end
else
echo "Warning: last status not passed as positional '-s' argument to fishline" >&2
set FLINT_STATUS 0
end
end
if [ (count $args) -gt 1 ]
set prompt_segments (echo $args[2..-1] | tr 'A-Z' 'a-z' | tr ' ' '\n')
else if set -q FLINE_PROMPT
set prompt_segments (echo $FLINE_PROMPT | tr 'A-Z' 'a-z' | tr ' ' '\n')
end
for seg in $prompt_segments
eval __flseg_$seg
end
__fishline_segment_close
set -e FLINT_FIRST
set -e FLINT_LAST
set -e FLINT_POSITION
set -e FLINT_STATUS
set -e FLINT_BCOLOR
set -e FLINT_INVERT
set -e FLINT_PRINT_POST
end