Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual improvements #4

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.png
.jpg
.DS_Store
.vscode
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
# RED SNAPPER
![Red Snapper](https://raw.githubusercontent.com/ZuraGuerra/theme-red-snapper/master/redsnapper.jpg)
![Red Snapper, fish shell theme](./images/red-snapper.jpg)

## ><}}*> F E A T U R E S
## Features
+ Directory path
+ Git branch name
+ Git status
+ YOUR OWN PET FISH!
+ A LOYAL FISH PET!

## ><}}*> GIT STATUS
### Untracked changes
Your pet will detect if you added files, but didn't track them. He will open his mouth, hungry of yummy commits!
![fish shell untracked changes](https://raw.githubusercontent.com/ZuraGuerra/theme-red-snapper/master/hungry2.png)
## Installation
### Oh My Fish
```fish
omf theme red-snapper
```

After you commit, he will close his mouth, satiated.
![fish shell commited](https://raw.githubusercontent.com/ZuraGuerra/theme-red-snapper/master/fed.png)
### Fisher
```fish
fisher install oh-my-fish/theme-red-snapper
```

### Can't find .git
Something is fishy here! If you are not inside a Git working directory, your pet will go to sleep.
![fish shell not using git](https://raw.githubusercontent.com/ZuraGuerra/theme-red-snapper/master/fishy.png)
## Git Status
### Track changes
Your fish will identify if you've added files without tracking them. It will open its mouth, eager for new commits!
![Red Snapper, preview dirty git repository](./images/preview-dirty-git.jpg)

After you've committed, it will close its mouth, satisfied.
![Red Snapper, preview clean git repository](./images/preview-clean-git.jpg)

### Can't find .git
Something is fishy here! If you're not within a Git working directory, your pet will go to sleep.
![Red Snapper, preview no git repository](./images/preview-no-git.jpg)
80 changes: 54 additions & 26 deletions functions/fish_prompt.fish
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,78 @@ function _is_git_dirty
echo (command git status -s --ignore-submodules=dirty 2> /dev/null)
end

function _init_colors
set -g blue (set_color -o blue)
set -g green (set_color -o green)
set -g red (set_color -o red)
set -g yellow (set_color -o yellow)

function fish_prompt
set -l blue (set_color -o blue)
set -l green (set_color -o green)
set -l red (set_color -o red)
set -l yellow (set_color -o yellow)

set -l orange_fish (set_color -o FFA500)
set -l yellow_fish (set_color -o FFB732)
set -l red_fish (set_color -o FF725A)
set -l black_fish (set_color -o 3F3F3F)
set -g orange_fish (set_color -o FFA500)
set -g yellow_fish (set_color -o FFB732)
set -g red_fish (set_color -o FF725A)
set -g black_fish (set_color -o 3F3F3F)

set_color $fish_color_cwd
end

if [ -n "$SSH_CONNECTION" ]
function _maybe_draw_ssh_conn
if test -n "$SSH_CONNECTION"
printf '%s | ' (hostname | head -c 10)
end
end

if [ "$HOME" = (pwd) ]
function _draw_current_dir
if test "$HOME" = (pwd)
printf "$red~"
else
printf (pwd)
printf (prompt_pwd)
end
end

printf "$blue ─> "
function _maybe_draw_git_branch
set -l branch_name (_git_branch_name)

if test -n "$branch_name"
switch "$branch_name"
case 'main' 'master'
printf "$red{[%s]}" (string upper $branch_name)
case '*'
printf "$red{[%s]}" "$branch_name"
end
end
end

if [ (_git_branch_name) ]
function _draw_fish

if test (_git_branch_name) = "master"
printf "$red(MASTER)"
else
printf "$red("(_git_branch_name)")"
end
set -l branch_name (_git_branch_name)

if [ (_is_git_dirty) ]
printf " $orange_fish><$yellow_fish}}$black_fish*$red_fish< "
# git dir = false
if not test -n "$branch_name"
printf "$blue><}}*> "
end

# git dir = true
if test -n "$branch_name"
if test -n (_is_git_dirty)
printf "$orange_fish><$yellow_fish}}$black_fish*$red_fish< "
else
printf " $orange_fish><$yellow_fish}}$black_fish*$orange_fish> "
printf "$orange_fish><$yellow_fish}}$black_fish*$orange_fish> "
end
end
end

else
printf "$blue><}}*> "
function fish_prompt
_init_colors

end
_maybe_draw_ssh_conn

_draw_current_dir

printf "$blue ─> "

_maybe_draw_git_branch

printf "\n"

_draw_fish
end
Binary file added images/preview-clean-git.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/preview-dirty-git.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/preview-no-git.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/red-snapper.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.