Sublime的terminal插件

terminal插件的作用是在终端打开当前文档所在路径,快捷键是Command+Shift+T
默认是调用自带终端,而我用的是iterm,要修改插件的设置,改为下面的。

1
2
3
4
5
6
7
8
9
10
11
12

{
// The command to execute for the terminal, leave blank for the OS default
// On OS X the terminal can be set to iTerm.sh to execute iTerm
"terminal": "iTerm.sh",

// A list of default parameters to pass to the terminal, this can be
// overridden by passing the "parameters" key with a list value to the args
// dict when calling the "open_terminal" or "open_terminal_project_folder"
// commands
"parameters": []
}

但默认是在终端新的窗口打开,想在新的标签打开的话得修改terminal文件夹下得iTerm.sh文件,修改如下。

1
2
3
4
5
6
7
8
9
10
11
12
if (( $RUNNING )); then
osascript<<END
tell application "iTerm"
activate
tell the first terminal
set sess to (launch session "Default Session")
tell sess
write text "$CD_CMD"
end tell
end tell
end tell
END

参考