summaryrefslogtreecommitdiff
path: root/sh/functions
blob: 6ed5792aad01535ea6acef89be7713f55bab5094 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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 -p $@ && 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
}