├── fish_title.fish
├── fish_greeting.fish
├── screenshot.png
├── fish_right_prompt.fish
├── .editorconfig
├── LICENSE
├── README.md
└── fish_prompt.fish
/fish_title.fish:
--------------------------------------------------------------------------------
1 | function fish_title
2 | # Customize terminal window title
3 | end
4 |
--------------------------------------------------------------------------------
/fish_greeting.fish:
--------------------------------------------------------------------------------
1 | function fish_greeting
2 | # Customize fish greeting message
3 | end
4 |
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/komarnitskyi/theme-zephyr/HEAD/screenshot.png
--------------------------------------------------------------------------------
/fish_right_prompt.fish:
--------------------------------------------------------------------------------
1 | function fish_right_prompt
2 | # Customize the right prompt
3 | end
4 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 2
6 | charset = utf-8
7 | trim_trailing_whitespace = true
8 | insert_final_newline = true
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Andrii Komarnitskyi
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.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | #### zephyr
4 | > A theme for [Oh My Fish][omf-link].
5 |
6 | [](/LICENSE)
7 | [](https://fishshell.com)
8 | [](https://www.github.com/oh-my-fish/oh-my-fish)
9 |
10 |
11 |
12 |
13 | ## Install
14 |
15 | ```fish
16 | omf install https://github.com/komarnitskyi/theme-zephyr
17 | omf theme zephyr
18 | ```
19 |
20 | ## Requirements
21 | * [fishshell](https://fishshell.com/) > v2.3
22 | * [oh-my-fish](https://fishshell.com/) > v5
23 |
24 | ## Update
25 |
26 | ```fish
27 | omf update zephyr
28 | ```
29 |
30 |
31 | ## Features
32 |
33 | * Displays git information in the command prompt when available.
34 | * Displays node version when available
35 | * Indicate is User has superpower:
36 | * ```➜``` - default prompt
37 | * ```$``` - with SU power
38 |
39 |
40 |
41 | ## Screenshot
42 |
43 |
44 |
45 |
46 |
47 |
48 | # License
49 |
50 | [MIT][mit] © [Andrii Komarnitskyi][author] et [al][contributors]
51 |
52 |
53 | [mit]: https://opensource.org/licenses/MIT
54 | [author]: https://github.com/komarnitskyi
55 | [contributors]: https://github.com/komarnitskyi/theme-zephyr/graphs/contributors
56 | [omf-link]: https://www.github.com/oh-my-fish/oh-my-fish
57 |
58 | [license-badge]: https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square
59 |
--------------------------------------------------------------------------------
/fish_prompt.fish:
--------------------------------------------------------------------------------
1 | # name: zephyr
2 | set fish_color_command green
3 | set fish_color_error red
4 |
5 | set set_cyan (set_color -o cyan)
6 | set set_yellow (set_color -o yellow)
7 | set set_red (set_color -o red)
8 | set set_blue (set_color -o blue)
9 | set set_green (set_color -o green)
10 | set set_magenta (set_color -o magenta)
11 | set set_normal (set_color normal)
12 |
13 | # prompt symbols
14 | set zephyr_PROMPT_SYMBOL "➜ $set_normal"
15 | set zephyr_PROMPT_SYMBOL_ROOT "\$ $set_normal"
16 |
17 | # node symbols
18 | set zephyr_NODE_SYMBOL "$set_green⬢ $set_normal"
19 |
20 | # git symbols
21 | set zephyr_GIT_BEHIND "$set_magenta ⇣$set_normal"
22 | set zephyr_GIT_AHEAD "$set_cyan ⇡$set_normal"
23 | set zephyr_GIT_DIVERGED "$set_cyan ⇡$set_magenta⇣$set_normal"
24 |
25 | # git
26 | function _is_git_dirty
27 | echo (command git status -s --ignore-submodules=dirty 2>/dev/null)
28 | end
29 |
30 | function _git_branch_name
31 | echo (command git symbolic-ref HEAD 2>/dev/null | sed -e 's|^refs/heads/||')
32 | end
33 |
34 | # node version getter
35 | function _get_node_version
36 | if [ (command which node) ]
37 | echo (command node -v)
38 | end
39 | end
40 |
41 | function fish_prompt
42 | set -l last_status $status
43 |
44 | set -l cwd $set_cyan(prompt_pwd)
45 |
46 | if [ (_get_node_version) ]
47 | set -l node_version (string replace -r "\Av(\d*\.\d*.(0|[1-9]{1,}))\Z" '$1' (node -v))
48 | set node_info " $zephyr_NODE_SYMBOL$set_green $node_version$set_normal"
49 | end
50 |
51 | set -l push_or_pull (command git status --porcelain 2>/dev/null -b)
52 | set -l is_behind
53 | set -l is_ahead
54 | set -l git_on 'on '
55 |
56 | if test (string match '*behind*' $push_or_pull)
57 | set is_behind true
58 | end
59 |
60 | if test (string match '*ahead*' $push_or_pull)
61 | set is_ahead true
62 | end
63 |
64 | if test "$is_ahead" = true -a "$is_behind" = true
65 | set git_diverged_status "$zephyr_GIT_DIVERGED"
66 | else if test "$is_ahead" = true
67 | set git_diverged_status "$zephyr_GIT_AHEAD"
68 | else if test "$is_behind" = true
69 | set git_diverged_status "$zephyr_GIT_BEHIND"
70 | end
71 |
72 | if [ (_git_branch_name) ]
73 | set -l git_branch (_git_branch_name)
74 |
75 | # Set git icon red if git has changes
76 | if [ (_is_git_dirty) ]
77 | set git_powerline $set_red""
78 | else
79 | set git_powerline $set_green""$set_green
80 | end
81 |
82 |
83 | if test (_git_branch_name) = 'master'
84 | set git_info "$set_normal $set_cyan$git_on$git_powerline $git_branch$set_normal$git_diverged_status$set_cyan"
85 | else
86 | set git_info "$set_normal $set_cyan$git_on$git_powerline $git_branch$set_normal$git_diverged_status$set_cyan"
87 | end
88 | end
89 |
90 | set zephyr_GIT_USER_NAME (command git config user.name)
91 | set zephyr_GIT_USER_EMAIL (command git config user.email)
92 |
93 | set zephyr_GIT_USER_INFO "$set_cyan by $set_green$zephyr_GIT_USER_NAME ( $set_magenta$zephyr_GIT_USER_EMAIL$set_green ) $set_normal"
94 |
95 | # Check is user has superpower
96 | if test $USER = 'root'
97 | if test $last_status = 0
98 | set _prompt_symbol $set_green$zephyr_PROMPT_SYMBOL_ROOT
99 | else
100 | set _prompt_symbol $set_red$zephyr_PROMPT_SYMBOL_ROOT
101 | end
102 | else
103 | if test $last_status = 0
104 | set _prompt_symbol $set_green$zephyr_PROMPT_SYMBOL
105 | else
106 | set _prompt_symbol $set_red$zephyr_PROMPT_SYMBOL
107 | end
108 | end
109 |
110 | if test $CMD_DURATION -lt 1000
111 | set duration ''
112 | else
113 | set duration $set_magenta ' ' (math "$CMD_DURATION/1000")'s'
114 | end
115 |
116 | echo ''
117 | echo -s $cwd $git_info $normal '' $node_info '' $duration ''
118 |
119 | echo -s $_prompt_symbol ' '
120 | end
121 |
--------------------------------------------------------------------------------