Sublime2 配置python 和 c++

來源:互聯網
上載者:User

標籤:

 

常用快速鍵

1.ctrl + `調出控制台 2.ctrl+shift+p 調出命令選擇區 3.ctrl + w 關閉當前標籤 4.ctrl + shift + t 恢複上次關閉的標籤 5.ctrl + n 建立檔案 6.ctrl + p 尋找檔案 7.ctrl + f 尋找關鍵字

8.ctrl + d 顯示關鍵單詞 9.alt + f3 選擇所有關鍵單詞可以編輯替換

可以在key-building 裡修改預設快速鍵和設定新的快速鍵

 

一 下載sublime,並安裝package control外掛程式

Ctrl + ` 調出控制台輸入如下代碼

import urllib2,os; pf=‘Package Control.sublime-package‘; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler( ))); open( os.path.join( ipp, pf), ‘wb‘ ).write( urllib2.urlopen( ‘http://sublime.wbond.net/‘ +pf.replace( ‘ ‘,‘%20‘ )).read()); print( ‘Please restart Sublime Text to finish installation‘)

二 在調試的時候由於環境變數的配置,環境變數的字元集中缺少ascii字元集

找到設定檔目錄位置(在sublime text 2中點Preference -> Browse Packages)在Default目錄下找到exec.py,編輯;

找到以下兩行:

for k, v in proc_env.iteritems():            proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())

  

更改為:

for k, v in proc_env.iteritems():            try:                proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())            except UnicodeDecodeError:                print("Encoding error")                print("VARIABLE: ", k, " : ", v)

配置Python

下載Python 27

1.添加環境變數 2.修改設定檔

 Preferences ->Browse Packages->Python檔案夾 ->找到Python.sublime-build  

將裡面內容改為如下

{"cmd": ["python", "-u", "$file"],"path":"C:/Python27","file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)","selector": "source.python"//"encoding": "cp936"}

配置C++

下載MinGW32

1.添加環境變數 2.修改設定檔

 Preferences ->Browse Packages->C++檔案夾 ->找到C++.sublime-build

將裡面內容改為如下

{     "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],     "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",     "working_dir": "${file_path}",     "selector": "source.c, source.c++",     "encoding": "cp936",     "shell": true,     "variants":     [          {               "name": "Run",               //"cmd": ["CMD", "/U", "/C", "g++ ${file} -o ${file_base_name} && ${file_base_name}"]                "cmd": [ "start", "${file_path}/${file_base_name}.exe"]          }     ]}

常用外掛程式

1.Terminal外掛程式

  Terminal外掛程式可以允許在Sublime Text2中開啟cmd命令視窗,很實用的一個外掛程式,安裝好該外掛程式好,開啟cmd命令視窗的快速鍵是

Ctrl+Shift+T。

2.SublimeTmpl外掛程式

  這個外掛程式允許使用者定義檔案的模板,比如在寫一個html檔案時,老是重複檔案頭的一些引入資訊很繁瑣,可以定義一個模板直接產生必須的資訊,具體的SublimeTmpl外掛程式用法請自行百度。

3.SideBarEnhancements外掛程式

  一個增強側邊欄檔案夾瀏覽功能的外掛程式,比較不錯。

更多外掛程式介紹http://www.cnblogs.com/dolphin0520/archive/2013/04/29/3046237.html

 


Sublime2 配置python 和 c++

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.