浏览代码

Plugin : Sudo - Add support of sudoedit (#5035)

* Add sudoedit support

* change describtion of sudo plugin
naegi 8 年之前
父节点
当前提交
341e83f6f2
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      plugins/sudo/sudo.plugin.zsh

+ 7 - 1
plugins/sudo/sudo.plugin.zsh

@@ -2,7 +2,7 @@
 # Description
 # -----------
 #
-# sudo will be inserted before the command
+# sudo or sudoedit will be inserted before the command
 #
 # ------------------------------------------------------------------------------
 # Authors
@@ -16,6 +16,12 @@ sudo-command-line() {
     [[ -z $BUFFER ]] && zle up-history
     if [[ $BUFFER == sudo\ * ]]; then
         LBUFFER="${LBUFFER#sudo }"
+    elif [[ $BUFFER == $EDITOR\ * ]]; then
+        LBUFFER="${LBUFFER#$EDITOR }"
+        LBUFFER="sudoedit $LBUFFER"
+    elif [[ $BUFFER == sudoedit\ * ]]; then
+        LBUFFER="${LBUFFER#sudoedit }"
+        LBUFFER="$EDITOR $LBUFFER"
     else
         LBUFFER="sudo $LBUFFER"
     fi