.zshrc (11276B)
1 # If you come from bash you might have to change your $PATH. 2 export PATH=$HOME/bin:/usr/local/bin:$PATH 3 4 # Path to your oh-my-zsh installation. 5 export ZSH="/Users/yohanesbandung/.oh-my-zsh" 6 7 # Set name of the theme to load --- if set to "random", it will 8 # load a random theme each time oh-my-zsh is loaded, in which case, 9 # to know which specific one was loaded, run: echo $RANDOM_THEME 10 # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes 11 ZSH_THEME="spaceship" 12 # ZSH_THEME="robbyrussell" 13 14 ######################################################################## 15 # START OF SPACESHIP 16 ######################################################################## 17 18 SPACESHIP_PROMPT_ORDER=( 19 battery 20 time 21 user 22 dir 23 host 24 git 25 exec_time 26 jobs 27 exit_code 28 vi_mode 29 char 30 ) 31 32 SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true 33 SPACESHIP_PROMPT_SEPARATE_LINE=false 34 SPACESHIP_BATTERY_SHOW=always 35 SPACESHIP_BATTERY_PREFIX='[' 36 SPACESHIP_BATTERY_SUFFIX=']' 37 SPACESHIP_BATTERY_THRESHOLD=100 38 # SPACESHIP_TIME_COLOR='#fcec02' 39 SPACESHIP_GIT_PREFIX='[' 40 SPACESHIP_GIT_SUFFIX=']' 41 # SPACESHIP_GIT_BRANCH_COLOR='#00a0e4' 42 SPACESHIP_GIT_BRANCH_PREFIX='•' 43 SPACESHIP_GIT_BRANCH_SUFFIX='•' 44 # SPACESHIP_GIT_STATUS_COLOR='#da2c20' 45 SPACESHIP_VI_MODE_COLOR=grey 46 SPACESHIP_GIT_STATUS_PREFIX='<' 47 SPACESHIP_GIT_STATUS_SUFFIX='>' 48 SPACESHIP_DIR_PREFIX='[' 49 SPACESHIP_DIR_SUFFIX=']' 50 SPACESHIP_CHAR_SYMBOL='λ' 51 SPACESHIP_CHAR_PREFIX=' ' 52 SPACESHIP_CHAR_SUFFIX=' ' 53 SPACESHIP_TIME_SHOW=true 54 SPACESHIP_TIME_PREFIX='[' 55 SPACESHIP_TIME_SUFFIX=']' 56 57 ######################################################################## 58 # END OF SPACESHIP 59 ######################################################################## 60 61 # Set list of themes to pick from when loading at random 62 # Setting this variable when ZSH_THEME=random will cause zsh to load 63 # a theme from this variable instead of looking in $ZSH/themes/ 64 # If set to an empty array, this variable will have no effect. 65 # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) 66 67 # Uncomment the following line to use case-sensitive completion. 68 # CASE_SENSITIVE="true" 69 70 # Uncomment the following line to use hyphen-insensitive completion. 71 # Case-sensitive completion must be off. _ and - will be interchangeable. 72 # HYPHEN_INSENSITIVE="true" 73 74 # Uncomment the following line to disable bi-weekly auto-update checks. 75 # DISABLE_AUTO_UPDATE="true" 76 77 # Uncomment the following line to automatically update without prompting. 78 # DISABLE_UPDATE_PROMPT="true" 79 80 # Uncomment the following line to change how often to auto-update (in days). 81 # export UPDATE_ZSH_DAYS=13 82 83 # Uncomment the following line if pasting URLs and other text is messed up. 84 # DISABLE_MAGIC_FUNCTIONS="true" 85 86 # Uncomment the following line to disable colors in ls. 87 # DISABLE_LS_COLORS="true" 88 89 # Uncomment the following line to disable auto-setting terminal title. 90 DISABLE_AUTO_TITLE="true" 91 92 # Uncomment the following line to enable command auto-correction. 93 # ENABLE_CORRECTION="true" 94 95 # Uncomment the following line to display red dots whilst waiting for completion. 96 # Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work) 97 # See https://github.com/ohmyzsh/ohmyzsh/issues/5765 98 # COMPLETION_WAITING_DOTS="true" 99 100 # Uncomment the following line if you want to disable marking untracked files 101 # under VCS as dirty. This makes repository status check for large repositories 102 # much, much faster. 103 # DISABLE_UNTRACKED_FILES_DIRTY="true" 104 105 # Uncomment the following line if you want to change the command execution time 106 # stamp shown in the history command output. 107 # You can set one of the optional three formats: 108 # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 109 # or set a custom format using the strftime function format specifications, 110 # see 'man strftime' for details. 111 # HIST_STAMPS="mm/dd/yyyy" 112 113 # Would you like to use another custom folder than $ZSH/custom? 114 # ZSH_CUSTOM=/path/to/new-custom-folder 115 116 # Which plugins would you like to load? 117 # Standard plugins can be found in $ZSH/plugins/ 118 # Custom plugins may be added to $ZSH_CUSTOM/plugins/ 119 # Example format: plugins=(rails git textmate ruby lighthouse) 120 # Add wisely, as too many plugins slow down shell startup. 121 plugins=(git npm yarn zsh-autosuggestions zsh-syntax-highlighting history-substring-search vi-mode) 122 123 bindkey -M viins 'jk' vi-cmd-mode 124 125 source $ZSH/oh-my-zsh.sh 126 127 # User configuration 128 129 ######################################################################## 130 # START OF BANDUNG's EXPORTS 131 ######################################################################## 132 133 export EDITOR=nvim 134 export SHELL=zsh 135 export LANG=en_US.UTF-8 136 export TERM=screen-256color 137 138 # export PATH=$HOME/bin:/usr/local/bin:$PATH 139 export PATH="/usr/local/sbin:$PATH" 140 # export PATH=$HOME/.local/bin:$PATH 141 142 export PATH=$PATH:$HOME/go/bin 143 export PATH=$PATH:$HOME/.cargo/bin 144 # export PATH=$PATH:/usr/local/bin 145 export PATH=/.config/yarn/global/node_modules/.bin:$PATH./node_modules/.bin:$HOME/.yarn/bin:$HOME 146 export PATH=/usr/local/opt/openssl/bin:$PATH 147 export PATH=$PATH:$KUMPATH/yowez-cli/bin 148 export GOPATH=$HOME/go 149 export PATH=$GOPATH/bin:$PATH 150 export PATH=$HOME/.nimble/bin:$PATH 151 export PATH="/Applications/Emacs.app/Contents/MacOS:$PATH" 152 export PATH="$HOME/.emacs.d/bin:$PATH" 153 # export INITVIM=$HOME/.config/nvim/init.vim 154 # export PATH=$HOME/bin:$PATH 155 156 # export BAT_THEME="Monokai Extended Bright" 157 # export BAT_THEME="GitHub" 158 export BAT_THEME="Coldark-Dark" 159 160 export ANDROID_HOME=${HOME}/Library/Android/sdk 161 export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home 162 export PATH=${PATH}:${ANDROID_HOME}/emulator 163 export PATH=${PATH}:${ANDROID_HOME}/tool 164 export PATH="${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools" 165 166 export SCRIPT=~/Library/Mobile\ Documents/com\~apple\~ScriptEditor2/Documents 167 168 # Add RVM to PATH for scripting. Make sure this is the last PATH variable change. 169 export PATH="$PATH:$HOME/.rvm/bin" 170 171 export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin" # Added by n-install (see http://git.io/n-install-repo). 172 173 [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh 174 175 source /Users/yohanesbandung/Library/Preferences/org.dystroy.broot/launcher/bash/br 176 177 # PLUGIN OPTIONS 178 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#A4A4A4" 179 bindkey -M viins '^F' autosuggest-accept 180 bindkey -M viins '^P' history-substring-search-up 181 bindkey -M viins '^N' history-substring-search-down 182 183 if command -v pyenv 1>/dev/null 2>&1; then 184 eval "$(pyenv init -)" 185 fi 186 187 ######################################################################## 188 # END OF BANDUNG's EXPORTS 189 ######################################################################## 190 191 ######################################################################## 192 # START OF BANDUNG's FUNCTIONS 193 ######################################################################## 194 195 # retry command after n times 196 function gagal { 197 echo $1 >&2 198 exit 1 199 } 200 function kantal { 201 local n=1 202 local max="$1"; shift 203 local delay=3 204 while true; do 205 "$@" && break || { 206 if [[ $n -lt $max ]]; then 207 ((n++)) 208 echo "Gagal nih. OTW percobaan ke $n/$max:" 209 sleep $delay; 210 else 211 gagal "Gagal muluk abis $n kali coba." 212 fi 213 } 214 done 215 } 216 217 # test 218 function test_kantal { 219 echo "your first argument $1" 220 echo "your @ argument $@" 221 echo "your 0 argument $0" 222 local first="$1"; shift 223 echo "now your first argument $1" 224 echo "now your @ argument $@" 225 } 226 227 nn () 228 { 229 # Block nesting of nnn in subshells 230 if [ -n $NNNLVL ] && [ "${NNNLVL:-0}" -ge 1 ]; then 231 echo "nnn is already running" 232 return 233 fi 234 235 # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) 236 # To cd on quit only on ^G, remove the "export" as in: 237 # NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" 238 # NOTE: NNN_TMPFILE is fixed, should not be modified 239 NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" 240 241 # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn 242 # stty start undef 243 # stty stop undef 244 # stty lwrap undef 245 # stty lnext undef 246 247 nnn -deo "$@" 248 249 if [ -f "$NNN_TMPFILE" ]; then 250 . "$NNN_TMPFILE" 251 rm -f "$NNN_TMPFILE" > /dev/null 252 fi 253 } 254 255 export NNN_USE_EDITOR=1 256 export NNN_TRASH=1 257 [ -n "$NNNLVL" ] && PS1="N$NNNLVL $PS1" 258 259 ######################################################################## 260 # END OF BANDUNG's FUNCTIONS 261 ######################################################################## 262 263 ######################################################################## 264 # START OF BANDUNG's ALIASES 265 ######################################################################## 266 267 eval "$(hub alias -s)" 268 269 # projects 270 alias kapp="cd ${KUMPATH}/app" 271 alias kweb="cd ${KUMPATH}/web" 272 alias kmag="cd ${KUMPATH}/dashboard" 273 alias uikit="cd ${KUMPATH}/js/packages/kumparan-uikit" 274 275 alias ybbond="cd ${YBPATH}/ybbond" 276 277 # settings 278 alias zshrc="nvim ~/.zshrc" 279 alias vimrc="vim ~/.vimrc" 280 alias bashpro="nvim ~/.bash_profile" 281 alias bashrc="nvim ~/.bashrc" 282 alias neorc="nvim ~/.config/nvim/init.vim" 283 284 # git 285 alias wip="git add . && git commit -m 'wip'" 286 alias rehead="git reset HEAD~" 287 alias lg="lazygit" 288 289 # misc 290 alias nexus5x="~/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_29 -netdelay none -netspeed full" 291 alias konak="kantal 10 yarn add" 292 293 alias cdb="cd .." 294 295 # better cli 296 alias ls='exa' 297 alias cat="bat" 298 alias find='fd' 299 alias du='ncdu --color dark -rr' 300 301 alias set_dark="cp ~/.tmux-dark.conf ~/.tmux.conf && cp ~/.config/kitty/kitty-dark.conf ~/.config/kitty/kitty.conf" 302 alias set_light="cp ~/.tmux-light.conf ~/.tmux.conf && cp ~/.config/kitty/kitty-light.conf ~/.config/kitty/kitty.conf" 303 304 source <(lab completion zsh) 305 306 ######################################################################## 307 # END OF BANDUNG's ALIASES 308 ######################################################################## 309 310 311 ######################################################################## 312 # START OF BANDUNG's VI MODE CURSOR 313 ######################################################################## 314 315 # vim mode config 316 # --------------- 317 318 # Remove mode switching delay. 319 KEYTIMEOUT=10 320 321 ZVM_VI_INSERT_ESCAPE_BINDKEY=jk 322 323 eval spaceship_vi_mode_enable 324 325 precmd () { 326 echo -n -e "\a" 327 } 328 329 ######################################################################## 330 # END OF BANDUNG's VI MODE CURSOR 331 ######################################################################## 332 333 alias config=$CONFTREE 334 335 # export MANPATH="/usr/local/man:$MANPATH" 336 337 # You may need to manually set your language environment 338 # export LANG=en_US.UTF-8 339 340 # Preferred editor for local and remote sessions 341 # if [[ -n $SSH_CONNECTION ]]; then 342 # export EDITOR='vim' 343 # else 344 # export EDITOR='mvim' 345 # fi 346 347 # Compilation flags 348 # export ARCHFLAGS="-arch x86_64" 349 350 # Set personal aliases, overriding those provided by oh-my-zsh libs, 351 # plugins, and themes. Aliases can be placed here, though oh-my-zsh 352 # users are encouraged to define aliases within the ZSH_CUSTOM folder. 353 # For a full list of active aliases, run `alias`. 354 # 355 # Example aliases 356 # alias zshconfig="mate ~/.zshrc" 357 # alias ohmyzsh="mate ~/.oh-my-zsh"