sublime text使用過程中遇到的一些問題記錄疤剑。
1. st支持輸入命令行參數(shù)
[1] ctrl + shift + p 快捷鍵呼出命令面板随闪,搜索install package,選擇安裝骚勘,等待響應(yīng)铐伴,之后搜索Shell-Turtlestein,安裝俏讹。
ctr + shift + c呼出插件当宴,即可輸入命令行。
在我機(jī)器上仍然報(bào)錯(cuò)泽疆,shell_cmd or cmd is required户矢。
[2] 經(jīng)測試驗(yàn)證該方法可解決:
- Open folder %APPDATA%\Sublime Text 3\Packages or just click Preferences -> Browser Packages
- Create a folder named CMD (Uppercase). The path of CMD should be %APPDATA%\Sublime Text 3\Packages\CMD.
- Open the folder CMD, and create a file, named cmd.py (lowercase), paste the context as below:
<pre><code>
import os, sublime_plugin
class CmdCommand(sublime_plugin.TextCommand):
def run(self, edit):
file_name=self.view.file_name()
path=file_name.split("\")
current_driver=path[0]
path.pop()
current_directory="\".join(path)
command= "cd "+current_directory+" & "+current_driver+" & start cmd"
os.system(command)
</pre></code> - Create a file (again), named Context.sublime-menu. Add context as below:
<pre><code>
[
{ "command": "cmd" }
]
</pre></code> - The Cmd function will work in context menu (right-click). For example:
Of cause, if you want to open command line by command (by 'cmd' for example), you can add the following context into Default (Windows).sublime-keymap file. :
{ "keys": ["c", "m", "d"], "command": "cmd"}
You can open it from Preferences -> Key Bindings - User
ref:
[1] http://blog.csdn.net/xiangsimoyinjiu/article/details/51130138
[2] http://stackoverflow.com/questions/18606682/how-can-i-open-command-line-prompt-from-sublime-in-windows7?noredirect=1