-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc-personal
138 lines (130 loc) · 3.68 KB
/
.zshrc-personal
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
131
132
133
134
135
136
137
138
#aliases
#git
alias config='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME'
alias py='python'
alias vim='nvim'
alias cat='bat'
alias cd..='cd ..'
alias cpu="ps axch -o cmd:15,%cpu --sort=-%cpu | head"
alias df='df -h'
alias q='exit'
alias grep='grep --color=auto'
alias jctl="journalctl -p 3 -xb" #get the error messages from journalctl
alias killp='killprocess'
alias kp='killprocess'
alias l='exa -lahF --color=always --icons --sort=name --group-directories-first'
alias ls='exa -lhF --color=always --icons --sort=name --group-directories-first'
alias lst='exa -lahFT --color=always --icons --sort=size --group-directories-first'
alias less='bat'
alias matrix='unimatrix -f -l ocCgGkS -s 96'
alias mem="ps axch -o cmd:15,%mem --sort=-%mem | head"
alias mirror="sudo reflector -f 10 -l 10 --number 10 --verbose --save /etc/pacman.d/mirrorlist" # update your mirrors
alias mpv='devour mpv'
alias mv='mv -i'
alias rm='rm -i'
alias update='sudo pacman -Syyu'
alias parsyu='paru -Syu --noconfirm'
alias updatefonts='sudo fc-cache -fv'
alias cleanup='sudo pacman -Rns $(pacman -Qtdq)' #Cleanup orphaned packages
alias wget="wget -c" # continue the download
alias help="bat ~/.zshrc-personal"
# compile and run cpp
function cppcompile()
{
filename=$1
re="^\#include \""
while read line
do
if [[ $line =~ $re ]]; then
temp=${line:9}
temp1=${temp#\"}
temp2=${temp1%\.*\"}
g++ -std=c++17 -c $temp2.cpp
fi
done < $filename.cpp
g++ -std=c++17 -c $filename.cpp
g++ -o $filename *.o
./$filename
rm -f *.o
}
# required functions
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*.deb) ar x $1 ;;
*.tar.xz) tar xf $1 ;;
*.tar.zst) tar xf $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
rangercd () {
tmp="$(mktemp)"
ranger --choosedir="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
cd "$dir"
fi
fi
fi
}
# Change cursor shape for different vi modes.
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
zle-line-init() {
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
echo -ne "\e[5 q"
}
zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
# ci"
autoload -U select-quoted
zle -N select-quoted
for m in visual viopp; do
for c in {a,i}{\',\",\`}; do
bindkey -M $m $c select-quoted
done
done
# ci{, ci(, di{ etc..
autoload -U select-bracketed
zle -N select-bracketed
for m in visual viopp; do
for c in {a,i}${(s..)^:-'()[]{}<>bB\'}; do
bindkey -M $m $c select-bracketed
done
done
# Use vim keys in tab complete menu:
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey '^R' history-incremental-search-backward
bindkey -v