是否有类似于“在这里打开命令窗口”的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的终端提示。
其他回答
此外,您可以使用command-C从查找器中复制一个项目,跳转到终端(例如使用Spotlight或QuickSilver)键入'cd '并简单地使用command-v粘贴
在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
如果你安装了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
类似的脚本还可以通过右键单击获得文件的完整路径,我发现这更有用。
查看这里的开放终端。它可能与“在这里打开命令窗口”最相似。我使用>cdto,这是非常相似的,但这似乎是更好地处理空格…但并不完美。
它具有的非常好的功能是“在应用程序开始时检测键下事件并使用它们修改脚本的行为”,允许脚本在按住⌘键调用时在最前面的终端窗口中打开一个新选项卡。整洁的技巧。
还要注意PCheese的回答;它可能对重度终端用户更有用!
我为finder工具栏创建了一个包含3个应用程序的包。 另外两个应用程序可以做到:
打开当前选择的Textmate 用当前文件夹打开GitX
更多信息请看这里: http://nslog.de/posts/71
推荐文章
- 如何从终端/命令行调用VS代码编辑器
- 访问限制:'Application'类型不是API(必需库rt.jar的限制)
- 为什么在Mac OS X v10.9 (Mavericks)的终端中apt-get功能不起作用?
- “你有邮件”的消息在终端,os X
- Mac OS X中的环境变量
- 如何从macOS完全卸载蟒蛇
- 如何配置Mac OS X术语,使git有颜色?
- 如何使制表符4个空间而不是8个空间在纳米?
- 我如何确定文件编码在OS X?
- 使iTerm以与其他操作系统相同的方式翻译“元键”
- 错误:无法在ARM处理器上的Homebrew中安装英特尔默认前缀(/usr/local)
- 如何强制从另一个SSH会话分离屏幕?
- 如何从终端机发送电子邮件?
- 在Mac OS X上哪里安装Android SDK ?
- Mac/OS X上的/var/lib/docker在哪里