commit a8a3506397c71d3faed8df397a80b9eb253444a7
parent 26cb31309dc6cca003e048aeb6c27b128a088d6e
Author: jacob@thinkpad <jacobouno@protonmail.com>
Date: Fri, 3 Jul 2020 18:14:45 -0700
Remove some mpc and cargo/rust aliases
Diffstat:
| M | aliases/.aliases | | | 124 | ++++++++++++++++++++++++------------------------------------------------------- |
1 file changed, 38 insertions(+), 86 deletions(-)
diff --git a/aliases/.aliases b/aliases/.aliases
@@ -1,45 +1,28 @@
# vim: filetype=sh
-# Jacob Edwards
-# created: 2020.02.10
-# shell aliases and functions, specificaly for archlinux and OpenBSD
-
-
-#---------#
-# aliases #
-#---------#
+# Jacob Edwards, created: 2020/02/10
+# shell functions for unix systems
if [ -f "$HOME/.aliases-private" ]; then
. "$HOME/.aliases-private"
fi
-if [ $(uname) = "OpenBSD" ]; then
+if [ `uname` = "OpenBSD" ]; then
alias xenodm="doas xenodm"
alias pkg_add="doas /usr/sbin/pkg_add -xV"
alias pa="pkg_add"
alias pi="pkg_info"
alias pq="pi -Q"
alias pd="doas pkg_delete "
- loop() {
- iterations=$1
- shift
- for i in $(jot $iterations); do $@; done
- }
-elif [ $(uname) = "Linux" ]; then
+elif [ `uname` = "Linux" ]; then
alias pacman="pa"
alias pa="pacman -S"
alias pq="pacman -Ss"
alias pi="pacman -Si"
alias pd="pacman -Rs"
alias sys="systemctl"
- alias suspend="sys suspend"
- loop() {
- iterations=$1
- shift
- for i in $(seq $iterations); do $@; done
- }
fi
-# modify
+# add arguments/change name
alias doas="doas -- "
alias man="man "
alias nvim="nvim -p"
@@ -48,12 +31,10 @@ alias grep="egrep"
alias meta="exiftool"
alias mpv="mpv --no-input-default-bindings"
alias pkill="pkill -x"
-alias sshport="grep -Ei '^port' /etc/ssh/sshd_config || echo 'port 22'"
-alias now="date +%Y%m%d-%H%M%S"
-alias lsrpa="rpa -ni0 | cut -d':' -f1"
alias col="column -ts"
+alias now="date +%Y%m%d-%H%M%S"
-# shorten
+# change name
alias za="zathura"
alias muf="mupdf"
alias f="nvim"
@@ -61,6 +42,8 @@ alias l="$PAGER"
alias dbf="locate"
alias g="grep"
alias ic="ifconfig"
+alias python="python3"
+alias py="python"
# git
alias gd="git diff"
@@ -71,8 +54,18 @@ alias gp="git pull"
alias gl="git log"
alias gdc="gd --cached"
+# webq (searx parsing script)
+wq() { webq $@ | column -ts\~ ;}
+wQ() { webq "`eval echo $@`" | column -ts\~ ;}
+webfilter() { grep -Eiv "(instagram|twitter|youtube|google|top [0-9]+|can'?t live with|you won'?t believe|of [0-9]+|of all time)" ;}
+
+# cargo/rust
+alias rs="cargo"
+alias rsdoc="rs doc"
+alias rss="rs search"
+alias rsfmt="rustfmt"
+
# mpc
-# basic
alias m="mpc"
alias mc="m current"
alias ma="m a"
@@ -81,13 +74,11 @@ alias mP="m pause"
alias mf="m next"
alias mF="m prev"
alias ms="m seek"
-# other/query
alias mu="m update --wait"
-alias mshuf="m shuffle"
-alias mlist="m playlist"
-alias mlists="m lsplaylist"
+alias mS="m shuffle"
+alias ml="m playlist"
+alias mL="m lsplaylist"
alias mq="m search any"
-alias mqa="m searchadd any"
# get configuration from mpd.conf (oneline options only)
mconf() { grep $1 $XDG_CONFIG_HOME/mpd/mpd.conf | sed -E 's/.*"(.*)\"/\1/g' ;}
@@ -100,45 +91,18 @@ mcd() { cd "$(eval echo `mconf music_directory`)" ;}
# replace playlist with current
mrepl() {
- if [ $# -ne 1 ]; then
- echo "usage, $0 [playlist]"
- else
- dir="$(eval echo $(mconf playlist_directory))"
- mv -v $dir/$1.m3u $dir/.$1.m3u
- mpc save $1
- fi
+ dir="$(eval echo $(mconf playlist_directory))"
+ mv -v $dir/$1.m3u $dir/.$1.m3u && mpc save $1
}
-# cargo/rust
-alias rs="cargo"
-# NOTE: Even though it's just a space, It enables tab completion.
-alias rsrun="rs run"
-alias rsbuild="rs build"
-alias rscheck="rs check"
-alias rsnew="rs new"
-alias rsclean="rs clean"
-alias rss="cargo search"
-alias rsfmt="rustfmt"
-
-# webq (searx parsing script)
-wq() { webq $@ | column -ts\~ ;}
-wQ() { webq "`eval echo $@`" | column -ts\~ ;}
-webfilter() { grep -Eiv "(instagram|twitter|youtube|google|top [0-9]+|can'?t live with|you won'?t believe|of [0-9]+|of all time)" ;}
-
-#-----------#
-# functions #
-#-----------#
-
-mked() {
- mkdir -p $(dirname $1)
- $EDITOR $1
+# make directories leading up to filename then edit that
+mkf() {
+ mkdir -p `dirname $1`
+ f $1
}
-# get working directory
-wd() {
- local home="$(printf $HOME | sed -E 's/\//\\\//g')"
- pwd | sed "s/$home/~/g"
-}
+# get working directory HOME with shorthand
+wd() { pwd | sed "s|$HOME|~|g" ;}
# open note for today
daily() {
@@ -148,32 +112,20 @@ daily() {
else
date="$(date +%Y/%m/%d)"
fi
-
time=$(date "+%R")
if [ ! -e "$NOTES/daily/$date" ]; then
echo "$date\n\n$time" >> "$NOTES/daily/$date"
else
echo "\n\n$time" >> "$NOTES/daily/$date"
fi
-
- mked "$NOTES/daily/$date"
+ mkf "$NOTES/daily/$date"
}
-wm_name() {
- id="$(xprop -root | grep '_NET_ACTIVE_WINDOW' -m1 | awk -F '# ' '{print $2}')"
- xprop -id "$id" | grep 'WM_CLASS' -m1 | cut -d '"' -f 2
-}
+# search all history for `regex`
+hs() { fc -nl 0 | egrep "$1" ;}
-wm_class() {
- id="$(xprop -root | grep '_NET_ACTIVE_WINDOW' -m1 | awk -F '# ' '{print $2}')"
- xprop -id "$id" | grep 'WM_CLASS' -m1 | cut -d '"' -f 4
-}
+# list podcast names
+lsrpa() { rpa -ni0 | cut -d':' -f1 ;}
-# search all history for `regex`
-hs() {
- if [ -n "$2"]; then
- fc -n -l 0 | grep "$1" | tail -n 20
- else
- fc -n -l 0 | grep "$1" | tail -n "$2"
- fi
-}
+# unset proxy env variables
+nproxy() { unset ALL_PROXY; unset HTTP_PROXY ;}