some binds

This commit is contained in:
2026-03-26 08:12:06 +01:00
parent 3567f83c9b
commit 4a3078edba
3 changed files with 20 additions and 3 deletions
+13 -1
View File
@@ -20,4 +20,16 @@ WORDCHARS=${WORDCHARS//\//}
# Rookie keybindings :) # Rookie keybindings :)
bindkey '^[[1;5D' backward-word # C-Left bindkey '^[[1;5D' backward-word # C-Left
bindkey '^[[1;5C' forward-word # C-Right bindkey '^[[1;5C' forward-word # C-Right
bindkey '^H' backward-kill-word # C-Backspace bindkey '^H' backward-kill-word # C-Backspace (also C-H)
bindkey '^Z' undo # C-z
# A-s to prepend sudo
uy_prepend_sudo() {
if [[ $BUFFER != sudo\ * ]]; then
BUFFER="sudo $BUFFER"
CURSOR+=5
fi
}
zle -N uy_prepend_sudo
bindkey '^[s' uy_prepend_sudo
+2 -2
View File
@@ -1,4 +1,4 @@
_oops_confirm() { uy_oops_confirm() {
if [[ ! -f "$HISTFILE" ]]; then if [[ ! -f "$HISTFILE" ]]; then
print -P "%F{red}Failed to locate history file: $HISTFILE%f" print -P "%F{red}Failed to locate history file: $HISTFILE%f"
return 1 return 1
@@ -26,4 +26,4 @@ _oops_confirm() {
fi fi
} }
alias oops=' _oops_confirm' alias oops=' uy_oops_confirm'
@@ -6,7 +6,12 @@ C b 字符后移
A f 单词前移 A f 单词前移
A b 单词后移 A b 单词后移
C w 删除前一个单词
A d 删除后一个单词
C u 从光标位置到行首删除 C u 从光标位置到行首删除
C k 从光标位置到行末删除 C k 从光标位置到行末删除
A s sudo A s sudo
A . 上一个命令的最后一个参数