diff --git a/config/shell/.config/zsh/conf.d/01-options.zsh b/config/shell/.config/zsh/conf.d/01-options.zsh index d1dea92..55da32a 100644 --- a/config/shell/.config/zsh/conf.d/01-options.zsh +++ b/config/shell/.config/zsh/conf.d/01-options.zsh @@ -20,4 +20,16 @@ WORDCHARS=${WORDCHARS//\//} # Rookie keybindings :) bindkey '^[[1;5D' backward-word # C-Left 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 diff --git a/config/shell/.config/zsh/conf.d/10-oops.zsh b/config/shell/.config/zsh/conf.d/10-oops.zsh index aec3a21..6999bd0 100644 --- a/config/shell/.config/zsh/conf.d/10-oops.zsh +++ b/config/shell/.config/zsh/conf.d/10-oops.zsh @@ -1,4 +1,4 @@ -_oops_confirm() { +uy_oops_confirm() { if [[ ! -f "$HISTFILE" ]]; then print -P "%F{red}Failed to locate history file: $HISTFILE%f" return 1 @@ -26,4 +26,4 @@ _oops_confirm() { fi } -alias oops=' _oops_confirm' +alias oops=' uy_oops_confirm' diff --git a/memo/fish-keybindings.txt b/memo/shell-keybindings.txt similarity index 68% rename from memo/fish-keybindings.txt rename to memo/shell-keybindings.txt index 1fe733e..8e8132b 100644 --- a/memo/fish-keybindings.txt +++ b/memo/shell-keybindings.txt @@ -6,7 +6,12 @@ C b 字符后移 A f 单词前移 A b 单词后移 +C w 删除前一个单词 +A d 删除后一个单词 + C u 从光标位置到行首删除 C k 从光标位置到行末删除 A s sudo + +A . 上一个命令的最后一个参数