summaryrefslogtreecommitdiff
path: root/public/zsh/.zshrc
diff options
context:
space:
mode:
Diffstat (limited to 'public/zsh/.zshrc')
-rw-r--r--public/zsh/.zshrc137
1 files changed, 137 insertions, 0 deletions
diff --git a/public/zsh/.zshrc b/public/zsh/.zshrc
new file mode 100644
index 0000000..2d023b4
--- /dev/null
+++ b/public/zsh/.zshrc
@@ -0,0 +1,137 @@
+# ft=shell
+#zmodload zsh/zprof
+
+source $HOMEBREW_PREFIX/share/antigen/antigen.zsh
+antigen init $HOME/.antigenrc
+
+autoload -U compinit promptinit
+compinit
+
+if [ "$(uname -s)" = "Linux" ] && [ -f "/etc/gentoo-release" ]; then
+ # Gentoo specific auto-completion
+ promptinit; prompt gentoo
+fi
+
+HISTFILE="${HOME}/.zsh_history"
+HISTSIZE=1000
+SAVEHIST=1000
+setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
+setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
+setopt SHARE_HISTORY # Share history between all sessions.
+setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
+setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
+setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
+setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
+setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
+setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
+setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
+setopt HIST_VERIFY # Don't execute immediately upon history expansion.
+
+CASE_SENSITIVE="true"
+
+DISABLE_UPDATE_PROMPT="true"
+export UPDATE_ZSH_DAYS=7
+
+# Uncomment the following line if pasting URLs and other text is messed up.
+# DISABLE_MAGIC_FUNCTIONS="true"
+
+# Uncomment the following line to disable colors in ls.
+# DISABLE_LS_COLORS="true"
+
+# Uncomment the following line to disable auto-setting terminal title.
+# DISABLE_AUTO_TITLE="true"
+
+# Uncomment the following line to enable command auto-correction.
+ENABLE_CORRECTION="true"
+
+# Uncomment the following line to display red dots whilst waiting for completion.
+COMPLETION_WAITING_DOTS="true"
+
+# Uncomment the following line if you want to disable marking untracked files
+# under VCS as dirty. This makes repository status check for large repositories
+# much, much faster.
+# DISABLE_UNTRACKED_FILES_DIRTY="true"
+plugins=(git fzf zsh-autosuggestions zsh-kubectl-prompt vi-mode)
+
+# neovim
+export EDITOR="nvim"
+
+# kube prompt
+zstyle ':zsh-kubectl-prompt:' namespace true # show namespace
+function kube_prompt_info() {
+ if ! [[ "$ZSH_KUBECTL_PROMPT" == *"current-context is not set"* ]]; then
+ # remove all the aws junk
+ cluster_ns=$(echo ${ZSH_KUBECTL_PROMPT} | sed 's/^arn.*:cluster\///')
+ echo -n "%{$fg[cyan]%}(⎈ ${cluster_ns})%{$reset_color%}"
+ fi
+}
+KUBE_RPROMPT="\$(kube_prompt_info)"
+
+# aws prompt
+function aws_prompt_info() {
+ if ! [ -z "$AWS_PROFILE" ]; then
+ echo -n "%{$fg[yellow]%}(☁️ ${AWS_PROFILE})%{$reset_color%}"
+ fi
+}
+AWS_RPROMPT="\$(aws_prompt_info)"
+
+# vi mode
+# only if not in vim
+if ! [ -n "$VIMRUNTIME" ]; then
+ bindkey -v
+ VI_MODE_SET_CURSOR=true
+ VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true
+ VI_MODE_RPROMPT="\$(vi_mode_prompt_info)"
+ # map jk to escape
+ bindkey jk vi-cmd-mode
+ MODE_INDICATOR="%F{red}(V)%f"
+else
+ VI_MODE_RPROMPT=""
+fi
+
+# Set RPROMPT with my plugins and stuff
+RPROMPT="${AWS_RPROMPT}${KUBE_RPROMPT}${VI_MODE_RPROMPT}"
+
+# User configuration
+ZSH_AUTOSUGGEST_USE_ASYNC=true
+
+ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=8"
+
+# Disable bracketed-paste-magic among other things
+# https://github.com/ohmyzsh/ohmyzsh/issues/5569
+DISABLE_MAGIC_FUNCTIONS=true
+
+# FZF
+source "${HOMEBREW_PREFIX}/opt/fzf/shell/completion.zsh"
+source "${HOMEBREW_PREFIX}/opt/fzf/shell/key-bindings.zsh"
+export FZF_TMUX_OPTS='-d 40%'
+bindkey "ç" fzf-cd-widget
+
+
+# gcloud completion
+if [ -f "${HOMEBREW_PREFIX}/share/google-cloud-sdk/path.zsh.inc" ]; then
+ source "${HOMEBREW_PREFIX}/share/google-cloud-sdk/path.zsh.inc"
+fi
+if [ -f "${HOMEBREW_PREFIX}/share/google-cloud-sdk/completion.zsh.inc" ]; then
+ source "${HOMEBREW_PREFIX}/share/google-cloud-sdk/completion.zsh.inc"
+fi
+
+# Hack to prevent tmux starting on some terminal emulators
+# NO_TMUX is a hash of value=variable pairs, when the variable matches the value,
+# tmux will not be started.
+#typeset -A NO_TMUX
+#NO_TMUX[JetBrains-JediTerm]="TERMINAL_EMULATOR" # Intellij
+#NO_TMUX[com.apple.Terminal]="__CFBundleIdentifier"
+#NO_TMUX[screen]="TERM"
+
+#TMUX_DEFAULT_SESSION=main
+#RUN_TMUX=true
+#for k v in ${(@kv)NO_TMUX}; do
+ #if [ "${(P)v}" = "${k}" ]; then
+ #RUN_TMUX=false
+ #fi
+#done
+
+#if [ "$RUN_TMUX" = true ]; then
+ #[ -z "$TMUX" ] && tmux new-session -As ${TMUX_DEFAULT_SESSION}
+#fi