afterdesign / termx Goto Github PK
View Code? Open in Web Editor NEWMacTerminal is a SublimeText plugin. It opens new Terminal tab (on current or new window if necessary). It's working with Terminal and iTerm.
MacTerminal is a SublimeText plugin. It opens new Terminal tab (on current or new window if necessary). It's working with Terminal and iTerm.
Instead of manually set mode in settings, maybe we can do this?
First of all, thanks for building this plugin. It's cool. I was wondering if there is way to set the default terminal path as the root of the project instead of the current file folder?
Hi,
is there any way to launch iTerm 2 rather than the native Terminal app? It would be perfect!
Hi!
I'm getting an error when trying to open the terminal using ctrl+cmd+t 👍
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 418, in run_
return self.run(edit)
File "/Users/Peter/Library/Application Support/Sublime Text 3/Packages/MacTerminal/open_mac_terminal.py", line 55, in run
subprocess.Popen(command)#pylint: disable-msg=E1101
File "X/subprocess.py", line 818, in __init__
File "X/subprocess.py", line 1416, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: 'osascript'
Hi,
First of all, thanks for MacTerminal.
I can't seem to get it to work with iterm2 beta. I get the following error (both in file and project mode):
'---MacTerminal DEBUG START---'
{'cmd': '/usr/bin/osascript /Users/M/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm-nightly.js /Users/M/Documents/code/stockio/.meteor',
'directory_mode': 'file',
'ext_language': 'js',
'paths': ['/Users/M/Documents/code/stockio/.meteor'],
'process_err': b'/Users/M/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm-nightly.js:0:1: script error: A \xe2\x80\x9c/\xe2\x80\x9d can\xe2\x80\x99t go here. (-2740)\n',
'process_out': b''}
'---MacTerminal DEBUG END---'
reloading Packages/User/MacTerminal.sublime-settings
'---MacTerminal DEBUG START---'
{'cmd': '/usr/bin/osascript /Users/M/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm-nightly.js /Users/M/Documents/code/stockio',
'directory_mode': 'project',
'ext_language': 'js',
'paths': ['/Users/M/Documents/code/stockio'],
'process_err': b'/Users/M/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm-nightly.js:0:1: script error: A \xe2\x80\x9c/\xe2\x80\x9d can\xe2\x80\x99t go here. (-2740)\n',
'process_out': b''}
'---MacTerminal DEBUG END---'
My settings file is
{
"terminal": "iterm-nightly",
"directory_mode" : "project",
"debug": true
}
Thanks for your help!
So what's the best way to install this package?
Hi, thanks for the revamp - this hasn't worked for me for ages...
Now it works in Terminal.app, but not iTerm2 (preferred):
'---termX DEBUG START---'
{'paths': ['/projecct/templates/my_template']}
'---termX DEBUG END---'
'---termX DEBUG START---'
{'cmd': '/usr/bin/osascript /Users/username/Library/Application Support/Sublime Text 3/Packages/termX/termx_iterm.js /projecct/templates/my_template',
'ext_language': 'js',
'paths': ['/projecct/templates/my_template'],
'process_err': b'/Users/username/Library/Application Support/Sublime Text 3/Packages/termX/termx_iterm.js:235:263: execution error: Error on line 13: Error: Parameter is missing. (-1701)\n',
'process_out': b''}
'---termX DEBUG END---'
FYI, in Terminal, it opens a new window, then a new tab with the desired target... not sure if that's the intended behaviour.
Thanks for your efforts - let me know if I can supply more info / help test, etc!
Dear MacTerminal Author: I received the following message when I tried to use MacTerminal. As per the instructions in the message I am creating an issue.
This may be a bug, please create issue on github
['osascript', u'/Users/tnoe/Library/Application Support/Sublime Text 2/Packages/MacTerminal/macterminal_terminal.scpt']
Mac OS X 10.6.8 (10K549)
Model Name: Mac Pro
Model Identifier: MacPro1,1
Processor Name: Dual-Core Intel Xeon
Processor Speed: 2.66 GHz
Kind regards, Tom
MacTerminal doesn't open the project directory the file is in but the packages directory instead.
Lines 75 and 77 of open_mac_terminal.py have old style print statements, which cause the plugin not to load on ST3.
Since upgrading to ST3, it keeps opening iTerm2 in my home folder. I have uninstalled / installed the package without luck. I have read all posts here and nothing seems to work. Your help would be appreciated as it worked like a charm before upgrading to ST3.
Hi! tx for macterm.. love it daily!
This has worked for me until recently:
I expect:
What happens now:
please check the screencast: https://memelab.wistia.com/medias/ol1xd1x7wg#media
User settings:
{
"terminal" : "iterm",
"directory_mode" : "project",
"debug": true
}
I've got debug switched on:
---MacTerminal DEBUG START---
{'cmd': '/usr/bin/osascript/Users/timosborn/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm.js/Users/timosborn/Documents/Clients/Common-Code/Meerqat/Source/meteor/client/views/_styleguide',
'directory_mode': 'project',
'err': b'',
'out': b'\n',
'terminal_name': 'iterm'}
---MacTerminal DEBUG END---
If Iterm 2 is already started, then it can correctly initiate a new tab. However, if it's not, then it can not start Iterm 2. The same issue does not occur to the default terminal shipped with Mac. Here is the error message from the debug mode.
---MacTerminal DEBUG START---
{'cmd': u'/usr/bin/osascript/Users/zhangxiaowei/Library/Application Support/Sublime Text 2/Packages/MacTerminal/macterminal_iterm.scpt/Users/zhangxiaowei/Library/Application Support/Sublime Text 2/Packages/User',
'default_path': None,
'err': '/Users/zhangxiaowei/Library/Application Support/Sublime Text 2/Packages/MacTerminal/macterminal_iterm.scpt:243:251: script error: Expected class name but found identifier. (-2741)\n',
'out': '',
'terminal_name': u'iterm'}
---MacTerminal DEBUG END---
I have tried using both "terminal" and "iterm" and terminal works as expected but when I choose iterm (my primary terminal app) it opens a new tab but dumps me to the user's home directory. I do not have any configuration set other than the "terminal" setting.
I noticed my $PS1 prompt was misrendered within termX.
Here is how it looks in iterm2:
But within termX, it looks like this:
But it doesn't seem limited to how to how it looks. If I try to copy the string with pbcopy<<<$PS1
, I also get two different outputs.
iterm2:
�(B�[m�[7m🌮 SeñorCooley🌯 �(B�[m \w �[7m $?�(B�[m\n\$
termX:
�[0;10m�[7müåÆ Se√±orCooleyüåØ �[0;10mÓÇ∞ \w �[7mÓÇ∞ $?�[0;10mÓÇ∞\n\$
The readme keybinding section says the command is "command": "open_terminal"
, however the command is actually "command": "open_termx_terminal"
.
When I add "keys": ["super+t"] shortcut #MacTerminal opens two tabs. And if you press & hold it’ll open more than two. The default Super+Ctrl+T shortcut now acts in the same manner. Restarting ST after adding the shortcut didn't help.
'---MacTerminal DEBUG START---'
{'cmd': '/usr/bin/osascript /Users/guanxinxian/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm.js /Users/guanxinxian/Work/pro',
'directory_mode': 'file',
'ext_language': 'js',
'paths': ['/Users/guanxinxian/Work/pro'],
'process_err': b'/Users/guanxinxian/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm.js:418:495: execution error: Error on line 23: Error: \xe4\xbf\xa1\xe6\x81\xaf\xe6\x97\xa0\xe6\xb3\x95\xe8\xaf\x86\xe5\x88\xab\xe3\x80\x82 (-1708)\n',
'process_out': b''}
'---MacTerminal DEBUG END---'
Traceback (most recent call last):
File "./sublime_plugin.py", line 362, in run_
File "./open_mac_terminal.py", line 55, in run
TypeError: object of type 'NoneType' has no len()
Traceback (most recent call last):
File "./sublime_plugin.py", line 362, in run_
File "./open_mac_terminal.py", line 55, in run
TypeError: object of type 'NoneType' has no len()
no command for selector: noop:
I have these settings
{
"terminal" : "iterm",
"debug": true
}
Hi there,
Great package by the way!
Just one little suggestion, the git repo url in your readme is not the same as the actual repo url.
All the best,
John Paul
When I change the terminal to "iterm", it is not changing the directory to the where the file resides. It is at /Users/name/.
However it is working fine with "terminal".
I have sublime text 2 running on macbook. I appreciate any help.
Hello I just installed your plugin and in console I got:
reloading plugin MacTerminal.open_mac_terminal
found 7 files for base name Default.sublime-keymap
found 6 files for base name Main.sublime-menu
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 549, in run_
return self.run(edit)
File "open_mac_terminal in /Users/bartas/Library/Application Support/Sublime Text 3/Installed Packages/MacTerminal.sublime-package", line 55, in run
TypeError: object of type 'NoneType' has no len()
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 549, in run_
return self.run(edit)
File "open_mac_terminal in /Users/bartas/Library/Application Support/Sublime Text 3/Installed Packages/MacTerminal.sublime-package", line 55, in run
TypeError: object of type 'NoneType' has no len()
In Mountain Lion, the Applescript scripts didn't work for me. I played around with the terminal app and was able to get it to work with the attached script. I don't know if this is the best solution, but it's one that worked for me.
on run argv
-- Don't set if no path to use
if count of argv is 1 then
set folderName to item 1 of argv -- Folder path
end if
tell app "System Events"
set testProps to properties of disk item (folderName)
if class of testProps is not folder then
set myFile to (POSIX file folderName) as alias
set folderName to POSIX path of container of myFile
end if
end tell
tell application "Terminal"
set windowsCount to (count of windows)
activate
if folderName is not missing value then
set commandToRun to "cd " & quoted form of (folderName as string)
if windowsCount is not 0 then
do script commandToRun
else
do script commandToRun in window 0
end if
do script "clear" in window 0
end if
end tell
end run
As the title suggested.
But it's fine for Mac bundled terminal. Don't know what's wrong. It used to work.
I've been using MacTerminal for some time but lately it's been acting up by not cd:ing into the folder that I'm currently in.
So today I decided to try some alternatives and removed MacTerminal, but in lack of anything better I tried installing it again via Package Control. Of course that didn't work since it's been renamed to termX (and is currently not available from Package Control?), so I manually cloned the master branch (652aed4) into my Packages folder.
Now I can't get the open_termx_terminal
command to do anything at all. Running the command manually in the console does nothing either. Also I don't see anything related to termX in the command palette.
I'm using Sublime Text, Stable Channel, build 3114
I just got the plugin - live the idea. But i can't get it working.
The right click menu is there - but nothing happens when I ry to get a file to open in terminal.
Here is debug:
reloading Packages/User/MacTerminal.sublime-settings
Writing file /Users/leeblazek/Library/Application Support/Sublime Text 3/Packages/User/MacTerminal.sublime-settings with encoding UTF-8 (atomic)
reloading Packages/User/MacTerminal.sublime-settings
Writing file /Users/leeblazek/Library/Application Support/Sublime Text 3/Packages/User/MacTerminal.sublime-settings with encoding UTF-8 (atomic)
reloading Packages/User/MacTerminal.sublime-settings
---MacTerminal DEBUG START---
{'cmd': '/usr/bin/osascript/Users/leeblazek/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm.scpt/Users/leeblazek/node_stuff/strongloop/webtest',
'default_path': None,
'err': b'osascript: /Users/leeblazek/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm.scpt: No such file or directory\n',
'out': b'',
'terminal_name': 'iterm'}
---MacTerminal DEBUG END---
Any Ideas much appreciated
iterm opens a new tab, but does not receive the path, and does not navigate to the location.
Problem:
termx.sublime-settings
does not work, actually, when I looked at the source code, the settings file is still hardcoded as MacTerminal.sublime-settings
open_terminal
, again, in the source code, the correct command is open_mac_terminal
.Some of us use the command palette extensively and specially for less frequently used commands it is a must to have them available there as well, so it doesn't become necessary to memorize a million of different shortcuts.
Do you think it would be possible to add this?
Thanks a lot!
---MacTerminal DEBUG START---
{'cmd': '/usr/bin/osascript/Users/xxxx/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_terminal.scpt/Volumes/User HD/Documents/ltserver',
'directory_mode': 'default',
'err': b'/Users/xxxx/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_terminal.scpt:272:314: execution error: Terminal got an error: Can\xe2\x80\x99t get window 1 whose frontmost = true. Invalid index. (-1719)\n',
'out': b'',
'terminal_name': 'terminal'}
---MacTerminal DEBUG END---
Terminal won't open when Terminal is already run without any window.
Mac os x 10.9.1 ST3
Hi! Keep getting this error:
'---MacTerminal DEBUG START---'
{'cmd': '/usr/bin/osascript /Users/akella/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm.scpt /Users/akella/Desktop/git',
'directory_mode': 'project',
'ext_language': 'scpt',
'paths': ['/Users/akella/Desktop/git'],
'process_err': b'/Users/akella/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm.scpt:425:433: script error: Expected end of line but found identifier. (-2741)\n',
'process_out': b''}
'---MacTerminal DEBUG END---'
But if i remove this part http://take.ms/oFA0J, works ok.
10.11 El Capitan, Sublime Text 3, Build 3083
When using the following configuration, with iTerm:
{
"directory_mode" : "project",
"terminal" : "iterm"
}
iTerm simply opens my default directory, rather than the project directory. I get the following error in the Sublime console:
'---MacTerminal DEBUG START---'
{'cmd': '/usr/bin/osascript /Users/shankie/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm.js /Users/shankie/Sites/proper-build',
'directory_mode': 'project',
'ext_language': 'js',
'paths': ['/Users/shankie/Sites/proper-build'],
'process_err': b'/Users/shankie/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm.js:418:495: execution error: Error on line 23: Error: Message not understood. (-1708)\n',
'process_out': b''}
'---MacTerminal DEBUG END---'
Any ideas? Cheers!
Hi,
The "Open in Terminal" menu option is greyed out. Is there something I'm missing?
You can see the issue as the picture shown below
I have changed macterminal_iterm.scpt
as below and it seems to work well:
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
on run argv
set _isRunning to is_running("iTerm")
set _cwd to item 1 of argv
tell application "iTerm"
make new terminal
tell the current terminal
activate current session
if _isRunning then
launch session "Default Session"
end if
tell the last session
write text "pushd " & _cwd & ";clear;pwd"
end tell
end tell
activate
end tell
end run
How is this different from https://github.com/wbond/sublime_terminal please?
When i hit ctrl+cmd+t it opens terminal with my home directory(default terminal state)
The console log for the debug is as follows
---MacTerminal DEBUG START---
{'cmd': u'/usr/bin/osascript/Users/rajesh/Library/Application Support/Sublime Text 2/Packages/MacTerminal/macterminal_iterm.scpt/Users/rajesh/www/ahead/kanaan/website',
'directory_mode': u'project',
'err': '',
'out': '',
'terminal_name': u'iterm'}
---MacTerminal DEBUG END---
Traceback (most recent call last):
File "./sublime_plugin.py", line 362, in run_
File "./open_mac_terminal.py", line 30, in run
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/posixpath.py", line 119, in dirname
AttributeError: 'NoneType' object has no attribute 'rfind'
It's assigned for "Goto anything", and widely used among ex-TextMate users.
ctr+cmd+t opens a new tab in iterm2, but it opens it in my home folder rather than the current file's directory or the project directory. I've tried it with directory_mode
set to both project
and default
. Here's my user config:
{
"terminal" : "iterm",
"debug" : true,
"directory_mode" : "project"
}
and here's the debug output:
---MacTerminal DEBUG START---
{'cmd': '/usr/bin/osascript/Users/janusz/Library/Application Support/Sublime Text 3/Packages/MacTerminal/macterminal_iterm.scpt/Users/janusz/git/omx-utils',
'directory_mode': 'project',
'err': b'',
'out': b'',
'terminal_name': 'iterm'}
---MacTerminal DEBUG END---
I installed the package using Package Control. Also, the path to osascript is correct.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.