Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve right prompt #8

Merged
merged 3 commits into from
Oct 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions fish_right_prompt.fish
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
function fish_right_prompt
set -l exit_code $status
set -l exit_code $status
set -l cmd_duration $CMD_DURATION
__tmux_prompt
if test $exit_code -ne 0
set_color red
else
set_color 666666
set_color green
end
printf '%d' $exit_code
if test $cmd_duration -ge 5000
set_color brcyan
else
set_color blue
end
printf ' < %s' (_convertsecs (math $cmd_duration / 1000))
set_color 666666
printf ' < %s' (date +%H:%M:%S)
set_color normal
Expand Down Expand Up @@ -53,4 +60,6 @@ function _is_multiplexed
echo $multiplexer
end


function _convertsecs
printf "%02d:%02d:%02d\n" (math $argv[1] / 3600) (math (math $argv[1] \% 3600) / 60) (math $argv[1] \% 60)
end