浏览代码

Merge pull request #4907 from johankj/feature/osx-iterm2

Add iTerm2 v3 support
Marc Cornellà 8 年之前
父节点
当前提交
0ebe35968c
共有 1 个文件被更改,包括 36 次插入0 次删除
  1. 36 0
      plugins/osx/osx.plugin.zsh

+ 36 - 0
plugins/osx/osx.plugin.zsh

@@ -46,6 +46,16 @@ EOF
       end tell
 EOF
 
+  elif [[ "$the_app" == 'iTerm2' ]]; then
+      osascript <<EOF
+        tell application "iTerm"
+          tell current window
+            create tab with default profile
+            tell current session to write text "${command}"
+          end tell
+        end tell
+EOF
+
   else
     echo "tab: unsupported terminal app: $the_app"
     false
@@ -73,6 +83,19 @@ function vsplit_tab() {
       end tell
 EOF
 
+  elif [[ "$the_app" == 'iTerm2' ]]; then
+      osascript <<EOF
+        tell application "iTerm"
+          tell current session of first window
+            set newSession to (split vertically with same profile)
+            tell newSession
+              write text "${command}"
+              select
+            end tell
+          end tell
+        end tell
+EOF
+
   else
     echo "$0: unsupported terminal app: $the_app" >&2
     false
@@ -100,6 +123,19 @@ function split_tab() {
       end tell
 EOF
 
+  elif [[ "$the_app" == 'iTerm2' ]]; then
+      osascript <<EOF
+        tell application "iTerm"
+          tell current session of first window
+            set newSession to (split horizontally with same profile)
+            tell newSession
+              write text "${command}"
+              select
+            end tell
+          end tell
+        end tell
+EOF
+
   else
     echo "$0: unsupported terminal app: $the_app" >&2
     false