commit 73c275b3d9102355678eeae970946425b4b694f9
parent be58009d3ebff0af85c98db54dfa858b17e26197
Author: jacob@thinkpad <jacobouno@protonmail.com>
Date: Sat, 29 Feb 2020 16:47:25 -0800
found out how to make one line functions, added tmux function and timed command function, and sorted everything better
Diffstat:
1 file changed, 20 insertions(+), 24 deletions(-)
diff --git a/aliases/.aliases b/aliases/.aliases
@@ -40,25 +40,29 @@ alias nv='nvim'
alias l="$PAGER"
-# functions
+
+## one linefunctions
+
+# delay execution of command by input * 60 seconds (must quote command)
+t(){ sleep $( calc -d "$1" \* 60 ) ; $2 ;}
# find and edit
-function fe(){
- find / -name "$1" -exec "$EDITOR" '{}' \; 2>/dev/null
-}
+fe(){ find / -name "$1" -exec "$EDITOR" '{}' \; 2>/dev/null ;}
# dictinary search
-function ds(){
- curl "dict://dict.org/m:$1"
-}
+ds(){ curl "dict://dict.org/m:$1" ;}
# dictionary define
-function d(){
- curl "dict://dict.org/d:$1"
-}
+d(){ curl "dict://dict.org/d:$1" ;}
+
+# get working directory
+wd() { pwd | sed "s/\/home\/$USER/~/g" ;}
+# start tmux automaticly
+ssh(){ /usr/bin/ssh -t "$@" "tmux a || tmux new" ;}
+## multiline functions
# test if you can connect to host
is_up(){
if [ "$( ping -c 1 -W 1.2 "$1" | tail -n 2 | head -n 1 | cut -d ',' -f 2 | awk '{print $1}' )" -ne 0 ]; then
@@ -68,10 +72,9 @@ is_up(){
fi
}
-
-
+#
# open today's note
-function daily(){
+daily(){
time="$(date +%H%M)"
# counts as the previous day until six
if [[ "$time" -gt 0 ]] && [[ "$time" -lt 600 ]]; then
@@ -99,18 +102,11 @@ function daily(){
-# get working directory
-wd() {
- echo "$PWD" | sed "s/\/home\/$USER/~/g"
-}
-
-
-
-# history functions
+## history functions
# history search
-function hs(){
+hs(){
if [ -n "$2"]; then
fc -n -l 0 | grep "$1" | tail
else
@@ -119,7 +115,7 @@ function hs(){
}
# repeat
-function r(){
+r(){
if [ -z "$1" ]; then
fc -s
else
@@ -128,7 +124,7 @@ function r(){
}
# repeat edit
-function re(){
+re(){
if [ -z "$1" ]; then
fc -e "$EDITOR"
else