是否有类似于“在这里打开命令窗口”的Mac OS Windows Powertoy ?我通过谷歌搜索找到了几个插件,但想看看哪些最适合开发人员。
当前回答
澄清(感谢@vgm64):如果你已经在终端中,这可以让你在不离开终端的情况下快速切换到最上面的Finder窗口。这样,就可以避免使用鼠标。
我已经在我的.bash_profile中添加了以下内容,这样我就可以在任何时候在终端中键入cdff。
function ff { osascript -e 'tell application "Finder"'\
-e "if (${1-1} <= (count Finder windows)) then"\
-e "get POSIX path of (target of window ${1-1} as alias)"\
-e 'else' -e 'get POSIX path of (desktop as alias)'\
-e 'end if' -e 'end tell'; };\
function cdff { cd "`ff $@`"; };
这是macosxhints.com的终端提示。
其他回答
在OSX 10.6上的AppleScript中有一个错误。(2终端Windows打开)。 我通过在激活后添加关闭命令来解决这个问题。这将关闭第一个终端窗口。
on run
tell application "Finder"
try
activate
set frontWin to folder of front window as string
set frontWinPath to (get POSIX path of frontWin)
tell application "Terminal"
activate
close
do script with command "cd \"" & frontWinPath & "\""
end tell
on error error_message
beep
display dialog error_message buttons ¬
{"OK"} default button 1
end try
end tell
end run
这样的:
https://github.com/jbtule/cdto#cd-to
这是一个小的应用程序,你可以拖到Finder工具栏中,图标非常合适。它使用Terminal, xterm(在X11下),term。
如果你安装了Big Cat Scripts (http://www.ranchero.com/bigcat/),你可以添加自己的上下文菜单(右键单击)项。我不认为它带有一个Open Terminal Here applescript,但我使用这个脚本(我不记得是我自己写的,还是从别人的例子中引用的):
on main(filelist)
tell application "Finder"
try
activate
set frontWin to folder of front window as string
set frontWinPath to (get POSIX path of frontWin)
tell application "Terminal"
activate
do script with command "cd \"" & frontWinPath & "\""
end tell
on error error_message
beep
display dialog error_message buttons ¬
{"OK"} default button 1
end try
end tell
end main
类似的脚本还可以通过右键单击获得文件的完整路径,我发现这更有用。
vgm64和d0k发布了一个非常漂亮和苗条的开放终端的更新版本。这个改变是由詹姆斯·大卫·洛做出的。他在自己的网站上发布了新版本。只需下载OpenTerminalHere.zip,解压它,将包移动到你的Library/Scripts文件夹,并将它从那里拖到你的Finder工具栏。
它的特别之处在于,如果是终端,它总是打开一个新标签。应用程序窗口已经打开。非常有用!我还注意到,应用程序按钮的风格更适合雪豹Finder。应用程序的风格比cdto发布的编校做。
我为finder工具栏创建了一个包含3个应用程序的包。 另外两个应用程序可以做到:
打开当前选择的Textmate 用当前文件夹打开GitX
更多信息请看这里: http://nslog.de/posts/71
推荐文章
- 如何强制从另一个SSH会话分离屏幕?
- 如何从终端机发送电子邮件?
- 在Mac OS X上哪里安装Android SDK ?
- Mac/OS X上的/var/lib/docker在哪里
- Xcode构建失败“架构x86_64未定义的符号”
- 在OSX 10.11中安装Scrapy时,“OSError: [Errno 1]操作不允许”(El Capitan)(系统完整性保护)
- 如何在Mac OS X 10.6中使硬件发出哔哔声
- 从Cocoa应用程序执行一个终端命令
- Android Studio无法找到有效的Jvm(与MAC OS相关)
- NSRange从Swift Range?
- 如何在交互式Python中查看整个命令历史?
- 在OSX中永久设置PATH环境变量
- 如何停止mysqld
- Git显示“警告:永久添加到已知主机列表”
- 如何从远程SSH会话发送数据到本地剪贴板