config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit be58009d3ebff0af85c98db54dfa858b17e26197
parent ef2d1d3ba189304e38c8cbf4f7fbc8431e8071e8
Author: jacob@thinkpad <jacobouno@protonmail.com>
Date:   Sat, 29 Feb 2020 16:06:32 -0800

fixed sudo not recognizing aliases, added a few history functions

fixed dict curls, explained every functions use.

Diffstat:
Maliases/.aliases | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 54 insertions(+), 10 deletions(-)

diff --git a/aliases/.aliases b/aliases/.aliases @@ -6,7 +6,7 @@ # GNU Coreutils / Basic Utilities alias pkill='pkill -x' -alias sudo='sudo -E' +alias sudo='sudo -E ' alias grep='grep --color' alias ls='ls --hide 'Downloads' --color=always --group-directories-first' alias mv='mv --no-clobber' @@ -18,7 +18,6 @@ alias hibernate='systemctl hibernate' # program extentions alias pacman='pacman-c' - # locations alias log='cd ~/data/logs/' @@ -32,7 +31,6 @@ alias cfg='config' alias vim='nvim' alias gd='git add . ; git diff --cached' alias gwg='xdotool getwindowgeometry "$( xdotool getactivewindow )"' -alias h='history 0' # 1-3 char alias sys='systemctl' @@ -43,10 +41,25 @@ alias l="$PAGER" # functions + +# find and edit +function fe(){ + find / -name "$1" -exec "$EDITOR" '{}' \; 2>/dev/null +} + # dictinary search -function dict(){ - curl "dict.org/d:$1" | less +function ds(){ + curl "dict://dict.org/m:$1" } + +# dictionary define +function d(){ + curl "dict://dict.org/d:$1" +} + + + +# 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 printf "$1 is up.\n" @@ -55,7 +68,9 @@ is_up(){ fi } -# for opening the note of today (through my note script in bin repo) + + +# open today's note function daily(){ time="$(date +%H%M)" # counts as the previous day until six @@ -82,13 +97,42 @@ function daily(){ note "daily/$date" } + + +# get working directory +wd() { + echo "$PWD" | sed "s/\/home\/$USER/~/g" +} + + + + +# history functions + +# history search function hs(){ if [ -n "$2"]; then - history 0 | grep "$1" | tail + fc -n -l 0 | grep "$1" | tail else - history 0 | grep "$1" | tail -n "$2" + fc -n -l 0 | grep "$1" | tail -n "$2" fi } -wd() { - echo "$PWD" | sed "s/\/home\/$USER/~/g" + +# repeat +function r(){ + if [ -z "$1" ]; then + fc -s + else + $( hs "$1" 1 ) + fi +} + +# repeat edit +function re(){ + if [ -z "$1" ]; then + fc -e "$EDITOR" + else + local index="$( fc -l 0 | grep "$1" | tail -n 1 | awk '{print $1}' )" + fc -e "$EDITOR" $index + fi }