From edeecff2df74d85f3acb3d1835e0f74b5e99d056 Mon Sep 17 00:00:00 2001 From: Justin Hileman <justin@justinhileman.info> Date: Mon, 9 Feb 2015 11:53:45 -0800 Subject: [PATCH] Allow overriding default iTerm session profile. iTerm2 nightly has an improved scripting bridge that exposes sessions, but until that ships, we'll have to use a hardcoded default and let users override. --- plugins/tab/tab.fish | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/tab/tab.fish b/plugins/tab/tab.fish index fa6248a..1e44a02 100644 --- a/plugins/tab/tab.fish +++ b/plugins/tab/tab.fish @@ -7,6 +7,11 @@ # tab [PATH] Open PATH in a new tab # tab [CMD] Open a new tab and execute CMD # tab [PATH] [CMD] ... You can prolly guess +# +# If you use iTerm and your default session profile isn't "Default Session", +# override it in your config.fish +# +# set -g tab_iterm_profile "MyProfile" function tab -d 'Open the current directory (or any other directory) in a new tab' set -l cmd '' @@ -29,10 +34,14 @@ function tab -d 'Open the current directory (or any other directory) in a new ta switch $TERM_PROGRAM case 'iTerm.app' + set -l profile 'Default Session' + if set -q tab_iterm_profile + set profile $tab_iterm_profile + end osascript 2>/dev/null -e " tell application \"iTerm\" tell current terminal - launch session \"Default Session\" + launch session \"$profile\" tell the last session write text \"cd \\\"$cdto\\\"$cmd\" end tell -- GitLab