-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
executable file
·289 lines (229 loc) · 6.92 KB
/
.zshrc
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors # Load colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
setopt autocd # Automatically cd into typed directory.
stty stop undef # Disable ctrl-s to freeze terminal.
setopt interactive_comments
# History in cache directory:
HISTSIZE=10000000
SAVEHIST=10000000
HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history"
# Load aliases and shortcuts if existent.
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files.
# vi mode
bindkey -v
export KEYTIMEOUT=1
# 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 -v '^?' backward-delete-char
# Change cursor shape for different vi modes.
function zle-keymap-select ()
{
case $KEYMAP in
vicmd) echo -ne '\e[1 q';; # block
viins|main) echo -ne '\e[5 q';; # beam
esac
}
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.
# Use lf to switch directories and bind it to ctrl-o
lfcd ()
{
tmp="$(mktemp -uq)"
trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM PWR EXIT' HUP INT QUIT TERM PWR EXIT
lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
fi
}
bindkey -s '^o' '^ulfcd\n'
bindkey -s '^a' '^ubc -lq\n'
bindkey -s '^f' '^ucd "$(dirname "$(fzf)")"\n'
bindkey '^[[P' delete-char
# Edit line in vim with ctrl-e:
autoload edit-command-line; zle -N edit-command-line
bindkey '^e' edit-command-line
bindkey -M vicmd '^[[P' vi-delete-char
bindkey -M vicmd '^e' edit-command-line
bindkey -M visual '^[[P' vi-delete
# Load syntax highlighting; should be last.
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null
# List all files in long format
alias ll='ls -alh'
# List all files, including hidden files, in long format
alias la='ls -la'
# Clear the screen
alias cls='clear'
# Alias for grep with color
alias grep='grep --color=auto'
# windows back compat
# Clear the terminal screen
alias cls='clear'
# Display the IP configuration
alias ipconfig='ip a'
# Ping with a default of 4 attempts (similar to the default behavior in Windows)
alias ping='ping -c 4'
# Display disk usage in a human-readable format
alias diskusage='df -h'
# Show free memory
alias mem='free -h'
# List open network ports
alias netstat='ss -tulwn'
# Copy, move, and remove operations, prefixed with 'win' to avoid naming conflicts
alias copy='cp'
alias move='mv'
alias del='rm -rf'
alias ren='mv'
alias ogvim="/usr/bin/vim"
alias ognano="/usr/bin/nano"
alias vim="nvim"
function headll
{
ll | head
}
function tailll
{
ll | tail
}
alias headll=headll
alias tailll=tailll
clip()
{
if [ -f "$1" ]; then
cat "$1" | xclip -selection clipboard
echo "Contents of $1 copied to clipboard."
else
echo "File not found: $1"
fi
}
export EDITOR=nvim
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
alias cdhtml='cd /var/www/html'
alias cdmnt='cd /mnt/'
alias cdetc='cd /etc/'
alias cdvar='cd /var/'
alias cdusr='cd /usr/'
alias cdhome='cd /home/'
alias cdroot='cd /root/'
alias cddev='cd /dev/'
alias cdbin='cd /bin/'
alias cdboot='cd /boot/'
alias cdlib='cd /lib/'
gacp()
{
git add -A
echo "Enter commit message: "
read commitMessage
git commit -m "$commitMessage"
git push
}
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
xset r rate 300 50
# Zsh History Configuration
setopt APPEND_HISTORY
setopt SHARE_HISTORY
HISTSIZE=10000
SAVEHIST=20000
HISTFILE=~/.zsh_history
alias olddatagrip='/opt/DataGrip-2020.2.3/bin/datagrip.sh'
alias nano="vim"
alias logout='pkill -KILL -u $USER'
alias teams="flatpak run com.github.IsmaelMartinez.teams_for_linux"
alias outlook="flatpak run io.github.mahmoudbahaa.outlook_for_linux"
alias atom="flatpak run io.atom.Atom"
export PATH=$PATH:~/gpt4all/bin
# Alias for Teams for Linux
alias teams="flatpak run com.github.IsmaelMartinez.teams_for_linux"
# Alias for Visual Studio Code
alias code="flatpak run com.visualstudio.code"
# Alias for Atom Editor
alias atom="flatpak run io.atom.Atom"
# Alias for Outlook for Linux
alias outlook="flatpak run io.github.mahmoudbahaa.outlook_for_linux"
# Alias for Eclipse Java IDE
alias eclipse="flatpak run org.eclipse.Java"
alias datagrip='/snap/bin/datagrip'
mkassets()
{
mkdir -p assets/css assets/js assets/api assets/images
touch assets/css/index.css
touch assets/js/index.js
touch assets/api/index.php
echo "Directory structure and files created successfully in $(pwd)"
}
e()
{
# open the current directory in the default file manager
}
alias notepad="leafpad"
alias mistral-commit="$HOME/dotfiles/mistral-commit.sh"
alias l="clear"
lll()
{
clear
print -P "$PS1 ll"
sleep 0.1
ls -alh
}
lfcd()
{
tmp="$(mktemp)"
(lf -last-dir-path="$tmp" "$@")
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
[ -d "$dir" ] && cd "$dir"
fi
}
e()
{
# Open the current directory in the default file explorer.
if command -v nemo &>/dev/null; then
nemo .
elif command -v nautilus &>/dev/null; then
nautilus .
elif command -v dolphin &>/dev/null; then
dolphin .
elif command -v thunar &>/dev/null; then
thunar .
elif command -v pcmanfm &>/dev/null; then
pcmanfm .
elif command -v ranger &>/dev/null; then
ranger .
elif command -v vifm &>/dev/null; then
vifm .
elif command -v caja &>/dev/null; then
caja .
elif command -v krusader &>/dev/null; then
krusader .
elif command -v konqueror &>/dev/null; then
konqueror .
else
echo "No supported file explorer found."
fi
}
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"