mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-28 03:09:31 +08:00
add theme "ocean"
This commit is contained in:
parent
eefe9f297e
commit
fca7516642
19
themes/ocean/README.md
Normal file
19
themes/ocean/README.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
## ocean
|
||||
|
||||
A fish theme with ocean in mind.
|
||||
|
||||
|
||||
Unicode-compatible fonts and terminals is required.
|
||||
I would recommend iTerm2 + Solarized Dark for Mac users.
|
||||
This theme is based loosely on [agnoster](https://gist.github.com/agnoster/3712874)
|
||||
|
||||
#### Characteristics
|
||||
* Show a radioactive symbol when gain the root privileges (It's dangerous!)
|
||||
* Current python virtualenv (if applicable)
|
||||
* The anchor turn red if the previous command failed
|
||||
* Full path of current working directory
|
||||
* Git branch and dirty state (if applicable)
|
||||
* Show User @ Hostname if user is not default\_user
|
||||
> to turn on this feature, set these two lines in your config.fish
|
||||
> set -g theme display_user yes
|
||||
> set -g default_user your_default_username
|
82
themes/ocean/fish_prompt.fish
Normal file
82
themes/ocean/fish_prompt.fish
Normal file
|
@ -0,0 +1,82 @@
|
|||
# name: ocean
|
||||
# A fish theme with ocean in mind.
|
||||
|
||||
|
||||
## Set this options in your config.fish (if you want to)
|
||||
# set -g theme_display_user yes
|
||||
# set -g default_user default_username
|
||||
|
||||
set __oceanfish_glyph_anchor \u2693
|
||||
set __oceanfish_glyph_flag \u2691
|
||||
set __oceanfish_glyph_radioactive \u2622
|
||||
|
||||
function _git_branch_name
|
||||
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
|
||||
end
|
||||
|
||||
|
||||
function _is_git_dirty
|
||||
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
|
||||
end
|
||||
|
||||
|
||||
function fish_prompt
|
||||
set -l last_status $status
|
||||
set -l magenta (set_color magenta)
|
||||
set -l red (set_color red)
|
||||
set -l cyan (set_color cyan)
|
||||
set -l white (set_color white)
|
||||
set -l black (set_color black)
|
||||
set -l bg_blue (set_color -b blue)
|
||||
set -l bg_cyan (set_color -b cyan)
|
||||
set -l bg_white (set_color -b white)
|
||||
set -l bg_red (set_color -b red)
|
||||
set -l bg_yellow (set_color -b yellow)
|
||||
set -l normal (set_color normal)
|
||||
set -l cwd $white(prompt_pwd)
|
||||
set -l uid (id -u $USER)
|
||||
|
||||
|
||||
# Show a yellow radioactive symbol for root privileges
|
||||
if [ $uid -eq 0 ]
|
||||
echo -n -s $bg_yellow $black " $__oceanfish_glyph_radioactive " $normal
|
||||
end
|
||||
|
||||
|
||||
# Display virtualenv name if in a virtualenv
|
||||
if set -q VIRTUAL_ENV
|
||||
echo -n -s $bg_cyan $black " " (basename "$VIRTUAL_ENV") " " $normal
|
||||
end
|
||||
|
||||
|
||||
# Show a nice anchor (turns red if previous command failed)
|
||||
if test $last_status -ne 0
|
||||
echo -n -s $bg_red $white " $__oceanfish_glyph_anchor " $normal
|
||||
else
|
||||
echo -n -s $bg_blue $white " $__oceanfish_glyph_anchor " $normal
|
||||
end
|
||||
|
||||
if [ "$theme_display_user" = "yes" ]
|
||||
if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
|
||||
echo -n -s $bg_white $cyan " " (whoami) "@" (hostname -s) " " $normal
|
||||
end
|
||||
end
|
||||
|
||||
# Display current path
|
||||
echo -n -s $bg_cyan " $cwd " $normal
|
||||
|
||||
|
||||
# Show git branch and dirty state
|
||||
if [ (_git_branch_name) ]
|
||||
set -l git_branch (_git_branch_name)
|
||||
if [ (_is_git_dirty) ]
|
||||
echo -n -s $bg_white $magenta " $git_branch " $red "$__oceanfish_glyph_flag " $normal
|
||||
else
|
||||
echo -n -s $bg_white $magenta " $git_branch " $normal
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Terminate with a space
|
||||
echo -n -s ' ' $normal
|
||||
end
|
BIN
themes/ocean/preview.png
Normal file
BIN
themes/ocean/preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 126 KiB |
Loading…
Reference in New Issue
Block a user