mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-27 18:59:40 +08:00
[split] Move cmorrell.com theme to oh-my-fish/theme-cmorrell.com
https://github.com/oh-my-fish/theme-cmorrell.com
This commit is contained in:
parent
fee0b1bbb5
commit
1e2648510b
|
@ -1,16 +0,0 @@
|
|||
# Chris Morrell's Fish Theme
|
||||
|
||||
This is a theme I designed for myself but have given to a few friends and decided to publish for others' enjoyment.
|
||||
|
||||
![Chris Morrell's Fish Theme](https://cloud.githubusercontent.com/assets/21592/4770904/8a58e026-5b89-11e4-927c-42a387b41df0.gif)
|
||||
|
||||
## Features
|
||||
|
||||
- Minimal base prompt
|
||||
- Shows compact git status w/ the number of changed files & current branch
|
||||
- Gives a visual indication when you're logged in via SSH, or logged in as anyone
|
||||
but the default user (set the `$default_user` variable to define your default user)
|
||||
- Shows indicator if previous command failed
|
||||
- Shows a bright red "!" if you're logged in as root
|
||||
|
||||
(Note: _This theme is designed for a light-on-dark theme like [Solarized](http://ethanschoonover.com/solarized) but should work in a dark-on-light terminal with a few terminal color tweaks_)
|
|
@ -1,74 +0,0 @@
|
|||
set -g pad " "
|
||||
|
||||
## Function to show a segment
|
||||
function prompt_segment -d "Function to show a segment"
|
||||
# Get colors
|
||||
set -l bg $argv[1]
|
||||
set -l fg $argv[2]
|
||||
|
||||
# Set 'em
|
||||
set_color -b $bg
|
||||
set_color $fg
|
||||
|
||||
# Print text
|
||||
if [ -n "$argv[3]" ]
|
||||
echo -n -s $argv[3]
|
||||
end
|
||||
end
|
||||
|
||||
## Function to show current status
|
||||
function show_status -d "Function to show the current status"
|
||||
if [ $RETVAL -ne 0 ]
|
||||
prompt_segment red white " ▲ "
|
||||
set pad ""
|
||||
end
|
||||
if [ -n "$SSH_CLIENT" ]
|
||||
prompt_segment blue white " SSH: "
|
||||
set pad ""
|
||||
end
|
||||
end
|
||||
|
||||
## Show user if not default
|
||||
function show_user -d "Show user"
|
||||
if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
|
||||
set -l host (hostname -s)
|
||||
set -l who (whoami)
|
||||
prompt_segment normal yellow " $who"
|
||||
|
||||
# Skip @ bit if hostname == username
|
||||
if [ "$USER" != "$HOST" ]
|
||||
prompt_segment normal white "@"
|
||||
prompt_segment normal green "$host "
|
||||
set pad ""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Show directory
|
||||
function show_pwd -d "Show the current directory"
|
||||
set -l pwd (prompt_pwd)
|
||||
prompt_segment normal blue "$pad$pwd "
|
||||
end
|
||||
|
||||
# Show prompt w/ privilege cue
|
||||
function show_prompt -d "Shows prompt with cue for current priv"
|
||||
set -l uid (id -u $USER)
|
||||
if [ $uid -eq 0 ]
|
||||
prompt_segment red white " ! "
|
||||
set_color normal
|
||||
echo -n -s " "
|
||||
else
|
||||
prompt_segment normal white " \$ "
|
||||
end
|
||||
|
||||
set_color normal
|
||||
end
|
||||
|
||||
## SHOW PROMPT
|
||||
function fish_prompt
|
||||
set -g RETVAL $status
|
||||
show_status
|
||||
show_user
|
||||
show_pwd
|
||||
show_prompt
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
|
||||
function get_git_status -d "Gets the current git status"
|
||||
if command git rev-parse --is-inside-work-tree >/dev/null 2>&1
|
||||
set -l dirty (command git status -s --ignore-submodules=dirty | wc -l | sed -e 's/^ *//' -e 's/ *$//' 2> /dev/null)
|
||||
set -l ref (command git symbolic-ref HEAD | sed "s-refs/heads/--" | sed -e 's/^ *//' -e 's/ *$//' 2> /dev/null)
|
||||
|
||||
if [ "$dirty" != "0" ]
|
||||
set_color -b normal
|
||||
set_color red
|
||||
echo "$dirty changed file"
|
||||
if [ "$dirty" != "1" ]
|
||||
echo "s"
|
||||
end
|
||||
echo " "
|
||||
set_color -b red
|
||||
set_color white
|
||||
else
|
||||
set_color -b cyan
|
||||
set_color white
|
||||
end
|
||||
|
||||
echo " $ref "
|
||||
set_color normal
|
||||
end
|
||||
end
|
||||
|
||||
function fish_right_prompt -d "Prints right prompt"
|
||||
get_git_status
|
||||
end
|
Loading…
Reference in New Issue
Block a user