Skip to content

Commit 28c7181

Browse files
author
Beau Hastings
committed
Initial commit
Signed-off-by: Beau Hastings <[email protected]>
0 parents  commit 28c7181

17 files changed

+379
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Beau Hastings
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# kawasaki
2+
3+
`kawasaki` is a [fish][fish] theme that emphasizes a simple and useful prompt without useless cluttter.
4+
5+
[![Oh My Fish](https://img.shields.io/badge/Framework-Oh_My_Fish-blue.svg?style=flat)](https://github.com/oh-my-fish/oh-my-fish)
6+
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](/LICENSE)
7+
8+
![kawasaki][screenshot]
9+
10+
11+
## Installation
12+
13+
#### Requirements
14+
* [Fish shell][fish] - a smart and user-friendly command line
15+
shell for OS X, Linux, and the rest of the family
16+
* [Oh My Fish][omf] - The Fishshell Framework
17+
18+
Once Oh My Fish is installed:
19+
20+
omf install kawasaki
21+
22+
This theme was inspired by [bira][bira].
23+
24+
#### Notes
25+
26+
To use kawasaki's virtualenv prompt instead of the default virtualenv prompt append `set -x VIRTUAL_ENV_DISABLE_PROMPT 1` to your [init.fish][dotfiles]
27+
28+
29+
## Features
30+
31+
* Completely customizable.
32+
* Display status of the working tree for Git projects.
33+
* Read/write indicator of the current working directory.
34+
* Background jobs indicator.
35+
* Virtualenv prompt indicator.
36+
37+
38+
## Customizing
39+
40+
#### Override defaults
41+
42+
You can override the default display settings by specifying any of the following settings in your [init.fish][dotfiles]:
43+
44+
```fish
45+
## Enable the time to be displayed.
46+
set -g theme_display_time yes
47+
48+
## Disable playing the user's current group.
49+
set -g theme_display_group no
50+
51+
## Disable Git-awareness.
52+
set -g theme_display_git no
53+
54+
## Don't disable jobs indicator.
55+
set -g theme_display_jobs no
56+
57+
## Always display the jobs indicator, even if there are no jobs.
58+
set -g theme_display_jobs_always yes
59+
60+
## Hide the current directory read/write indicator.
61+
set -g theme_display_rwt no
62+
63+
## Don't display the VirtualEnv prompt.
64+
set -g theme_display_virtualent no
65+
```
66+
67+
#### Look and feel
68+
69+
Nearly every aspect of kawasaki can be customized. The following can be set to adjust the look and feel of kawasaki:
70+
71+
```fish
72+
set -g theme_color_error red
73+
set -g theme_color_superuser red
74+
set -g theme_color_user white
75+
set -g theme_color_group 666666
76+
set -g theme_color_host brgreen
77+
set -g theme_color_separator brblack
78+
set -g theme_color_bracket brblue
79+
set -g theme_color_normal normal
80+
set -g theme_color_time 666666
81+
set -g theme_color_path brwhite
82+
set -g theme_color_prompt white
83+
set -g theme_color_virtualenv bryellow
84+
set -g theme_color_status_prefix brblue
85+
set -g theme_color_status_jobs brgreen
86+
set -g theme_color_status_rw brwhite
87+
88+
set -g theme_prompt_char_normal '$'
89+
set -g theme_prompt_char_superuser '#'
90+
set -g theme_prompt_char "$theme_prompt_char_normal"
91+
92+
set -g theme_prompt_superuser_glyph \u2605
93+
set -g theme_prompt_userhost_separator ':'
94+
95+
set -g theme_prompt_segment_separator_char ' '
96+
set -g theme_prompt_segment_separator_color normal
97+
98+
set -g theme_prompt_status_jobs_char '%'
99+
set -g theme_prompt_status_rw_char '.'
100+
set -g theme_prompt_status_separator_char '/'
101+
102+
set -g theme_prompt_virtualenv_char_begin '('
103+
set -g theme_prompt_virtualenv_char_end ')'
104+
set -g theme_prompt_virtualenv_color_char_begin normal
105+
set -g theme_prompt_virtualenv_color_char_end normal
106+
107+
set -g theme_display_time_format '+%I:%M'
108+
109+
set -g __fish_git_prompt_color_merging red
110+
set -g __fish_git_prompt_color_branch brblue
111+
set -g __fish_git_prompt_showcolorhints yes
112+
set -g __fish_git_prompt_show_informative_status yes
113+
set -g __fish_git_prompt_char_stateseparator ' '
114+
115+
set -g __fish_git_prompt_char_branch_begin ''
116+
set -g __fish_git_prompt_char_branch_end ''
117+
set -g __fish_git_prompt_color_branch_begin bryellow
118+
set -g __fish_git_prompt_color_branch_end bryellow
119+
```
120+
121+
## License
122+
123+
kawasaki is released under [The MIT License (MIT)][license]
124+
125+
Copyright (c) 2016 Beau Hastings
126+
127+
[license]: /LICENSE
128+
[fish]: https://github.com/fish-shell/fish-shell
129+
[omf]: https://github.com/oh-my-fish/oh-my-fish
130+
[screenshot]: https://cloud.githubusercontent.com/assets/195790/20061473/9545bd4c-a4c5-11e6-83da-8b0a954b8a5a.gif
131+
[bira]: https://github.com/oh-my-fish/theme-bira
132+
[dotfiles]: https://github.com/oh-my-fish/oh-my-fish#dotfiles

fish_greeting.fish

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
function fish_greeting;end

fish_prompt.fish

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/usr/bin/fish
2+
#
3+
# kawasaki.theme
4+
#
5+
# A theme for the fish shell.
6+
#
7+
# Copyright (c) 2016 Beau Hastings.
8+
# License: GNU General Public License v2
9+
#
10+
# Author: Beau Hastings <[email protected]>
11+
#
12+
13+
#
14+
# Notes:
15+
# To use the theme's virtualenv prompt indicator you should add the following to your init.fish (https://github.com/oh-my-fish/oh-my-fish#dotfiles)
16+
# set --export VIRTUAL_ENV_DISABLE_PROMPT 1
17+
18+
# Override default options
19+
#
20+
## Display the local time
21+
#set -g theme_display_time yes
22+
#
23+
## Display the user's current group
24+
#set -g theme_display_group no
25+
#
26+
## Display git branch status
27+
#set -g theme_display_git no
28+
#
29+
## Display job count
30+
#set -g theme_display_jobs no
31+
#
32+
## By default job count won't display if there are no jobs
33+
#set -g theme_display_jobs_always yes
34+
#
35+
## Don't display if the current working directory is readable/writable
36+
#set -g theme_display_rw no
37+
#
38+
## Don't display virtualenv
39+
#set -g theme_display_virtualenv no
40+
#
41+
42+
# Colors
43+
# TODO: consider displaying colors in the following order: cyan, green, yellow, orange, purple
44+
#
45+
set -g theme_color_error red
46+
set -g theme_color_superuser red
47+
set -g theme_color_user white
48+
set -g theme_color_group 666666
49+
set -g theme_color_host brgreen
50+
set -g theme_color_separator brblack
51+
set -g theme_color_bracket brblue
52+
set -g theme_color_normal normal
53+
set -g theme_color_time 666666
54+
set -g theme_color_path brwhite
55+
set -g theme_color_prompt white
56+
set -g theme_color_virtualenv bryellow
57+
58+
set -g theme_color_status_prefix brblue
59+
set -g theme_color_status_jobs brgreen
60+
set -g theme_color_status_rw brwhite
61+
62+
set -g theme_prompt_char_normal '$'
63+
set -g theme_prompt_char_superuser '#'
64+
set -g theme_prompt_char "$theme_prompt_char_normal"
65+
66+
set -g theme_prompt_superuser_glyph \u2605
67+
set -g theme_prompt_userhost_separator ':'
68+
69+
set -g theme_prompt_segment_separator_char ' '
70+
set -g theme_prompt_segment_separator_color normal
71+
72+
set -g theme_prompt_status_jobs_char '%'
73+
set -g theme_prompt_status_rw_char '.'
74+
set -g theme_prompt_status_separator_char '/'
75+
76+
set -g theme_prompt_virtualenv_char_begin '('
77+
set -g theme_prompt_virtualenv_char_end ')'
78+
set -g theme_prompt_virtualenv_color_char_begin normal
79+
set -g theme_prompt_virtualenv_color_char_end normal
80+
81+
set -g theme_display_time_format '+%I:%M'
82+
83+
#set -g __fish_git_prompt_color_prefix
84+
#set -g __fish_git_prompt_color_suffix
85+
#set -g __fish_git_prompt_color_bare
86+
set -g __fish_git_prompt_color_merging red
87+
set -g __fish_git_prompt_color_branch brblue
88+
#set -g __fish_git_prompt_color_flags
89+
#set -g __fish_git_prompt_color_upstream
90+
#
91+
#__fish_git_prompt_describe_style default|contains|describe|branch
92+
set -g __fish_git_prompt_showcolorhints yes
93+
set -g __fish_git_prompt_show_informative_status yes
94+
set -g __fish_git_prompt_char_stateseparator ' '
95+
96+
# Unofficial fish_git_prompt settings
97+
set -g __fish_git_prompt_char_branch_begin ''
98+
set -g __fish_git_prompt_char_branch_end ''
99+
set -g __fish_git_prompt_color_branch_begin bryellow
100+
set -g __fish_git_prompt_color_branch_end bryellow
101+
102+
103+
function fish_prompt
104+
set -l sep (set_color $theme_prompt_segment_separator_color)$theme_prompt_segment_separator_char(__theme_reset_color)
105+
set -l line1 (string join "$sep" \
106+
(__theme_print_time) \
107+
(__theme_print_userhost) \
108+
(__theme_print_pwd) \
109+
(__theme_print_git_status) \
110+
(__theme_print_jobs) \
111+
(__theme_print_pwd_rw) \
112+
)
113+
set -l line2 (string join " " \
114+
(__theme_print_virtualenv) \
115+
(__theme_print_prompt_char)\
116+
)
117+
118+
echo "$line1"
119+
echo "$line2 "
120+
end

fish_right_prompt.fish

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function fish_right_prompt
2+
set -l st $status
3+
4+
if [ $status != 0 ]
5+
echo (set_color $theme_color_error) ↵ $st(set_color $theme_color_normal)
6+
end
7+
end

fish_title.fish

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function fish_title
2+
# Customize terminal window title
3+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function __theme_print_git_status
2+
[ "$theme_display_git" = 'no' ]; and return
3+
set -l git_prompt (__fish_git_prompt | command sed -e 's/^ (//' -e 's/)$//')
4+
5+
[ "$git_prompt" = "" ]; and return
6+
7+
print_colored $__fish_git_prompt_char_branch_begin $__fish_git_prompt_color_branch_begin
8+
printf '%s' $git_prompt
9+
print_colored $__fish_git_prompt_char_branch_end $__fish_git_prompt_color_branch_end
10+
end

functions/__theme_print_jobs.fish

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function __theme_print_jobs
2+
[ "$theme_display_jobs" = 'no' ]; and return
3+
set -l num_jobs (jobs -l | command wc -l)
4+
5+
if [ $num_jobs -gt 0 -o "$theme_display_jobs_always" = "yes" ]
6+
print_colored "$theme_prompt_status_jobs_char" $theme_color_status_prefix
7+
print_colored "$theme_prompt_status_separator_char" $theme_color_separator
8+
print_colored "$num_jobs" $theme_color_status_jobs
9+
end
10+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function __theme_print_prompt_char
2+
print_colored $theme_prompt_char $theme_color_prompt
3+
end

functions/__theme_print_pwd.fish

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function __theme_print_pwd
2+
print_colored (prompt_pwd) $theme_color_path
3+
end

functions/__theme_print_pwd_rw.fish

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function __theme_print_pwd_rw
2+
[ "$theme_display_rw" = 'no' ]; and return;
3+
set -l rw_chars
4+
5+
if [ -r . ]; set rw_chars r; end
6+
if [ -w . ]; set rw_chars $rw_chars"w"; end
7+
8+
print_colored $theme_prompt_status_rw_char $theme_color_status_prefix
9+
print_colored $theme_prompt_status_separator_char $theme_color_separator
10+
print_colored $rw_chars $theme_color_status_rw
11+
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function __theme_print_superuser
2+
if [ (command id -u) = "0" ]
3+
set theme_prompt_char "$theme_prompt_char_superuser"
4+
print_colored $theme_prompt_superuser_glyph $theme_color_superuser
5+
else
6+
set theme_prompt_char "$theme_prompt_char_normal"
7+
end
8+
end

functions/__theme_print_time.fish

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function __theme_print_time
2+
[ "$theme_display_time" = 'yes' ]; or return;
3+
print_colored (command date $theme_display_time_format) $theme_color_time
4+
end

functions/__theme_print_userhost.fish

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function __theme_print_userhost
2+
echo -ns (__theme_print_superuser) $USER (__theme_reset_color)
3+
4+
if [ "$theme_display_group" != 'no' ]
5+
print_colored $theme_prompt_userhost_separator $theme_color_separator
6+
print_colored (id -gn) $theme_color_group
7+
end
8+
9+
set -l hostname (command hostname | cut -d '.' -f 1)
10+
11+
print_colored "@" $theme_color_separator
12+
print_colored "$hostname" $theme_color_host
13+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function __theme_print_virtualenv
2+
[ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" ]; and return
3+
4+
set -l basename (basename "$VIRTUAL_ENV")
5+
6+
# special case for Aspen magic directories (http://www.zetadev.com/software/aspen/)
7+
if test "$basename" = "__"
8+
set basename (basename (dirname "$VIRTUAL_ENV"))
9+
end
10+
11+
print_colored $theme_prompt_virtualenv_char_begin $theme_prompt_virtualenv_color_char_begin
12+
print_colored $basename $theme_color_virtualenv
13+
print_colored $theme_prompt_virtualenv_char_end $theme_prompt_virtualenv_color_char_end
14+
end

functions/__theme_reset_color.fish

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function __theme_reset_color
2+
set_color $theme_color_normal
3+
end

functions/print_colored.fish

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function print_colored
2+
set -l bgcolor normal
3+
set -l fgcolor normal
4+
set -l text
5+
6+
if contains -- -b in $argv[1]
7+
set bgcolor $argv[2]
8+
set fgcolor $argv[-1]
9+
set text $argv[3..-2]
10+
else
11+
set fgcolor $argv[-1]
12+
set text $argv[1..-2]
13+
end
14+
15+
printf '%s%s%s' (set_color -b $bgcolor $fgcolor) (string join " " $text) (__theme_reset_color)
16+
end

0 commit comments

Comments
 (0)