├── LICENSE
├── README.md
├── functions
├── fish_prompt.fish
└── fish_right_prompt.fish
├── screenshot-mode-indicator.png
└── screenshot.png
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Bruno Ferreira Pinto
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 | ### Lambda
2 |
3 | [](/LICENSE)
4 | [](http://fishshell.com)
5 |
6 |
7 |
8 | #### Screenshot
9 |
10 |
11 |
12 |
13 |
14 | ###### Added VirtualEnv Support
15 | 
16 |
17 | ###### Added Mode Indicator Support
18 |
19 |
20 |
21 |
22 | #### Install
23 |
24 | #### [Fisherman]
25 |
26 | ```fish
27 | fisher i lambda
28 | ```
29 |
30 | ##### [Oh-My-Fish]
31 |
32 | ```fish
33 | omf install lambda
34 | ```
35 |
36 | ##### [home-manager]
37 | ```nix
38 | plugins = [
39 | {
40 | name = "theme-lambda";
41 | src = pkgs.fetchFromGitHub {
42 | owner = "hasanozgan";
43 | repo = "theme-lambda";
44 | rev = "1d599f05dc560d7c9fa0660fa72e2d32251f6f65";
45 | sha256 = "1s0pyc7nlxlynszlskmzrg57rq2nszbkzjq714hl15g1 gxp95k";
46 | };
47 | }
48 | ];
49 | ```
50 |
51 |
52 | ##### Fish Mode Indicator Installation Note
53 |
54 | Disable default Fish mode indicator via
55 |
56 | ```
57 | function fish_mode_prompt; end
58 | funcsave fish_mode_prompt
59 | ```
60 |
61 | Details in https://fishshell.com/docs/current/cmds/fish_mode_prompt.html
62 |
63 |
64 |
65 |
66 | [Fisherman]: https://github.com/fisherman/fisherman
67 | [Oh-My-Fish]: https://github.com/oh-my-fish/oh-my-fish
68 | [home-manager]: https://github.com/nix-community/home-manager
69 |
--------------------------------------------------------------------------------
/functions/fish_prompt.fish:
--------------------------------------------------------------------------------
1 | function fish_prompt
2 | # Cache exit status
3 | set -l last_status $status
4 |
5 | # Just calculate these once, to save a few cycles when displaying the prompt
6 | if not set -q __fish_prompt_hostname
7 | set -g __fish_prompt_hostname (uname -n|cut -d . -f 1)
8 | end
9 | if not set -q __fish_prompt_char
10 | switch (id -u)
11 | case 0
12 | set -g __fish_prompt_char '#'
13 | case '*'
14 | set -g __fish_prompt_char 'λ'
15 | end
16 | end
17 |
18 | # Setup colors
19 | set -l hostcolor (set_color (uname -n | md5sum | cut -f1 -d' ' | tr -d '\n' | tail -c6))
20 | set -l normal (set_color normal)
21 | set -l white (set_color FFFFFF)
22 | set -l turquoise (set_color 5fdfff)
23 | set -l orange (set_color df5f00)
24 | set -l hotpink (set_color df005f)
25 | set -l blue (set_color blue)
26 | set -l limegreen (set_color 87ff00)
27 | set -l purple (set_color af5fff)
28 |
29 | # Configure __fish_git_prompt
30 | set -g __fish_git_prompt_char_stateseparator ' '
31 | set -g __fish_git_prompt_color 5fdfff
32 | set -g __fish_git_prompt_color_flags df5f00
33 | set -g __fish_git_prompt_color_prefix white
34 | set -g __fish_git_prompt_color_suffix white
35 | set -g __fish_git_prompt_showdirtystate true
36 | set -g __fish_git_prompt_showuntrackedfiles true
37 | set -g __fish_git_prompt_showstashstate true
38 | set -g __fish_git_prompt_show_informative_status true
39 |
40 | set -l current_user (whoami)
41 |
42 | ##
43 | ## Line 1
44 | ##
45 | echo -n $hostcolor'╭─'$hotpink$current_user$white' at '$orange$__fish_prompt_hostname$white' in '$limegreen(pwd|sed "s=$HOME=⌁=")$turquoise
46 | __fish_git_prompt " (%s)"
47 | echo
48 |
49 | ##
50 | ## Line 2
51 | ##
52 | echo -n $hostcolor'╰'
53 |
54 | # Disable virtualenv's default prompt
55 | set -g VIRTUAL_ENV_DISABLE_PROMPT true
56 |
57 | # support for virtual env name
58 | if set -q VIRTUAL_ENV
59 | echo -n "($turquoise"(basename "$VIRTUAL_ENV")"$white)"
60 | end
61 |
62 | ##
63 | ## Support for vi mode
64 | ##
65 | set -l lambdaViMode "$THEME_LAMBDA_VI_MODE"
66 |
67 | # Do nothing if not in vi mode
68 | if test "$fish_key_bindings" = fish_vi_key_bindings
69 | or test "$fish_key_bindings" = fish_hybrid_key_bindings
70 | if test -z (string match -ri '^no|false|0$' $lambdaViMode)
71 | set_color --bold
72 | echo -n $white'─['
73 | switch $fish_bind_mode
74 | case default
75 | set_color red
76 | echo -n 'n'
77 | case insert
78 | set_color green
79 | echo -n 'i'
80 | case replace_one
81 | set_color green
82 | echo -n 'r'
83 | case replace
84 | set_color cyan
85 | echo -n 'r'
86 | case visual
87 | set_color magenta
88 | echo -n 'v'
89 | end
90 | echo -n $white']'
91 | end
92 | end
93 |
94 | ##
95 | ## Rest of the prompt
96 | ##
97 | echo -n $hostcolor'─'$white$__fish_prompt_char $normal
98 | end
99 |
100 |
--------------------------------------------------------------------------------
/functions/fish_right_prompt.fish:
--------------------------------------------------------------------------------
1 | function fish_right_prompt
2 | set -l exit_code $status
3 | set -l cmd_duration $CMD_DURATION
4 | __tmux_prompt
5 | if test $exit_code -ne 0
6 | set_color red
7 | else
8 | set_color green
9 | end
10 | printf '%d' $exit_code
11 | if test $cmd_duration -ge 5000
12 | set_color brcyan
13 | else
14 | set_color blue
15 | end
16 | printf ' (%s)' (__print_duration $cmd_duration)
17 | set_color 666666
18 | printf ' < %s' (date +%H:%M:%S)
19 | set_color normal
20 | end
21 |
22 | function __tmux_prompt
23 | set multiplexer (_is_multiplexed)
24 |
25 | switch $multiplexer
26 | case screen
27 | set pane (_get_screen_window)
28 | case tmux
29 | set pane (_get_tmux_window)
30 | end
31 |
32 | set_color 666666
33 | if test -z $pane
34 | echo -n ""
35 | else
36 | echo -n $pane' | '
37 | end
38 | end
39 |
40 | function _get_tmux_window
41 | tmux lsw | grep active | sed 's/\*.*$//g;s/: / /1' | awk '{ print $2 "-" $1 }' -
42 | end
43 |
44 | function _get_screen_window
45 | set initial (screen -Q windows; screen -Q echo "")
46 | set middle (echo $initial | sed 's/ /\n/g' | grep '\*' | sed 's/\*\$ / /g')
47 | echo $middle | awk '{ print $2 "-" $1 }' -
48 | end
49 |
50 | function _is_multiplexed
51 | set multiplexer ""
52 | if test -z $TMUX
53 | else
54 | set multiplexer "tmux"
55 | end
56 | if test -z $WINDOW
57 | else
58 | set multiplexer "screen"
59 | end
60 | echo $multiplexer
61 | end
62 |
63 | function __print_duration
64 | set -l duration $argv[1]
65 |
66 | set -l millis (math $duration % 1000)
67 | set -l seconds (math -s0 $duration / 1000 % 60)
68 | set -l minutes (math -s0 $duration / 60000 % 60)
69 | set -l hours (math -s0 $duration / 3600000 % 60)
70 |
71 | if test $duration -lt 60000;
72 | # Below a minute
73 | printf "%d.%03ds\n" $seconds $millis
74 | else if test $duration -lt 3600000;
75 | # Below a hour
76 | printf "%02d:%02d.%03d\n" $minutes $seconds $millis
77 | else
78 | # Everything else
79 | printf "%02d:%02d:%02d.%03d\n" $hours $minutes $seconds $millis
80 | end
81 | end
82 | function _convertsecs
83 | printf "%02d:%02d:%02d\n" (math -s0 $argv[1] / 3600) (math -s0 (math $argv[1] \% 3600) / 60) (math -s0 $argv[1] \% 60)
84 | end
85 |
86 |
--------------------------------------------------------------------------------
/screenshot-mode-indicator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/netologist/theme-lambda/a7cb6dbaee9e9dcbe7fea02b92fc85fb2d278869/screenshot-mode-indicator.png
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/netologist/theme-lambda/a7cb6dbaee9e9dcbe7fea02b92fc85fb2d278869/screenshot.png
--------------------------------------------------------------------------------