chezmoi/dot_config/oh-my-zsh/custom/09_settings.zsh
2022-06-23 22:10:10 +02:00

106 lines
3.3 KiB
Bash

# OPTIONS
setopt autocd # Allow changing directories without `cd`
setopt append_history # Dont overwrite history
setopt auto_list
setopt auto_menu
setopt auto_pushd
setopt extended_history # Also record time and duration of commands.
setopt hist_expire_dups_first # Clear duplicates when trimming internal hist.
setopt hist_find_no_dups # Dont display duplicates during searches.
setopt hist_ignore_dups # Ignore consecutive duplicates.
setopt hist_ignore_all_dups # Remember only one unique copy of the command.
setopt hist_reduce_blanks # Remove superfluous blanks.
setopt hist_save_no_dups # Omit older commands in favor of newer ones.
setopt hist_ignore_space # Ignore commands that start with space.
#setopt hist_ignore_all_dups
#setopt hist_ignore_dups
#setopt hist_reduce_blanks
#setopt hist_save_no_dups
#setopt ignore_eof
setopt inc_append_history
setopt interactive_comments
setopt no_beep
setopt no_hist_beep
setopt no_list_beep
setopt magic_equal_subst
setopt notify
setopt print_eight_bit
setopt print_exit_value
setopt prompt_subst
setopt pushd_ignore_dups
#setopt rm_star_wait
setopt share_history # Share history between multiple shells
setopt transient_rprompt
# Watching other users
#WATCHFMT="%n %a %l from %m at %t."
watch=(notme) # Report login/logout events for everybody except ourself.
LOGCHECK=60 # Time (seconds) between checks for login/logout activity.
REPORTTIME=5 # Display usage statistics for commands running > 5 sec.
# Key timeout and character sequences
KEYTIMEOUT=1
WORDCHARS='*?_-[]~=./&;!#$%^(){}<>'
zshaddhistory() { whence ${${(z)1}[1]} >| /dev/null || return 1 }
# BINDINGS
# -v enables vim bindings
bindkey -v
bindkey -v '^?' backward-delete-char
bindkey '^[[Z' reverse-menu-complete
# Common CTRL bindings.
bindkey "^a" beginning-of-line
bindkey "^e" end-of-line
bindkey "^f" forward-word
bindkey "^b" backward-word
bindkey "^k" kill-line
bindkey "^d" delete-char
bindkey "^y" accept-and-hold
bindkey "^w" backward-kill-word
bindkey "^u" backward-kill-line
bindkey "^R" history-incremental-pattern-search-backward
bindkey "^F" history-incremental-pattern-search-forward
# Do not require a space when attempting to tab-complete.
bindkey "^i" expand-or-complete-prefix
# Fixes for alt-backspace and arrows keys
bindkey '^[^?' backward-kill-word
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
#bindkey "^[[C" forward-word
#bindkey "^[[D" backward-word
## Emulate tcsh's backward-delete-word
#tcsh-backward-kill-word () {
# local WORDCHARS="${WORDCHARS:s#/#}"
# zle backward-kill-word
#}
#zle -N tcsh-backward-kill-word
# https://github.com/sickill/dotfiles/blob/master/.zsh.d/key-bindings.zsh
tcsh-backward-word () {
local WORDCHARS="${WORDCHARS:s#./#}"
zle emacs-backward-word
}
zle -N tcsh-backward-word
bindkey '\e[1;3D' tcsh-backward-word
bindkey '\e^[[D' tcsh-backward-word # tmux
tcsh-forward-word () {
local WORDCHARS="${WORDCHARS:s#./#}"
zle emacs-forward-word
}
zle -N tcsh-forward-word
bindkey '\e[1;3C' tcsh-forward-word
bindkey '\e^[[C' tcsh-backward-word # tmux
tcsh-backward-delete-word () {
local WORDCHARS="${WORDCHARS:s#./#}"
zle backward-delete-word
}
zle -N tcsh-backward-delete-word
bindkey "^[^?" tcsh-backward-delete-word # urxvt