Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
45c23d04
Commit
45c23d04
authored
May 31, 2015
by
Justin Hileman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[split] Move tab plugin to oh-my-fish/plugin-tab
https://github.com/oh-my-fish/plugin-tab
parent
11e980d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
67 deletions
+0
-67
plugins/tab/tab.fish
plugins/tab/tab.fish
+0
-67
No files found.
plugins/tab/tab.fish
deleted
100644 → 0
View file @
11e980d3
# Open new iTerm and Terminal tabs from the command line
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Usage:
# tab Opens the current directory in a new tab
# 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 ''
set -l cdto $PWD
if test (count $argv) -gt 0
if test -d $argv[1]
pushd . >/dev/null
cd $argv[1]
set cdto $PWD
set -e argv[1]
popd >/dev/null
end
end
if test (count $argv) -gt 0
set cmd "; $argv"
end
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 \"$profile\"
tell the last session
write text \"cd \\\"$cdto\\\"$cmd\"
end tell
end tell
end tell
"
case 'Apple_Terminal'
osascript 2>/dev/null -e "
tell application \"Terminal\"
activate
tell application \"System Events\" to keystroke \"t\" using command down
repeat while contents of selected tab of window 1 starts with linefeed
delay 0.01
end repeat
do script \"cd \\\"$cdto\\\"$cmd\" in window 1
end tell
"
case '*'
echo "Unknown terminal: $TERM_PROGRAM" >&2
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment