d100354d0d2a8e62c735dcc6db92fb1f0b9edb0c
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Merge pull request #778 from rschmukler/plugin-osx
Added vsplit_tab and split_tab for iTerm.
Diff
1diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
2index 682bb2667bc2cec79c6edd5870d4d42c871844f2..f278d4f8d2107a682f0ca3da92812f8a99f2ceaf 100644
3--- a/plugins/osx/osx.plugin.zsh
4+++ b/plugins/osx/osx.plugin.zsh
5@@ -2,10 +2,9 @@
6 # FILE: osx.plugin.zsh
7 # DESCRIPTION: oh-my-zsh plugin file.
8 # AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
9-# VERSION: 1.0.1
10+# VERSION: 1.1.0
11 # ------------------------------------------------------------------------------
12
13-
14 function tab() {
15 local command="cd \\\"$PWD\\\""
16 (( $# > 0 )) && command="${command}; $*"
17@@ -35,9 +34,67 @@ EOF
18 launch session "Default Session"
19 set current_session to current session
20 tell current_session
21- write text "${command}"
22+ write text "${command}; clear;"
23+ end tell
24+ end tell
25+ end tell
26+EOF
27+ }
28+}
29+
30+function vsplit_tab() {
31+ local command="cd \\\"$PWD\\\""
32+ (( $# > 0 )) && command="${command}; $*"
33+
34+ the_app=$(
35+ osascript 2>/dev/null <<EOF
36+ tell application "System Events"
37+ name of first item of (every process whose frontmost is true)
38+ end tell
39+EOF
40+ )
41+
42+ [[ "$the_app" == 'iTerm' ]] && {
43+ osascript 2>/dev/null <<EOF
44+ tell application "iTerm" to activate
45+
46+ tell application "System Events"
47+ tell process "iTerm"
48+ tell menu item "Split Vertically With Current Profile" of menu "Shell" of menu bar item "Shell" of menu bar 1
49+ click
50+ end tell
51+ end tell
52+ keystroke "${command}; clear;"
53+ keystroke return
54+ end tell
55+EOF
56+ }
57+}
58+
59+function split_tab() {
60+ local command="cd \\\"$PWD\\\""
61+ (( $# > 0 )) && command="${command}; $*"
62+
63+ the_app=$(
64+ osascript 2>/dev/null <<EOF
65+ tell application "System Events"
66+ name of first item of (every process whose frontmost is true)
67+ end tell
68+EOF
69+ )
70+
71+ [[ "$the_app" == 'iTerm' ]] && {
72+ osascript 2>/dev/null <<EOF
73+ tell application "iTerm" to activate
74+
75+ tell application "System Events"
76+ tell process "iTerm"
77+ tell menu item "Split Horizontally With Current Profile" of menu "Shell" of menu bar item "Shell" of menu bar 1
78+ click
79 end tell
80 end tell
81+ keystroke "${command}; clear;"
82+ keystroke return
83 end tell
84 EOF
85 }