Skip to content

Instantly share code, notes, and snippets.

@beleidy
Last active March 16, 2020 16:41
Show Gist options
  • Save beleidy/69afa4f72de3c63e24c2608aad36e48f to your computer and use it in GitHub Desktop.
Save beleidy/69afa4f72de3c63e24c2608aad36e48f to your computer and use it in GitHub Desktop.
Setting up zsh with Powerlevel9k and zsh-autosuggestions (some settings copied from oh-my-zsh files)
## Keybindings section
bindkey -e
bindkey '^[[7~' beginning-of-line # Home key
bindkey '^[[H' beginning-of-line # Home key
if [[ "${terminfo[khome]}" != "" ]]; then
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
fi
bindkey '^[[8~' end-of-line # End key
bindkey '^[[F' end-of-line # End key
if [[ "${terminfo[kend]}" != "" ]]; then
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
fi
bindkey '^[[2~' overwrite-mode # Insert key
bindkey '^[[3~' delete-char # Delete key
bindkey '^[[C' forward-char # Right key
bindkey '^[[D' backward-char # Left key
bindkey '^[[5~' history-beginning-search-backward # Page up key
bindkey '^[[6~' history-beginning-search-forward # Page down key
# Navigate words with ctrl+arrow keys
bindkey '^[Oc' forward-word #
bindkey '^[Od' backward-word #
bindkey '^[[1;5D' backward-word #
bindkey '^[[1;5C' forward-word #
bindkey '^H' backward-kill-word # delete previous word with ctrl+backspace
bindkey '^[[Z' undo # Shift+tab undo last action
# Init completions
autoload -U compinit
compinit -d
# If you come from bash you might have to change your $PATH.
export PATH=/usr/local/bin:$PATH
# Powerlevel theme settings
POWERLEVEL9K_MODE='nerdfont-complete'
POWERLEVEL9K_ALWAYS_SHOW_USER=true
POWERLEVEL9K_COMMAND_EXECUTION_THRESHOLD=1
POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=2
POWERLEVEL9K_STATUS_CROSS=false
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context os_icon ssh root_indicator dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time)
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_beginning"
POWERLEVEL9K_SHOW_CHANGESET=true
POWERLEVEL9K_CHANGESET_HASH_LENGTH=6
# Source the Powerlevel theme
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
# ZSH auto-suggestion
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
# ZSH history settings (taken from Oh-My-Zsh)
source /usr/share/zsh/plugins/history/history.zsh
# ZSH syntax highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# npm permissions fix -- change global installation directory
export PATH=~/npm-global/bin:$PATH
# Uncomment lines as needed
# Source the Helm autocompletion script
# source <(helm completion zsh)
# NVM
# export NVM_DIR=~/.nvm
# nvm_init() {
# source /usr/share/nvm/init-nvm.sh
# }
# Pipenv
# export PYENV_ROOT="$HOME/.pyenv"
# export PIPENV_PYTHON="$PYENV_ROOT/shims/python"
# export PIPENV_VENV_IN_PROJECT=1
# Pyenv
# export PATH="$PYENV_ROOT/bin:$PATH"
# if command -v pyenv 1>/dev/null 2>&1; then
# eval "$(pyenv init -)"
# fi
# Go
# export GOPATH="$HOME/go"
# export GOBIN="$GOPATH/bin"
# export PATH=$GOBIN:$PATH
# Cargo -- for RUST
# export PATH="$HOME/.cargo/bin:$PATH"
# kubectl
# export KUBECONFIG=$HOME/.kube/config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment