Initial checkin
This commit is contained in:
41
fish/functions/fish_right_prompt.fish
Normal file
41
fish/functions/fish_right_prompt.fish
Normal file
@@ -0,0 +1,41 @@
|
||||
# prints "ARG1:ARG2" with appropriate colors
|
||||
function section
|
||||
printf ", "
|
||||
printf $c1
|
||||
printf $argv[1]
|
||||
printf $c0
|
||||
printf ":"
|
||||
printf $c3
|
||||
printf $argv[2]
|
||||
printf $c0
|
||||
end
|
||||
|
||||
function machine_tag
|
||||
hostname | cut -f1 -d. - | tr '[a-z]' '[A-Z]'
|
||||
end
|
||||
|
||||
function fish_right_prompt
|
||||
# Current time
|
||||
printf $c0
|
||||
printf "["
|
||||
printf (date "+$c2%H$c0:$c2%M")
|
||||
|
||||
# Show last execution time
|
||||
if test $CMD_DURATION
|
||||
if test $CMD_DURATION -gt (math "1000 * 2")
|
||||
set secs (math "$CMD_DURATION / 1000")
|
||||
section took {$secs}s
|
||||
end
|
||||
end
|
||||
|
||||
printf $c0
|
||||
printf "]"
|
||||
|
||||
if set -q SSH_CLIENT
|
||||
printf "["
|
||||
printf $c1
|
||||
printf (machine_tag)
|
||||
printf $c0
|
||||
printf "]"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user