0ebe35968cee69431790c78d427813d073db71c1

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

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

Add iTerm2 v3 support

Diff

 1diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
 2index a1516dcce88c74e912c22d3ef266e5260336f975..c92b6556daa4f7b539dcf294fd5d9446992a7bde 100644
 3--- a/plugins/osx/osx.plugin.zsh
 4+++ b/plugins/osx/osx.plugin.zsh
 5@@ -46,6 +46,16 @@ EOF
 6       end tell
 7 EOF
 8 
 9+  elif [[ "$the_app" == 'iTerm2' ]]; then
10+      osascript <<EOF
11+        tell application "iTerm"
12+          tell current window
13+            create tab with default profile
14+            tell current session to write text "${command}"
15+          end tell
16+        end tell
17+EOF
18+
19   else
20     echo "tab: unsupported terminal app: $the_app"
21     false
22@@ -73,6 +83,19 @@ function vsplit_tab() {
23       end tell
24 EOF
25 
26+  elif [[ "$the_app" == 'iTerm2' ]]; then
27+      osascript <<EOF
28+        tell application "iTerm"
29+          tell current session of first window
30+            set newSession to (split vertically with same profile)
31+            tell newSession
32+              write text "${command}"
33+              select
34+            end tell
35+          end tell
36+        end tell
37+EOF
38+
39   else
40     echo "$0: unsupported terminal app: $the_app" >&2
41     false
42@@ -100,6 +123,19 @@ function split_tab() {
43       end tell
44 EOF
45 
46+  elif [[ "$the_app" == 'iTerm2' ]]; then
47+      osascript <<EOF
48+        tell application "iTerm"
49+          tell current session of first window
50+            set newSession to (split horizontally with same profile)
51+            tell newSession
52+              write text "${command}"
53+              select
54+            end tell
55+          end tell
56+        end tell
57+EOF
58+
59   else
60     echo "$0: unsupported terminal app: $the_app" >&2
61     false