diff options
author | Giel van Schijndel <giel.van.schijndel@sioux.eu> | 2014-09-15 15:36:34 +0200 |
---|---|---|
committer | Giel van Schijndel <giel.van.schijndel@sioux.eu> | 2014-09-15 15:36:34 +0200 |
commit | 1e7c6743a7b221cb2069a84c70890014597672d8 (patch) | |
tree | 2e1cddb83ae7c0168007e82922ae199b01150c19 /plugins/sudo/sudo.plugin.zsh | |
parent | 96e4e5dd032d2df75f87d5b3e5594d527c655b16 (diff) | |
download | zsh-1e7c6743a7b221cb2069a84c70890014597672d8.tar.gz zsh-1e7c6743a7b221cb2069a84c70890014597672d8.tar.bz2 zsh-1e7c6743a7b221cb2069a84c70890014597672d8.zip |
sudo: maintain cursor position
I.e. when prefixing the current command-line with 'sudo ' maintain the
current cursor position instead of jumping to the end of the line.
Diffstat (limited to 'plugins/sudo/sudo.plugin.zsh')
-rw-r--r-- | plugins/sudo/sudo.plugin.zsh | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/plugins/sudo/sudo.plugin.zsh b/plugins/sudo/sudo.plugin.zsh index d12e06853..e3ba39918 100644 --- a/plugins/sudo/sudo.plugin.zsh +++ b/plugins/sudo/sudo.plugin.zsh @@ -13,9 +13,8 @@ # ------------------------------------------------------------------------------ sudo-command-line() { -[[ -z $BUFFER ]] && zle up-history -[[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER" -zle end-of-line + [[ -z $BUFFER ]] && zle up-history + [[ $BUFFER != sudo\ * ]] && LBUFFER="sudo $LBUFFER" } zle -N sudo-command-line # Defined shortcut keys: [Esc] [Esc] |