From 858a4a31a251d0eab21dffb96776aca007dafb07 Mon Sep 17 00:00:00 2001 From: Chloe Kudryavtsev Date: Fri, 14 Feb 2020 19:11:04 -0500 Subject: Squashed 'dot_local/share/toasty/' content from commit aee4da7 git-subtree-dir: dot_local/share/toasty git-subtree-split: aee4da752bdb07b0524bb8803ead46d4093fa57f --- plugins/sudo | 25 +++++++++++++++++++++++++ plugins/xterm-title | 10 ++++++++++ 2 files changed, 35 insertions(+) create mode 100644 plugins/sudo create mode 100644 plugins/xterm-title (limited to 'plugins') diff --git a/plugins/sudo b/plugins/sudo new file mode 100644 index 0000000..0ba8bed --- /dev/null +++ b/plugins/sudo @@ -0,0 +1,25 @@ +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# sudo will be inserted before the command +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Dongweiming +# +# ------------------------------------------------------------------------------ + +sudo-command-line() { + [[ -z $BUFFER ]] && zle up-history + if [[ $BUFFER == sudo\ * ]]; then + LBUFFER="${LBUFFER#sudo }" + else + LBUFFER="sudo $LBUFFER" + fi +} +zle -N sudo-command-line +# Defined shortcut keys: [Esc] [Esc] +bindkey "\e\e" sudo-command-line diff --git a/plugins/xterm-title b/plugins/xterm-title new file mode 100644 index 0000000..a57ea03 --- /dev/null +++ b/plugins/xterm-title @@ -0,0 +1,10 @@ +function xterm-title { + print -Pn '\e]0;%n@%m $(history $HISTCMD | cut -b8-)\a' +} + +autoload -Uz add-zsh-hook +add-zsh-hook precmd xterm-title +add-zsh-hook preexec xterm-title +add-zsh-hook chpwd xterm-title + +# vim: ft=zsh -- cgit v1.2.3