Skip to content

Instantly share code, notes, and snippets.

@stekern
Created July 7, 2024 09:53
Show Gist options
  • Save stekern/5b009fdfa150be351ba27f5705680747 to your computer and use it in GitHub Desktop.
Save stekern/5b009fdfa150be351ba27f5705680747 to your computer and use it in GitHub Desktop.
no-my-zsh
# ====== Options ======
setopt NO_CASE_GLOB
setopt SHARE_HISTORY
setopt EXTENDED_HISTORY
setopt APPEND_HISTORY
setopt HIST_VERIFY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_SPACE
setopt PROMPT_SUBST
setopt AUTO_PUSHD
# ====== Shell history ======
export HISTFILE=~/.zhistory # History file
# ====== Prompt ======
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
zstyle ':vcs_info:git:*' formats ' %F{242}[%b]%f'
zstyle ':vcs_info:*' enable git
PROMPT='🐴 %B%F{%(?.blue.red)}%1~%f%b$vcs_info_msg_0_ '
# ====== Completion ======
# Colors for directories, ls, cd, etc.
zstyle ':completion:*' list-colors 'di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30' && export CLICOLOR=1
# Case-insensitive completion
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'
# Partial completion suggestions
zstyle ':completion:*' list-suffixes
zstyle ':completion:*' expand prefix suffix
# Completion menu
zstyle ':completion:*' menu select
bindkey '^[[Z' reverse-menu-complete
autoload -U select-word-style
select-word-style bash
# Support bash completions
autoload bashcompinit && bashcompinit
autoload -Uz compinit && compinit
# ====== Editing ======
bindkey -v
bindkey "^?" backward-delete-char
export EDITOR="nvim"
export KEYTIMEOUT=1
# Block cursor and line cursor for normal and insert mode, respectively
set-cursor() {
case "$KEYMAP" in
vicmd) echo -ne '\e[1 q';;
viins|main) echo -ne '\e[5 q';;
esac
zle reset-prompt
}
zle -N zle-line-init set-cursor
zle -N zle-keymap-select set-cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment