Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
913ae62b
Commit
913ae62b
authored
Aug 03, 2014
by
Joseph Tannhuber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proper color definitions
parent
83503f5f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
154 deletions
+69
-154
themes/budspencer/fish_prompt.fish
themes/budspencer/fish_prompt.fish
+34
-80
themes/budspencer/fish_right_prompt.fish
themes/budspencer/fish_right_prompt.fish
+35
-74
No files found.
themes/budspencer/fish_prompt.fish
View file @
913ae62b
# TODO: color definitions cleanup
# TODO: git improvements
# name: budspencer
# ----------------------------------------------------------------------------
###############################################################################
# Color definitions
###############################################################################
set -g budspencer_colors 000000 002b36 083743 445659 657b83 839496 93a1a1 eee8d5 fdf6e3 b58900 cb4b16 dc121f d33682 6c71c4 268bd2 2aa198 859900
###############################################################################
# Utils
#
----------------------------------------------------------------------------
#
##############################################################################
set -g __budspencer_display_rprompt 1
...
...
@@ -15,103 +19,67 @@ end
function fish_vi_prompt_cm --description "Displays the current mode"
switch $fish_bind_mode
case default
set_color -b
blue 000
set_color -b
$budspencer_colors[15] $budspencer_colors[1]
echo -n " NORMAL "
set_color -b
000 blue
set_color -b
$budspencer_colors[1] $budspencer_colors[15]
case insert
set_color -b
yellow 000
set_color -b
$budspencer_colors[10] $budspencer_colors[1]
echo -n " INSERT "
set_color -b
000 yellow
set_color -b
$budspencer_colors[1] $budspencer_colors[10]
case visual
set_color -b
magenta 000
set_color -b
$budspencer_colors[13] $budspencer_colors[1]
echo -n " VISUAL "
set_color -b
000 magenta
set_color -b
$budspencer_colors[1] $budspencer_colors[13]
end
end
function fish_prompt_symbols --description "Display symbols"
set_color -o -b
073642
set_color -o -b
$budspencer_colors[3]
echo -n ""
# indicator for vim parent process
if set -q -x VIM
set_color
6c71c4
set_color
$budspencer_colors[14]
echo -n " V"
end
# indicator for ranger parent process
if set -q -x RANGER_LEVEL
set_color
6c71c4
set_color
$budspencer_colors[14]
echo -n " R"
end
# background job indicator
if [ (jobs | wc -l) -gt 0 ]
set_color
6c71c4
set_color
$budspencer_colors[16]
echo -n " ⚙"
end
# write protection indicator
if [ ! -w . ]
set_color
cb4b16
set_color
$budspencer_colors[11]
echo -n " "
end
# status indicator
if [ $last_status -eq 0 ]
set_color
green
set_color
$budspencer_colors[17]
echo -n " ✔"
else
set_color
red
set_color
$budspencer_colors[12]
echo -n " ✘"
end
# superuser indicator
if [ $USER = "root" ]
set_color
cb4b16
set_color
$budspencer_colors[11]
echo -n " ⚡"
end
echo -n " "
set_color -b normal
073642
set_color -b normal
$budspencer_colors[3]
end
#
----------------------------------------------------------------------------
#
##############################################################################
# Prompts
#
----------------------------------------------------------------------------
#
##############################################################################
function fish_prompt -d "Write out the left prompt of the budspencer theme"
set -g last_status $status
set -l basedir_name (basename (prompt_pwd))
# Init colors
set -l fcol_black (set_color 000000)
set -l fcol_base03 (set_color 002b36)
set -l fcol_base02 (set_color 073642)
set -l fcol_base01 (set_color 586e75)
set -l fcol_base00 (set_color 657b83)
set -l fcol_base0 (set_color 839496)
set -l fcol_base1 (set_color 93a1a1)
set -l fcol_base2 (set_color eee8d5)
set -l fcol_base3 (set_color fdf6e3)
set -l fcol_yellow (set_color b58900)
set -l fcol_orange (set_color cb4b16)
set -l fcol_red (set_color red)
set -l fcol_magenta (set_color d33682)
set -l fcol_violet (set_color 6c71c4)
set -l fcol_blue (set_color 268bd2)
set -l fcol_cyan (set_color 2aa198)
set -l fcol_green (set_color 859900)
set -l bcol_base03 (set_color -b 002b36)
set -l bcol_base02 (set_color -b 073642)
set -l bcol_base01 (set_color -b 586e75)
set -l bcol_base00 (set_color -b 657b83)
set -l bcol_base0 (set_color -b 839496)
set -l bcol_base1 (set_color -b 93a1a1)
set -l bcol_base2 (set_color -b eee8d5)
set -l bcol_base3 (set_color -b fdf6e3)
set -l bcol_yellow (set_color -b b58900)
set -l bcol_orange (set_color -b cb4b16)
set -l bcol_red (set_color -b red)
set -l bcol_magenta (set_color -b d33682)
set -l bcol_violet (set_color -b 6c71c4)
set -l bcol_blue (set_color -b 268bd2)
set -l bcol_cyan (set_color -b 2aa198)
set -l bcol_green (set_color -b 859900)
# Segments
# vi mode
...
...
@@ -121,24 +89,10 @@ function fish_prompt -d "Write out the left prompt of the budspencer theme"
end
# git
# If inside a git repo then the pwd segment is replaced by the git
# segment.
# The git segment format is X:YI@Z:P(N) where:
# X is git
# Y is the current branch
# I is the information about the current repo state
# Z is the name of the repo
# P is the current working path basename (name of the current directory)
# C is the depth of the path starting from base directory of the repo
# The displayed information is:
# Dirtiness is indicated by a little dot after the branch name.
# Unpushed commits are indicated with up arrows
# The number of unpushed commits is indicated right after the up arrows
# If P = Z then P(C) is not displayed
set -l ps_git ""
set -l git_branch_name (__budspencer_git_branch_name)
if test -n "$git_branch_name"
set ps_git
$bcol_base01 "" $fcol_black " "$git_branch_name" " $fcol_base01
#"@"$colbred$git_repo_name
set ps_git
(set_color -b $budspencer_colors[4]) "" (set_color $budspencer_colors[1]) " "$git_branch_name" " (set_color $budspencer_colors[4])
#"@"$colbred$git_repo_name
end
set -l ps_symbols (fish_prompt_symbols)
...
...
themes/budspencer/fish_right_prompt.fish
View file @
913ae62b
# TODO: color definitions cleanup
# Init colors
set fcol_black (set_color 000000)
set fcol_base03 (set_color -o 002b36)
set fcol_base02 (set_color -o 073642)
set fcol_base01 (set_color -o 586e75)
set fcol_base00 (set_color -o 657b83)
set fcol_base0 (set_color -o 839496)
set fcol_base1 (set_color -o 93a1a1)
set fcol_base2 (set_color -o eee8d5)
set fcol_base3 (set_color -o fdf6e3)
set fcol_yellow (set_color -o b58900)
set fcol_orange (set_color -o cb4b16)
set fcol_red (set_color -o red)
set fcol_magenta (set_color -o d33682)
set fcol_violet (set_color -o 6c71c4)
set fcol_blue (set_color -o 268bd2)
set fcol_blue (set_color -o 268bd2)
set fcol_cyan (set_color -o 2aa198)
set fcol_green (set_color -o 859900)
set bcol_base03 (set_color -b 002b36)
set bcol_base02 (set_color -b 073642)
set bcol_base01 (set_color -b 586e75)
set bcol_base00 (set_color -b 657b83)
set bcol_base0 (set_color -b 839496)
set bcol_base1 (set_color -b 93a1a1)
set bcol_base2 (set_color -b eee8d5)
set bcol_base3 (set_color -b fdf6e3)
set bcol_yellow (set_color -b b58900)
set bcol_orange (set_color -b cb4b16)
set bcol_red (set_color -b dc322f)
set bcol_magenta (set_color -b d33682)
set bcol_violet (set_color -b 6c71c4)
set bcol_blue (set_color -b 268bd2)
set bcol_cyan (set_color -b 2aa198)
set bcol_green (set_color -b 859900)
function __budspencer_is_git_ahead_or_behind -d "Check if there are unpulled or unpushed commits"
echo (command git rev-list --count --left-right "HEAD...@{upstream}" ^/dev/null | sed 's/[[:space:]+]/\\x1e/g')
end
...
...
@@ -94,9 +55,9 @@ function fish_cmd_duration_cm -d "Displays the elapsed time of last command"
if test (count $CMD_DURATION) -gt 0
set -l duration (echo $CMD_DURATION | tr -d '[[:space:]]' | sed 's|\.[[:digit:]]*||')
if test $last_status -ne 0
echo -n
$fcol_base02""$bcol_base02$fcol_red
" "$duration
echo -n
(set_color $budspencer_colors[3])""(set_color -b $budspencer_colors[3] $budspencer_colors[12])
" "$duration
else
echo -n
$fcol_base02""$bcol_base02$fcol_green
" "$duration
echo -n
(set_color $budspencer_colors[3])""(set_color -b $budspencer_colors[3] $budspencer_colors[17])
" "$duration
end
end
end
...
...
@@ -109,75 +70,75 @@ function fish_git_prompt_cm --description "Displays the git symbols"
set -l git_ahead_behind (__budspencer_is_git_ahead_or_behind)
if test $git_ahead_behind[1] -gt 0
if test $git_style = "symbols"
set git_prompt
$fcol_yellow
" ↑"
set git_prompt
(set_color -o $budspencer_colors[10])
" ↑"
else
set git_prompt
$fcol_yellow
" "$git_ahead_behind[1]
set git_prompt
(set_color -o $budspencer_colors[10])
" "$git_ahead_behind[1]
end
end
if test $git_ahead_behind[2] -gt 0
if test $git_style = "symbols"
set git_prompt $git_prompt
$fcol_yellow
" ↓"
set git_prompt $git_prompt
(set_color -o $budspencer_colors[10])
" ↓"
else
set git_prompt $git_prompt
$fcol_yellow
" "$git_ahead_behind[2]
set git_prompt $git_prompt
(set_color -o $budspencer_colors[10])
" "$git_ahead_behind[2]
end
end
set -l git_status (__budspencer_git_status)
if test $git_status[1] -gt 0
if test $git_style = "symbols"
set git_prompt $git_prompt
$fcol_green
" +"
set git_prompt $git_prompt
(set_color -o $budspencer_colors[17])
" +"
else
set git_prompt $git_prompt
$fcol_green
" "$git_status[1]
set git_prompt $git_prompt
(set_color -o $budspencer_colors[17])
" "$git_status[1]
end
end
if test $git_status[2] -gt 0
if test $git_style = "symbols"
set git_prompt $git_prompt
$fcol_red
" –"
set git_prompt $git_prompt
(set_color -o $budspencer_colors[12])
" –"
else
set git_prompt $git_prompt
$fcol_red
" "$git_status[2]
set git_prompt $git_prompt
(set_color -o $budspencer_colors[12])
" "$git_status[2]
end
end
if test $git_status[3] -gt 0
if test $git_style = "symbols"
set git_prompt $git_prompt
$fcol_blue
" ✱"
set git_prompt $git_prompt
(set_color -o $budspencer_colors[15])
" ✱"
else
set git_prompt $git_prompt
$fcol_blue
" "$git_status[3]
set git_prompt $git_prompt
(set_color -o $budspencer_colors[15])
" "$git_status[3]
end
end
if test $git_status[4] -gt 0
if test $git_style = "symbols"
set git_prompt $git_prompt
$fcol_magenta
" →"
set git_prompt $git_prompt
(set_color -o $budspencer_colors[13])
" →"
else
set git_prompt $git_prompt
$fcol_magenta
" "$git_status[4]
set git_prompt $git_prompt
(set_color -o $budspencer_colors[13])
" "$git_status[4]
end
end
if test $git_status[5] -gt 0
if test $git_style = "symbols"
set git_prompt $git_prompt
$fcol_violet
" ═"
set git_prompt $git_prompt
(set_color -o $budspencer_colors[14])
" ═"
else
set git_prompt $git_prompt
$fcol_violet
" "$git_status[5]
set git_prompt $git_prompt
(set_color -o $budspencer_colors[14])
" "$git_status[5]
end
end
if test $git_status[6] -gt 0
if test $git_style = "symbols"
set git_prompt $git_prompt
$fcol_base3
" ●"
set git_prompt $git_prompt
(set_color -o $budspencer_colors[9])
" ●"
else
set git_prompt $git_prompt
$fcol_base3
" "$git_status[6]
set git_prompt $git_prompt
(set_color -o $budspencer_colors[9])
" "$git_status[6]
end
end
set -l git_stashed (__budspencer_is_git_stashed)
if test git_stashed -gt 0
if test $git_style = "symbols"
set git_prompt $git_prompt
$fcol_cyan
" ✭"
set git_prompt $git_prompt
(set_color -o $budspencer_colors[16])
" ✭"
else
set git_prompt $git_prompt
$fcol_cyan
" "$git_stashed
set git_prompt $git_prompt
(set_color -o $budspencer_colors[16])
" "$git_stashed
end
end
echo $git_prompt
...
...
@@ -195,20 +156,20 @@ function fish_pwd_prompt_cm --description "Displays the present working director
end
switch $fish_bind_mode
case default
set_color
blue
set_color
$budspencer_colors[15]
echo -n ""
set_color normal
set_color -
-background blue 000
set_color -
b $budspencer_colors[15] $budspencer_colors[1]
case insert
set_color
yellow
set_color
$budspencer_colors[10]
echo -n ""
set_color normal
set_color -
-background yellow 000
set_color -
b $budspencer_colors[10] $budspencer_colors[1]
case visual
set_color
magenta
set_color
$budspencer_colors[13]
echo -n ""
set_color normal
set_color -
-background magenta 000
set_color -
b $budspencer_colors[13] $budspencer_colors[1]
end
switch $pwd_style
case none
...
...
@@ -231,7 +192,7 @@ function fish_right_prompt -d "Write out the right prompt of the budspencer them
# git
set ps_git (fish_git_prompt_cm)
if test -n "$ps_git"
set ps_git
$fcol_base01""$bcol_base01
""$ps_git
set ps_git
(set_color $budspencer_colors[4])""(set_color -b $budspencer_colors[4])
""$ps_git
end
# pwd
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment