ホームページ >バックエンド開発 >Python チュートリアル >请推荐分享sublime text2 for python 的好用插件?
<code class="language-python"><span class="c">#-*-coding:utf-8-*-</span>
<span class="kn">import</span> <span class="nn">sublime</span><span class="o">,</span> <span class="nn">sublime_plugin</span><span class="o">,</span> <span class="nn">os</span>
<span class="k">class</span> <span class="nc">PythonrunCommand</span><span class="p">(</span><span class="n">sublime_plugin</span><span class="o">.</span><span class="n">TextCommand</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">edit</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">view</span><span class="o">.</span><span class="n">run_command</span><span class="p">(</span><span class="s">"save"</span><span class="p">)</span>
<span class="n">cmd</span> <span class="o">=</span> <span class="s">"@echo off & python "</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">view</span><span class="o">.</span><span class="n">file_name</span><span class="p">()</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s">'gb2312'</span><span class="p">)</span> <span class="o">+</span> <span class="s">" & pause"</span>
<span class="n">os</span><span class="o">.</span><span class="n">system</span><span class="p">(</span><span class="n">cmd</span><span class="p">)</span>
</code>
GitGutter 类似git的diff效果,在修改和新加行左侧做个标记