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
71fc7a98
Commit
71fc7a98
authored
Mar 13, 2013
by
sn0cr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the agnoster theme by agnoster ported to fish shell
parent
34c104e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
152 additions
and
0 deletions
+152
-0
themes/agnoster/fish_prompt.fish
themes/agnoster/fish_prompt.fish
+152
-0
No files found.
themes/agnoster/fish_prompt.fish
0 → 100644
View file @
71fc7a98
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for FISH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
set -g CURRENT_BG NONE
set SEGMENT_SEPARATOR \u2b80
set RIGHT_SEGMENT_SEPARATOR \u2b80
# ===========================
# Helper methods
# ===========================
set -g __fish_git_prompt_showdirtystate 'yes'
set -g __fish_git_prompt_char_dirtystate '±'
set -g __fish_git_prompt_char_cleanstate ''
function parse_git_dirty
set -l submodule_syntax
set submodule_syntax "--ignore-submodules=dirty"
set git_dirty (git status -s $submodule_syntax 2> /dev/null)
if [ -n "$git_dirty" ]
if [ $__fish_git_prompt_showdirtystate = "yes" ]
echo -n "$__fish_git_prompt_char_dirtystate"
end
else
if [ $__fish_git_prompt_showdirtystate = "yes" ]
echo -n "$__fish_git_prompt_char_cleanstate"
end
end
end
#set -g THEME_DISPLAY_USER yes
# ===========================
# Segments functions
# ===========================
function prompt_segment -d "Function to draw a segment"
set -l bg
set -l fg
if [ -n "$argv[1]" ]
set bg $argv[1]
else
set bg normal
end
if [ -n "$argv[2]" ]
set fg $argv[2]
else
set fg normal
end
if [ "$CURRENT_BG" != 'NONE' -a "$argv[1]" != "$CURRENT_BG" ]
set_color -b $bg
set_color $CURRENT_BG
#echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
echo -n "$SEGMENT_SEPARATOR "
set_color -b $bg
set_color $fg
else
set_color -b $bg
set_color $fg
echo -n " "
end
set CURRENT_BG $argv[1]
if [ -n "$argv[3]" ]
echo -n -s $argv[3] " "
end
#echo $CURRENT_BG $fg $bg
end
function prompt_finish -d "Close open segments"
if [ -n $CURRENT_BG ]
set_color -b normal
set_color $CURRENT_BG
#echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
echo -n "$SEGMENT_SEPARATOR "
end
set -g CURRENT_BG NONE
end
# ===========================
# Theme components
# ===========================
function prompt_user -d "Display actual user if different from $DEFAULT_USER"
set USER_PROMPT (whoami)@(hostname)
if [ "$THEME_DISPLAY_USER" = "yes" ]
if [ "$user" != "$DEFAULT_USER" -o -n "$SSH_CLIENT" ]
prompt_segment black yellow $USER_PROMPT
end
end
end
function prompt_dir -d "Display the actual directory"
prompt_segment blue black (prompt_pwd)
end
function prompt_git -d "Display the actual git state"
set -l ref
set -l dirty
if git rev-parse --is-inside-work-tree >/dev/null 2>&1
set dirty (parse_git_dirty)
set ref (git symbolic-ref HEAD 2> /dev/null)
set ref (git symbolic-ref HEAD 2> /dev/null)
if [ $status -gt 0 ]
set -l branch (git show-ref --head -s --abbrev |head -n1 2> /dev/null)
set ref "➦ $branch "
end
set -l branch (echo $ref | sed 's-refs/heads/-⭠ -')
if [ "$dirty" != "" ]
prompt_segment yellow black "$branch $dirty"
else
prompt_segment green black "$branch $dirty"
end
end
end
function prompt_status -d "the symbols for a non zero exit status, root and background jobs"
if [ $RETVAL -ne 0 ]
prompt_segment black red "✘"
end
# if superuser (uid == 0)
set -l uid (id -u $user)
if [ $uid -eq 0 ]
prompt_segment black yellow "⚡"
end
# Jobs display
if [ (jobs -l | wc -l) -gt 0 ]
prompt_segment black cyan "⚙"
end
end
# ===========================
# Apply theme
# ===========================
function fish_prompt
set -g RETVAL $status
prompt_status
prompt_user
prompt_dir
prompt_git
prompt_finish
end
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