Skip to content

Commit 3797158

Browse files
author
Hasan Ozgan
committed
first commit
0 parents  commit 3797158

File tree

4 files changed

+141
-0
lines changed

4 files changed

+141
-0
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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.

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## lambda
2+

fish_prompt.fish

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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 (hostname|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+
#use extended color pallete if available
20+
#if [[ $terminfo[colors] -ge 256 ]]; then
21+
# turquoise="%F{81}"
22+
# orange="%F{166}"
23+
# purple="%F{135}"
24+
# hotpink="%F{161}"
25+
# limegreen="%F{118}"
26+
#else
27+
# turquoise="%F{cyan}"
28+
# orange="%F{yellow}"
29+
# purple="%F{magenta}"
30+
# hotpink="%F{red}"
31+
# limegreen="%F{green}"
32+
#fi
33+
set -l normal (set_color normal)
34+
set -l white (set_color white)
35+
set -l turquoise (set_color cyan)
36+
set -l orange (set_color yellow)
37+
set -l hotpink (set_color red)
38+
set -l blue (set_color blue)
39+
set -l limegreen (set_color green)
40+
set -l purple (set_color magenta)
41+
42+
# Configure __fish_git_prompt
43+
set -g __fish_git_prompt_char_stateseparator ' '
44+
set -g __fish_git_prompt_color cyan
45+
set -g __fish_git_prompt_color_flags yellow
46+
set -g __fish_git_prompt_color_prefix white
47+
set -g __fish_git_prompt_color_suffix white
48+
set -g __fish_git_prompt_showdirtystate true
49+
set -g __fish_git_prompt_showuntrackedfiles true
50+
set -g __fish_git_prompt_showstashstate true
51+
set -g __fish_git_prompt_show_informative_status true
52+
53+
# Line 1
54+
echo -n $white'╭─'$hotpink$USER$white' at '$orange$__fish_prompt_hostname$white' in '$limegreen(pwd)$turquoise
55+
__fish_git_prompt " (%s)"
56+
echo
57+
58+
# Line 2
59+
echo -n $white'╰─'$__fish_prompt_char $normal
60+
end
61+
62+

fish_right_prompt.fish

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
function fish_right_prompt
2+
__tmux_prompt
3+
set -l exit_code $status
4+
if test $exit_code -ne 0
5+
set_color red
6+
else
7+
set_color -o black
8+
end
9+
printf '%d' $exit_code
10+
set_color -o black
11+
printf ' < %s' (date +%H:%M:%S)
12+
set_color normal
13+
end
14+
15+
function __tmux_prompt
16+
set multiplexer (_is_multiplexed)
17+
18+
switch $multiplexer
19+
case screen
20+
set pane (_get_screen_window)
21+
case tmux
22+
set pane (_get_tmux_window)
23+
end
24+
25+
set_color -o black
26+
if test -z $pane
27+
echo -n ""
28+
else
29+
echo -n $pane' | '
30+
end
31+
end
32+
33+
function _get_tmux_window
34+
tmux lsw | grep active | sed 's/\*.*$//g;s/: / /1' | awk '{ print $2 "-" $1 }' -
35+
end
36+
37+
function _get_screen_window
38+
set initial (screen -Q windows; screen -Q echo "")
39+
set middle (echo $initial | sed 's/ /\n/g' | grep '\*' | sed 's/\*\$ / /g')
40+
echo $middle | awk '{ print $2 "-" $1 }' -
41+
end
42+
43+
function _is_multiplexed
44+
set multiplexer ""
45+
if test -z $TMUX
46+
else
47+
set multiplexer "tmux"
48+
end
49+
if test -z $WINDOW
50+
else
51+
set multiplexer "screen"
52+
end
53+
echo $multiplexer
54+
end
55+
56+

0 commit comments

Comments
 (0)