Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Hasan Ozgan committed Dec 27, 2015
0 parents commit 3797158
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Bruno Ferreira Pinto

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## lambda

62 changes: 62 additions & 0 deletions fish_prompt.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
function fish_prompt
# Cache exit status
set -l last_status $status

# Just calculate these once, to save a few cycles when displaying the prompt
if not set -q __fish_prompt_hostname
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
end
if not set -q __fish_prompt_char
switch (id -u)
case 0
set -g __fish_prompt_char '#'
case '*'
set -g __fish_prompt_char 'λ'
end
end

# Setup colors
#use extended color pallete if available
#if [[ $terminfo[colors] -ge 256 ]]; then
# turquoise="%F{81}"
# orange="%F{166}"
# purple="%F{135}"
# hotpink="%F{161}"
# limegreen="%F{118}"
#else
# turquoise="%F{cyan}"
# orange="%F{yellow}"
# purple="%F{magenta}"
# hotpink="%F{red}"
# limegreen="%F{green}"
#fi
set -l normal (set_color normal)
set -l white (set_color white)
set -l turquoise (set_color cyan)
set -l orange (set_color yellow)
set -l hotpink (set_color red)
set -l blue (set_color blue)
set -l limegreen (set_color green)
set -l purple (set_color magenta)

# Configure __fish_git_prompt
set -g __fish_git_prompt_char_stateseparator ' '
set -g __fish_git_prompt_color cyan
set -g __fish_git_prompt_color_flags yellow
set -g __fish_git_prompt_color_prefix white
set -g __fish_git_prompt_color_suffix white
set -g __fish_git_prompt_showdirtystate true
set -g __fish_git_prompt_showuntrackedfiles true
set -g __fish_git_prompt_showstashstate true
set -g __fish_git_prompt_show_informative_status true

# Line 1
echo -n $white'╭─'$hotpink$USER$white' at '$orange$__fish_prompt_hostname$white' in '$limegreen(pwd)$turquoise
__fish_git_prompt " (%s)"
echo

# Line 2
echo -n $white'╰─'$__fish_prompt_char $normal
end


56 changes: 56 additions & 0 deletions fish_right_prompt.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
function fish_right_prompt
__tmux_prompt
set -l exit_code $status
if test $exit_code -ne 0
set_color red
else
set_color -o black
end
printf '%d' $exit_code
set_color -o black
printf ' < %s' (date +%H:%M:%S)
set_color normal
end

function __tmux_prompt
set multiplexer (_is_multiplexed)

switch $multiplexer
case screen
set pane (_get_screen_window)
case tmux
set pane (_get_tmux_window)
end

set_color -o black
if test -z $pane
echo -n ""
else
echo -n $pane' | '
end
end

function _get_tmux_window
tmux lsw | grep active | sed 's/\*.*$//g;s/: / /1' | awk '{ print $2 "-" $1 }' -
end

function _get_screen_window
set initial (screen -Q windows; screen -Q echo "")
set middle (echo $initial | sed 's/ /\n/g' | grep '\*' | sed 's/\*\$ / /g')
echo $middle | awk '{ print $2 "-" $1 }' -
end

function _is_multiplexed
set multiplexer ""
if test -z $TMUX
else
set multiplexer "tmux"
end
if test -z $WINDOW
else
set multiplexer "screen"
end
echo $multiplexer
end


0 comments on commit 3797158

Please sign in to comment.