Skip to content

Instantly share code, notes, and snippets.

@alazycoder101
Created November 26, 2024 23:35
Show Gist options
  • Save alazycoder101/c8f42dd044142303b270eaaae79317ee to your computer and use it in GitHub Desktop.
Save alazycoder101/c8f42dd044142303b270eaaae79317ee to your computer and use it in GitHub Desktop.
# Enable Vi mode
bindkey -v
# Reduce key timeout to make mode switching faster
export KEYTIMEOUT=1
#bindkey -M viins '^R' history-incremental-search-backward
#bindkey -M vicmd '^R' history-incremental-search-backward
# Change cursor shape based on mode
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
# History set up
# Maximum number of history entries
HISTSIZE=10000
SAVEHIST=10000
# History file location
HISTFILE=~/.zsh_history
# Ignore duplicates
setopt HIST_IGNORE_DUPS
# Ignore commands that start with a space
setopt HIST_IGNORE_SPACE
# Remove older duplicate entries from the history
setopt HIST_IGNORE_ALL_DUPS
# Save history entries immediately
setopt INC_APPEND_HISTORY
# Shared history across terminal sessions
setopt SHARE_HISTORY
export HISTORY_IGNORE="(ls|pwd|cd|exit|clear)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment