commit a200b32d409fc5a782120f86b3ba31d65414d7b8
parent 80020968ae1484a93c0ea710c6060a77beee62aa
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Mon, 14 Sep 2020 21:02:23 -0700
Filter and refine
remove unused functions.
improve comments.
simplify and optomize functions.
Diffstat:
1 file changed, 11 insertions(+), 47 deletions(-)
diff --git a/aliases/.config/aliases b/aliases/.config/aliases
@@ -4,18 +4,14 @@ if [ -f "$XDG_CONFIG_HOME/aliases.private" ]; then
. "$XDG_CONFIG_HOME/aliases.private"
fi
-# random:
+# add flags, change name, etc:
alias pkill="pkill -x"
-alias col="column -t"
alias la="ls -A"
alias cmd="command"
alias mupdf="mupdf -I"
-alias wq="webq"
alias doas="doas -- "
alias man="man "
alias vim="vim -p"
-alias rns="R --no-save"
-alias htfmt="html2text -nobs"
alias startx="startx -- -retard"
alias getpass="command gp"
@@ -32,7 +28,7 @@ alias x="startx"
alias grab="xclip -selection clipboard"
alias push="grab -out"
-# package management:
+# package management (openbsd):
alias pkg_add="pkg_add -xV"
alias pa="doas pkg_add"
alias pu="doas pkg_add -u"
@@ -88,68 +84,36 @@ mps() {
# search all history for `regex`
hs() { fc -nl 0 | egrep "$1" ;}
-# unset proxy env variables
+# unset proxy variables
np() { unset ALL_PROXY; unset HTTP_PROXY ;}
-# search sxhkd keybinds
-lk() { egrep "${@-.}" -iC3 $XDG_CONFIG_HOME/sxhkd/sxhkdrc ;}
+# sort human readable du output by size
+dush() { du -sh $@ | sort -h ;}
-# pipe du into sort -h
-dus() { du -sh $@ | sort -h ;}
-
-# redo last command (I frequently type k+enter before escape in vi mode)
+# redo last command when typing out of order
k() { fc -s ;}
-# make directories leading up to filename then edit that
-ff() {
- mkdir -p `dirname $1`
- f $1
-}
-
# reinitialize shell
self() { exec $0 ;}
-# get nth line from stdout
-nth() { head -n ${1:?"nth: no index"} | tail -1 ;}
-
wQ() { webq "$*" ;}
unalias r
r() { fc -s "$*" ;}
-# f executable
+# edit executable in PATH
fe() { f `which $@` ;}
-# feed wrapper to work in the FEED_DIR directory and default to all files.
-fed() {
- if [ $# -gt 0 ]; then
- local cmd="$1"; shift
- if [ "$cmd" = "-n" ]; then
- cmd="$cmd $1"
- shift
- fi
- fi
- (cd $FEED_DIR && feed $cmd ${@:-`ls -1`})
-}
-
-# display rss feed item counts.
-fedc() {
- wc -l $FEED_DIR/* | awk -F"[ /]+" '$NF != "total" { printf "%s\t%d\n", $NF, $2 }'
-}
-
-# select feed from dmenu displaying in browser.
-fedm() {
- local select=`fed -l | column -ts' ' | dmenu -a -i | awk '{ print $2, $1 }'`
- [ -z "$select" ] && return 1;
- fed -n $select | $BROWSER -
-}
+# use feed within FEED_DIR.
+fed() { (builtin cd $FEED_DIR && feed $@) ;}
# record directories visited.
cd() { builtin cd $@ && echo $PWD >> $PWDLOG ;}
# filter chdir history keeping original line numbers.
cds() {
- nl -s" " ${PWDLOG} | grep -v " ${HOME}$" | sed "s! ${HOME}! ~!" | uniq -f1
+ awk -vhome="^$HOME" '$0 != last && $0 != ENVIRON["HOME"] {last=$0; \
+ sub(home, "~", $0); printf "%d\t%s\n", FNR, $0 }' $PWDLOG
}
# redo specified chdir.