Skip to content
Snippets Groups Projects
Commit 87d94023 authored by Jorge Bucaran's avatar Jorge Bucaran
Browse files

Merge pull request #368 from bobthecow/fix-tab-plugin

Two fixes for tab plugin
parents dcb43ef0 edeecff2
Branches
No related merge requests found
...@@ -7,17 +7,24 @@ ...@@ -7,17 +7,24 @@
# tab [PATH] Open PATH in a new tab # tab [PATH] Open PATH in a new tab
# tab [CMD] Open a new tab and execute CMD # tab [CMD] Open a new tab and execute CMD
# tab [PATH] [CMD] ... You can prolly guess # 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' function tab -d 'Open the current directory (or any other directory) in a new tab'
set -l cmd '' set -l cmd ''
set -l cdto $PWD set -l cdto $PWD
if test (count $argv) -gt 0 -a -d $argv[1] if test (count $argv) -gt 0
pushd . >/dev/null if test -d $argv[1]
cd $argv[1] pushd . >/dev/null
set cdto $PWD cd $argv[1]
set -e argv[1] set cdto $PWD
popd >/dev/null set -e argv[1]
popd >/dev/null
end
end end
if test (count $argv) -gt 0 if test (count $argv) -gt 0
...@@ -27,10 +34,14 @@ function tab -d 'Open the current directory (or any other directory) in a new ta ...@@ -27,10 +34,14 @@ function tab -d 'Open the current directory (or any other directory) in a new ta
switch $TERM_PROGRAM switch $TERM_PROGRAM
case 'iTerm.app' 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 " osascript 2>/dev/null -e "
tell application \"iTerm\" tell application \"iTerm\"
tell current terminal tell current terminal
launch session \"Default Session\" launch session \"$profile\"
tell the last session tell the last session
write text \"cd \\\"$cdto\\\"$cmd\" write text \"cd \\\"$cdto\\\"$cmd\"
end tell end tell
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment