6467e90efbb8a0064045ccd2c09f1b0513d782c3

Author
Ben Langfeld <ben@langfeld.me>
Committer
Ben Langfeld <ben@langfeld.me>
Date

Message

Add iTerm version of tab function (itab)

Diff

 1diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
 2index eb995eb2efc17cfbc8089e10a5ea810cdacdfc1c..81eed5e92af372466fc02bb682a9d5a8b26091e8 100644
 3--- a/plugins/osx/osx.plugin.zsh
 4+++ b/plugins/osx/osx.plugin.zsh
 5@@ -30,3 +30,28 @@ end do_submenu
 6 do_submenu("Terminal", "Shell", "New Tab", 1)
 7 EOF
 8 }
 9+
10+function itab() {
11+savepath
12+osascript >/dev/null <<EOF
13+on do_submenu(app_name, menu_name, menu_item)
14+    -- bring the target application to the front
15+    tell application app_name
16+      activate
17+    end tell
18+    tell application "System Events"
19+      tell process app_name
20+        tell menu bar 1
21+          tell menu bar item menu_name
22+            tell menu menu_name
23+              click menu item menu_item
24+            end tell
25+          end tell
26+        end tell
27+      end tell
28+    end tell
29+end do_submenu
30+
31+do_submenu("iTerm", "Shell", "New Tab")
32+EOF
33+}