-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.zshrc
196 lines (155 loc) · 4.78 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
# The following lines were added by compinstall
#prompt off
# cd $HOME
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle :compinstall filename '/home/shashwat/.zshrc'
autoload -Uz compinit
compinit
#autoload -Uz promptinit
#promptinit
source /usr/share/doc/pkgfile/command-not-found.zsh
ttyctl -f
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=10000
SAVEHIST=10000
# setopt autocd
unsetopt beep
bindkey -v
zstyle ':completion:*' menu select
zstyle ':completion:*' rehash true
#Additional settings
setopt completeinword
zstyle ':completion:*:killall:*' command 'ps -u $USER -o cmd'
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
# End of lines configured by zsh-newuser-install
# Adding settings from bashrc
alias bd=". bd -s"
alias vim='nvim'
#complete -cf optirun
#complete -cf primusrun
alias lammps='lmp'
alias diff='diff --color=auto'
alias grep='grep --color=auto'
alias DUNST_COMMAND_PAUSE='notify-send DUNST_COMMAND_PAUSE'
alias DUNST_COMMAND_RESUME='notify-send DUNST_COMMAND_RESUME'
export EDITOR="nvim"
export VISUAL="nvim"
export JAVA_HOME=/usr/lib/jvm/default
export CATALINA_HOME=/opt/apache-tomcat-8.5.23
export ANDROID_HOME=/home/shashwat/Android/Sdk/
export QT_QPA_PLATFORMTHEME="qt5ct"
export CHROME_EXECUTABLE=google-chrome-stable
export PATH="$PATH":"$HOME/.pub-cache/bin"
if [[ $TERM == xterm ]]; then
TERM=xterm-256color
fi
if [[ $TERM == screen ]]; then
TERM=screen-256color
fi
export GPG_TTY=$(tty)
if [[ -x "`whence -p dircolors`" ]]; then
eval `dircolors -b /home/shashwat/.dircolors`
alias ls='ls -F --color=auto'
else
alias ls='ls -F'
fi
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
DIRSTACKFILE="$HOME/.cache/zsh/dirs"
if [[ -z $TMUX ]] && [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} )
[[ -d $dirstack[1] ]] && cd $dirstack[1]
fi
chpwd() {
print -l $PWD ${(u)dirstack} >$DIRSTACKFILE
}
# Function to manually restore the last directory
restore_last_dir() {
if [[ -f $DIRSTACKFILE ]]; then
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} )
[[ -d $dirstack[1] ]] && cd $dirstack[1]
else
echo "No saved directory stack found."
fi
}
DIRSTACKSIZE=20
setopt AUTO_PUSHD PUSHD_SILENT PUSHD_TO_HOME
## Remove duplicate entries
setopt PUSHD_IGNORE_DUPS
## This reverts the +/- operators.
setopt PUSHD_MINUS
# Editor for long command
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
# Ruby
eval "$(rbenv init -)"
path+=("/home/shashwat/.gem/ruby/2.6.0/bin")
#android studio
path+=("/home/shashwat/Android/Sdk/cmdline-tools/latest/bin/")
path+=("/home/shashwat/Android/Sdk/emulator/")
path+=("/home/shashwat/Android/Sdk/platform-tools/")
export ANDROID_SDK_ROOT="/home/shashwat/Android/Sdk/"
# Lammps
path+=("/home/shashwat/Documents/CIC/electronics/GasBarrierNanofoam/lammps/lammps-7Aug19/build")
# AppImage
path+=("/home/shashwat/AppImage/")
path+=("/home/shashwat/.local/bin")
# Snaps
path+=('/var/lib/snapd/snap/bin')
# Cursor Mode
cursor_mode() {
# See https://ttssh2.osdn.jp/manual/4/en/usage/tips/vim.html for cursor shapes
cursor_block='\e[2 q'
cursor_beam='\e[6 q'
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne $cursor_block
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne $cursor_beam
fi
}
zle-line-init() {
echo -ne $cursor_beam
}
zle -N zle-keymap-select
zle -N zle-line-init
}
cursor_mode
# Vim keybinding for completion
zmodload zsh/complist
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
# Plugins
# autosuggestions
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
bindkey '^ ' autosuggest-accept
#fzf
source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh
# Temporary fix for android emulator (hopefully)
# function emulator { ( cd "$(dirname "$(whence -p emulator)")" && ./emulator "$@"; ) }
# cd "$AUTOCD"
ranger_cd() {
temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")"
ranger --choosedir="$temp_file" -- "${@:-$PWD}"
if chosen_dir="$(cat -- "$temp_file")" && [ -n "$chosen_dir" ] && [ "$chosen_dir" != "$PWD" ]; then
cd -- "$chosen_dir"
fi
rm -f -- "$temp_file"
}
alias ranger=ranger_cd
source /usr/share/nvm/init-nvm.sh
alias python3=python
eval "$(starship init zsh)"
# Load Angular CLI autocompletion.
# source <(ng completion script)
export QT_STYLE_OVERRIDE=kvantum
# cd $HOME