aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.config/zsh/shortcuts
blob: e8edb184f5cb9fe0b80914ade6c9701ec4ebea01 (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
#!/bin/sh

# Some aliases
alias v="nvim"
alias abook="abook -C $HOME/.config/abook/abookrc --datafile $HOME/docs/data/contacts/addressbook"
alias eslint="./node_modules/.bin/eslint"
alias ls="ls -hN --color=auto --group-directories-first"
alias tmux="tmux -f $HOME/.config/tmux/tmux.conf"
alias units="units -H ''"
alias trans="trans -v -pager='less -R'"
alias lsdp="swaymsg -pt get_outputs | less"
alias op="xdg-open"
alias drag="dragon-drag-and-drop"
corona() { curl -s https://corona-stats.online/$1 ;} # It's corona time
wintitle() { printf "\033]2;%s\a" "$1";}
sass-watch() {
  while inotifywait -q -e create -e modify sass; do 
    sassc $1 $2
  done
}
grm() { printf "git@git.yaroslavps.com:%s" "$1" }

# Generic shortcuts
alias music="ncmpcpp"
alias news="newsboat && killall -42 waybar"
alias audio="ncpamixer"
alias calc="python -q -i -c 'import math'"
alias spw="setsid $TERMINAL >/dev/null 2>&1 &"
alias testinet="ping -c2 example.com"

# rsync shortcuts
alias rs="rsync -avh"
alias rsn="rsync -avhn"
alias rsd="rsync -avh --delete"
alias rsdn="rsync -avhn --delete"

# Fuzzy finder
alias fzo='op "$(find . -type d -path "*/\.*" -prune -o -not -name ".*" -type f | fzf)"'
if [ -f /usr/share/fzf/completion.zsh ]; then
	# Arch/Artix
	. /usr/share/fzf/completion.zsh
elif [ -f /usr/share/doc/fzf/examples/completion.zsh ]; then
	# Debian
	. /usr/share/doc/fzf/examples/completion.zsh
fi
if [ -f /usr/share/fzf/key-bindings.zsh ]; then
	# Arch/Artix
	. /usr/share/fzf/key-bindings.zsh
elif [ -f /usr/share/doc/fzf/examples/key-bindings.zsh ]; then
	# Debian
	. /usr/share/doc/fzf/examples/key-bindings.zsh
fi
bindkey -r '^T'
bindkey -r '\ec'
bindkey '^F' fzf-file-widget
bindkey '^A' fzf-cd-widget

# Function for changing working dir after exiting lf
lfcd () {
    tmp="$(mktemp)"
    lf -last-dir-path="$tmp" "$@"
    if [ -f "$tmp" ]; then
        dir="$(cat "$tmp")"
        rm -f "$tmp"
        if [ -d "$dir" ]; then
            if [ "$dir" != "$(pwd)" ]; then
                cd "$dir"
            fi
        fi
    fi
}

# Some keybindings
bindkey -s '^o' 'lfcd\n'
bindkey -s '^t' 'spw\n'

# Mounting drive shortcuts
alias mnt="udisksctl mount -b"
alias umnt="udisksctl unmount -b"
alias dlock="udisksctl lock -b"
alias dulock="udisksctl unlock -b"
# Work network drive
alias mntdss="sudo mount -t cifs -o \
	uid=yaroslav,gid=yaroslav //10.0.4.140/dss /mnt/dss"
alias umntdss="sudo umount /mnt/dss"

# Internet
alias yt="youtube-dl --add-metadata -ic" # Download video link
alias yta="youtube-dl --add-metadata -xic" # Download only audio
alias YT="youtube-viewer"
alias starwars="telnet towel.blinkenlights.nl"

# git
gitcc () {
	git clone "$(wl-paste --no-newline)"
}

# Audio and Music
alias mute="lmc mute"
alias vu="lmc up"
alias vd="lmc down"
alias play="mpc toggle"
alias next="mpc next"
alias prev="mpc prev"
alias pause="mpc pause"
alias beg="mpc seek 0%"
alias lilbak="mpc seek -10"
alias lilfor="mpc seek +10"
alias bigbak="mpc seek -120"
alias bigfor="mpc seek +120"