76 lines
2.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#setopt correct # auto correct mistakes
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst # enable filename expansion for arguments of the form anything=expression
setopt nonomatch # hide error message if there is no match for the pattern
setopt notify # report the status of background jobs immediately
setopt numericglobsort # sort filenames numerically when it makes sense
setopt promptsubst # enable command substitution in prompt
setopt histignorespace # Don't save commands that start with space
WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word
# hide EOL sign ('%')
PROMPT_EOL_MARK=""
# configure key keybindings
# Activate vim mode.
bindkey -v
# Change cursor shape for different vi modes.
zle-keymap-select() {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[2 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
# Use beam shape cursor on startup.
echo -ne '\e[5 q'
_fix_cursor() {
echo -ne '\e[5 q'
}
precmd_functions+=(_fix_cursor)
# Set cursor style (DECSCUSR), VT520.
# 0 -> blinking block.
# 1 -> blinking block (default).
# 2 -> steady block.
# 3 -> blinking underline.
# 4 -> steady underline.
# 5 -> blinking bar, xterm.
# 6 -> steady bar, xterm.
bindkey -M viins 'jf' vi-cmd-mode
bindkey ' ' magic-space # do history expansion on space
bindkey '^[[3;5~' kill-word # ctrl + Supr
bindkey '^[[3~' delete-char # delete
bindkey '^[[5~' beginning-of-buffer-or-history # page up
bindkey '^[[6~' end-of-buffer-or-history # page down
bindkey '^[[H' beginning-of-line # home
bindkey '^[[F' end-of-line # end
bindkey '^[[Z' undo # shift + tab undo last action
bindkey '^K' up-line-or-history
bindkey '^J' down-line-or-history
bindkey '^U' kill-whole-line
bindkey -M vicmd '^U' kill-whole-line
bindkey -M viins '^U' kill-whole-line
bindkey -M viins '\e.' insert-last-word
bindkey -M vicmd '^K' up-line-or-history
bindkey -M vicmd '^J' down-line-or-history