Skip to content

Instantly share code, notes, and snippets.

@yuvalif
Created May 31, 2023 15:27
Show Gist options
  • Save yuvalif/446e6e428960b4d699f08ddb73710925 to your computer and use it in GitHub Desktop.
Save yuvalif/446e6e428960b4d699f08ddb73710925 to your computer and use it in GitHub Desktop.
# zshrc
# set path
export PATH=$HOME/bin:/usr/local/bin:$HOME/go/bin:$HOME/.local/bin:/app/bin/:$PATH
# golang
export GOPROXY=https://proxy.golang.org,direct
export GOBIN=$HOME/go/bin
# for other themes, see: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="simple"
# enable command auto-correction.
ENABLE_CORRECTION="true"
# faster git status
DISABLE_UNTRACKED_FILES_DIRTY="true"
# plugins
plugins=(git kubectl aws pip minikube)
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
source $ZSH/oh-my-zsh.sh
# use vim :-)
export EDITOR='vim'
# use up/down arrows for local history
up-line-or-local-history() {
zle set-local-history 1
zle up-line-or-history
zle set-local-history 0
}
zle -N up-line-or-local-history
down-line-or-local-history() {
zle set-local-history 1
zle down-line-or-history
zle set-local-history 0
}
zle -N down-line-or-local-history
bindkey '^[OA' up-line-or-local-history # Cursor up
bindkey '^[OB' down-line-or-local-history # Cursor down
# override the simple prompt with 2 variants: long and short
PROMPT1='%(!.%{$fg[red]%}.%{$fg[green]%})%1d$(git_prompt_info) ➤%{$reset_color%} '
PROMPT2='%{$fg[cyan]%}%n@%m%{$reset_color%}: %(!.%{$fg[red]%}.%{$fg[green]%})%~$(git_prompt_info) ➤%{$reset_color%} '
PROMPT=$PROMPT2
# allow toggling between prompts using Ctl-p
toggle-prompt() {
if [[ $PROMPT == $PROMPT1 ]]; then
PROMPT=$PROMPT2
else
PROMPT=$PROMPT1
fi
}
zle -N toggle-prompt
bindkey '^p' toggle-prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment