From a4f4e93a683633dc362531fde65b31cf9a07c1fe Mon Sep 17 00:00:00 2001 From: hl Date: Tue, 19 Nov 2024 16:03:05 +0800 Subject: [PATCH] update --- .zshrc | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/.zshrc b/.zshrc index 50e777f..e94db0f 100644 --- a/.zshrc +++ b/.zshrc @@ -1,4 +1,4 @@ -# Lines configured by zsh-newuser-install +unsetopt beep HISTFILE=~/.zsh_history SAVEHIST=500000 HISTSIZE=$SAVEHIST+100000 @@ -10,23 +10,33 @@ setopt HIST_IGNORE_ALL_DUPS setopt HIST_IGNORE_SPACE zshaddhistory() { whence ${${(z)1}[1]} >| /dev/null || return 1 } -unsetopt beep # To test keys: # cat > /dev/null # sed -n l # List all commands: # zle -al -bindkey -e #emacs -bindkey "^[[3~" delete-char #Delete +_vi-kill-word(){ + zle select-a-word + if ((REGION_ACTIVE)); then + zle kill-region + fi +} +zle -N _vi-kill-word +bindkey -e #emacs style keybinding bindkey "^[[H" beginning-of-line #Home bindkey "^[[F" end-of-line #End bindkey "^[[5~" history-search-backward #PgUp bindkey "^[[6~" history-search-forward #PgDn -bindkey "^[[1;5C" vi-forward-word #C-right -bindkey "^[[1;5D" vi-backward-word #C-left -bindkey "^H" vi-backward-kill-word #C-Backspace -bindkey "^[[3;5~" delete-word #C-Delete -# End of lines configured by zsh-newuser-install +bindkey "^Z" undo #C-z +bindkey "^[[3~" delete-char #Delete +bindkey "^[[1;3D" vi-backward-word #A-left +bindkey "^[[1;3C" vi-forward-word #A-right +bindkey '^[^?' vi-backward-kill-word #A-Backspace +bindkey "^[[3;3~" _vi-kill-word #A-Delete +bindkey "^[[1;5D" backward-word #C-left +bindkey "^[[1;5C" forward-word #C-right +bindkey "^H" backward-kill-word #C-Backspace +bindkey "^[[3;5~" kill-word #C-Delete source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh