summaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2022-10-05 22:00:32 -0500
committerzachir <zachir@librem.one>2022-10-05 22:00:32 -0500
commitf39d735e2ba625a31a7dbf6fb8bdd62501379ad1 (patch)
treed17c96714c930e0b8bc75616cc9c81b961ed5aa0 /sh
Initial Commit
Diffstat (limited to 'sh')
-rw-r--r--sh/aliases70
-rw-r--r--sh/functions130
2 files changed, 200 insertions, 0 deletions
diff --git a/sh/aliases b/sh/aliases
new file mode 100644
index 0000000..0aa9869
--- /dev/null
+++ b/sh/aliases
@@ -0,0 +1,70 @@
+#!/bin/sh
+## CD Ups
+alias ..='cd ..'
+alias ...='cd ../..'
+alias ....='cd ../../..'
+alias .....='cd ../../../..'
+alias ......='cd ../../../../..'
+alias .......='cd ../../../../../..'
+alias ........='cd ../../../../../../..'
+
+COLOR_FLAGS_GNU="--color='auto' --group-directories-first"
+
+. $HOME/.config/sh/weather
+
+## Base Utils
+case `uname -s` in
+ "OpenBSD")
+ alias ls="ls -h"
+ ;;
+ "Linux")
+ alias ls="ls -h $COLOR_FLAGS_GNU"
+ ;;
+esac
+alias ll='ls -l'
+alias la='ls -A'
+alias lla='ls -lA'
+alias md='mkdir -p'
+alias ch='cd $HOME'
+alias du='du -sxhc'
+
+#alias nvim='vim'
+alias nv='nvim'
+alias v='nvim'
+alias lf='lfrun'
+
+## Change utils
+alias rm='rm -i'
+alias cp='cp -i'
+
+## git stuff
+alias gs='git status'
+alias commit='git commit -S -m'
+alias ga='git add -A'
+alias gd='git diff'
+
+## Single Chars
+alias r='cd ~ && clear && exec $SHELL'
+case "$(echo $0 | xargs basename)" in
+ "zsh") alias e='. $ZDOTDIR/.zshrc' ;;
+ "ksh"|"oksh") alias e='. ~/.config/kshrc' ;;
+esac
+alias q='exit'
+alias c='clear'
+alias m='make'
+
+## Programming
+# Rust
+alias crr='cargo run --release'
+alias cbr='cargo build --release'
+
+## Arch Linux aliases --sudoloop
+#alias yu='yay -Syu --noconfirm'
+
+## OpenBSD
+alias pq='pkg_info -Q'
+alias pu='doas pkg_add -u'
+alias pa='doas pkg_add'
+
+## Runit
+#alias ursm='env SVDIR="$HOME/.local/sv/" rsm'
diff --git a/sh/functions b/sh/functions
new file mode 100644
index 0000000..69b26c3
--- /dev/null
+++ b/sh/functions
@@ -0,0 +1,130 @@
+#!/bin/sh
+catclip () {
+ cat $@ | xclip -selection clipboard
+}
+
+catpass () {
+ PASSWD=$(cat ~/pass.txt); echo "$PASSWD\n$PASSWD" | pass insert "$1"; unset PASSWD
+}
+
+mpt () {
+ for i in $@; do
+ echo "" > $i
+ done
+}
+
+mkcd () {
+ mkdir $@ && cd $1
+}
+
+ntharg () {
+ shift $1
+ printf '%s\n' "$1"
+}
+
+mvcd () {
+ mv $@ && cd `ntharg $# "$@"`
+}
+
+scd () {
+ if [ "$1" = "" ]; then
+ cd $HOME
+ else
+ case "$1" in
+ "-l") echo "
+aw - ~/.config/awesome
+al - ~/.config/alacritty
+b - ~/.local/bin
+c - ~/.config
+db - ~/.local/src/dwmblocks
+dc - ~/Documents
+do - ~/Downloads
+dw - ~/.local/src/dwm
+e - ~/Desktop
+E - /etc
+f - ~/.var/app
+h - ~/.config/herbstluftwm
+lb - ~/.local/bin
+lc - ~/Games/cache
+lf - ~/.config/lf
+ls - ~/.local/share
+nv - ~/.config/nvim
+ns - ~/.natvst
+p - ~/Pictures
+qc - ~/.config/qutebrowser
+qp - ~/.local/share/qutebrowser-profiles
+qt - ~/.config/qtile
+re - ~/.local/src
+ri - ~/.config/river
+rs - /etc/runit/sv
+sc - ~/.local/bin/scripts
+sh - ~/.config/sh
+sl - ~/.local/src/slock
+ss - /etc/s6/sv
+st - ~/.local/src/st
+sx - ~/.config/sxhkd
+Va - /var
+v3 - ~/.vst3
+va - ~/.var
+vs - ~/.vst
+vv - ~/.local/volsv
+wa - ~/.local/src/wallpapers
+wd - ~/.local/share/wineprefixes/default
+wh - ~/.local/share/wineprefixes/[CURRENT]
+wr - ~/.local/share/wineprefixes
+ww - ~/.local/share/wineprefixes/work
+x - ~/.config/X11
+yb - ~/.cache/yay
+yc - ~/.config/yay
+zs - ~/.config/zsh
+zx - ~/Documents/zachir.xyz
+";;
+ "aw") cd $XDG_CONFIG_HOME/awesome/ ;;
+ "al") cd $XDG_CONFIG_HOME/alacritty/ ;;
+ "b") cd "$HOME"/.local/bin/ ;;
+ "c") cd $XDG_CONFIG_HOME/ ;;
+ "dc") cd $HOME/Documents/ ;;
+ "do") cd $HOME/Downloads/ ;;
+ "dw") cd $HOME/.local/src/dwm/ ;;
+ "db") cd $HOME/.local/src/dwmbar/ ;;
+ "e") cd $HOME/Desktop ;;
+ "E") cd /etc ;;
+ "f") cd $HOME/.var/app ;;
+ "h") cd "$XDG_CONFIG_HOME"/herbstluftwm ;;
+ "lb") cd $HOME/.local/bin ;;
+ "lc") cd $HOME/Games/cache ;;
+ "ls") cd $XDG_DATA_HOME ;;
+ "lf") cd $XDG_CONFIG_HOME/lf ;;
+ "nv") cd $XDG_CONFIG_HOME/nvim ;;
+ "ns") cd $HOME/.natvst ;;
+ "p") cd $HOME/Pictures ;;
+ "qc") cd $XDG_CONFIG_HOME/qutebrowser/ ;;
+ "qp") cd $XDG_DATA_HOME/qutebrowser-profiles/ ;;
+ "qt") cd $XDG_CONFIG_HOME/qtile/ ;;
+ "re") cd $HOME/.local/src/ ;;
+ "ri") cd $XDG_CONFIG_HOME/river ;;
+ "rs") cd /etc/runit/sv ;;
+ "sc") cd $HOME/.local/bin/scripts/ ;;
+ "sh") cd $XDG_CONFIG_HOME/sh/ ;;
+ "sl") cd $HOME/.local/src/slock/ ;;
+ "ss") cd /etc/s6/sv ;;
+ "st") cd $HOME/.local/src/st/ ;;
+ "sx") cd $XDG_CONFIG_HOME/sxhkd/ ;;
+ "v3") cd $HOME/.vst3 ;;
+ "vi") cd $HOME/Videos ;;
+ "vs") cd $HOME/.vst/ ;;
+ "vv") cd $HOME/.local/volsv/ ;;
+ "wa") cd $HOME/.local/src/wallpapers ;;
+ "wd") cd $WINEROOT/default ;;
+ "wh") cd $WINEPREFIX ;;
+ "wr") cd $WINEROOT ;;
+ "ww") cd $WINEROOT/work ;;
+ "x") cd $XDG_CONFIG_HOME/X11 ;;
+ "yb") cd $XDG_CACHE_HOME/yay ;;
+ "yc") cd $XDG_CONFIG_HOME/yay ;;
+ "zs") cd $ZDOTDIR/ ;;
+ "zx") cd $HOME/Documents/zachir.xyz/ ;;
+ *) echo "\"$1\" is not a known location" ;;
+ esac
+ fi
+}