From 8ebd75be8fd1fd3375393742eb5ea5d6ed7dea22 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 16 Nov 2017 21:46:40 +0100 Subject: Todo fix --- functions/fish_prompt.fish | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'functions') diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 180359d..b66528a 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -129,13 +129,15 @@ function prompt_shlv -d "Display level shell" end function prompt_todo -d "Display todo" - set all (todo | wc -l) - set chkd (todo checked | wc -l) - set td (math "$all-$chkd") + if which todo ^ /dev/null > /dev/null + set all (todo | wc -l) + set chkd (todo checked | wc -l) + set td (math "$all-$chkd") - if [ $all -gt 0 ] - prompt_segment 5C5C5C blue "$td/$all" - end + if [ $all -gt 0 ] + prompt_segment 5C5C5C blue "$td/$all" + end + end end -- cgit v1.2.3 From b90b805b41205dc65872c570ea26acb283106620 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 16 Nov 2017 21:47:14 +0100 Subject: Better sec --- functions/sec.fish | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'functions') diff --git a/functions/sec.fish b/functions/sec.fish index 3dda398..4f87d4e 100644 --- a/functions/sec.fish +++ b/functions/sec.fish @@ -1,2 +1,9 @@ -alias sec='ssh achessh@ache.one -p 21 -D 8886 -fN' +function sec + set t (lsof -c ssh -i :8886 -a -Fp | grep "^p" | head -n 1 | cut -c 2-) + if [ -n "$t" -a "$t" != " +" ] + kill $t + end + ssh achessh@37.59.109.240 -p 21 -D 8886 -fN +end -- cgit v1.2.3