SublimePlugin : StataEditor (for Sublime Text 3)

SublimePlugin : StataEditor (for Sublime Text 3)

標簽(空格分隔): SublimePlugin Stata


Install Pywin32 and StataEditor

  • install the Pywin32 package from Package Control.
  • install the StataEditor package from Package Control.

The Path to Stata Installation

  • You also need to provide the path to your Stata installation. To do so, go to Preferences -> Package Settings -> StataEditor -> Settings - Default
  • If the path in that file corresponds to the path to your Stata installation you do not need to do anything.
  • Otherwise, copy the content of the file and go to Preferences -> Package Settings -> StataEditor -> Settings - User and paste your copied text in the new file. Then change the path to where your Stata installation is located (note that you need to use forward slash, "/", instead of backward slash, "") and save the file.
  • In addition, if you do not use Stata 13, change the Stata version number.
  • Do not change the content of the Settings - Default file. While this will work temporarily, with the next update your changes will disappear. The content of the Settings - User file will not be overwritten when the package is updated.

Register the Stata Automation Type Library

Using Stata Automation

  • 創(chuàng)建StataMP-64.exe 快捷方式;
  • 在快捷方式中泛鸟,選擇屬性,在目標(T)的文件地址之后添加/Register(或添加/UseRegistryStartin也可以)例如:
    "D:\stata13\StataMP-64.exe" /Register

自定義設置

Stata設置

Do-fileEditor -> Edit -> Preferences -> Advanced -> Edit do-files opened from Windows instead of executing them

快捷鍵:

  1. 使用CTRL+D或者ctrl+R運行
  2. 本地宏 local 使用 Alt+L,亦可按 `(ESC下)自動補齊

主題方案

  • install the Theme - Nil package from Package Control.

修改行距

Preferences -> Settings - User)中嚣艇,可以做以下調(diào)整,解決do-file-editor無法直接修改行距的問題候味。

{
        "color_scheme": "Packages/Nil-Theme/Big Duo.tmTheme",
        "font_size": 11.0,
        "ignored_packages":
        [
                "Vintage"
        ],
        "line_padding_bottom": 2,
        "line_padding_top": 2,
        "update_check": false,
        "word_wrap": "auto"
}

自定義快捷鍵

Preferences -> keybinding - user中可以參照key binding - defult中的設置復制修改抒寂,例如將ctrl+D運行可改為f12鍵。

[        
  { "keys": ["f12"],"command": "stata_execute","args": {"Mode": "do"},"context":
    [
  { "key": "selector", "operator": "equal", "operand": "source.stata" }
    ]
  },
  { "keys": ["ctrl+r"], "command": "stata_execute", "args": {"Mode": "run"}, "context":
    [
  { "key": "selector", "operator": "equal", "operand": "source.stata" }
    ]
  }
]

添加右鍵快捷方式

標簽(空格分隔): SublimeText3


將下面的代碼保存為 sublime_addright.inf 并放在 Sublime Text 3 的安裝目錄下毅访。

[Version]  
Signature="$Windows NT$"  
      
[DefaultInstall]  
AddReg=SublimeText3  
      
[SublimeText3]  
    hkcr,"*\\shell\\SublimeText3",,,"用 Sublime Text 3 打開"  
    hkcr,"*\\shell\\SublimeText3\\command",,,"""%1%\sublime_text.exe"" ""%%1"" %%*"  
    hkcr,"Directory\shell\SublimeText3",,,"用 SublimeText3 打開"  
    hkcr,"*\\shell\\SublimeText3","Icon",0x20000,"%1%\sublime_text.exe, 0"  
    hkcr,"Directory\shell\SublimeText3\command",,,"""%1%\sublime_text.exe"" ""%%1"""

然后右鍵點擊“安裝”沮榜,即可。


Stata Editor for Sublime Text 3[1][2]

by Mattias Nordin

  • Version 0.8.0
  • Date: December 29, 2016

Features

This package provides the ability to write and run Stata code from Sublime Text 3 (ST3). Features in this package include:

  • Clear syntax highlighting
  • Ability to run do-files from ST3 using both ctrl + D ("do") and ctrl + R ("run")
  • Run only selected code with support for multiple selections
  • Access Stata help files from ST3 by selecting the command for which you want access to the documentation and press F1 (open help file in ST3), or ctrl + F1 (open help file in Stata). For the former option, an internet connection is required.
  • Shorthand for creation of locals by pressing alt + L
  • Load a new Stata dataset by selecting a path and pressing alt + shift + U (Equivalent to the command "use 'path', clear"). Please, note that your current work will then be lost, so remember to save your dataset!
  • Some snippets and completions (edit the settings to add completions for functions, commands and files)
  • Plus all other features that come with ST3!

Requirements and Setup

This package only works on Windows machines. To use Stata with Sublime Text on OS X, try Stata Enhanced. StataEditor has been tested on Sublime Text 3 together with Stata 13 and Stata 14 on Windows 7 and Windows 8. I have very briefly tested it on Stata 11 and Stata 12 and it seems to be working.

To install the package follow the steps outlined below. You can install StataEditor without Package Control, but in that case you probably already know what to do.

  1. Download and install ST3 if you do not already have it installed.
  2. Install Package Control. To get Package Control, click here and follow the instructions for ST3.
  3. Open ST3 and click Preferences -> Package Control. Choose "Install Package" and choose StataEditor from the list. Repeat this step and install the Pywin32 package.
  4. If the path to your Stata installation is "C:/Program Files (x86)/Stata13/StataMP-64.exe" you can skip this step. If not, select Preferences -> Package Settings -> StataEditor -> Settings - Default. Copy the content and then go to Preferences -> Package Settings -> StataEditor -> Settings - User and paste your copied text in the new file. Then change the path to where your Stata installation is located (note that you need to use forward slash, "/", instead of backward slash, "") and save the file. In addition, if you do not use Stata 13, change the Stata version number. Do not change the content of the Settings - Default file. While this will work temporarily, with the next update your changes will disappear. The content of the Settings - User file will not be overwritten when the package is updated.
  5. Finally, to use Stata interactively from ST3, you also need to register the Stata Automation type library. Instructions can be found here. Note that I have had to use the Windows Vista instructions for both Windows 7 and Windows 8 to get Stata Automation to work. Once the Stata Automation type library has been registered, you are good to go!

Encoding

Stata 14 has unicode support and uses utf-8 encoding just as ST3. Earlier versions of Stata do not have unicode support. Therefore, if you write Stata code containing non-ASCII characters in ST3, you may notice that these characters have been replaced with nonsense when you open the file in Stata's native do-file editor (versions 13 and earlier). This problem is easily avoided by saving your file with a different encoding in ST3: Simply open "File -> Save with encoding", and choose Western (Windows 1252) (or another appropriate encoding). If your Stata version uses a different encoding than Windows 1252 (again, only Stata 13 and earlier), it is possible to change encoding by going to the settings file (see step 4 under "Requirements and Setup" above) and change the character_encoding option. For a list of encodings to use, see the following link

Acknowledgments

Thanks to Adrian Adermon and Daniel Forchheimer for helpful suggestions and to Sergio Correia for providing additional key bindings.


  1. Stata Editor for Sublime Text 3 ?

  2. Stata Editor for Sublime Text 3 ?

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末喻粹,一起剝皮案震驚了整個濱河市蟆融,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌守呜,老刑警劉巖型酥,帶你破解...
    沈念sama閱讀 206,602評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件山憨,死亡現(xiàn)場離奇詭異,居然都是意外死亡弥喉,警方通過查閱死者的電腦和手機郁竟,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,442評論 2 382
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來由境,“玉大人棚亩,你說我怎么就攤上這事÷步埽” “怎么了讥蟆?”我有些...
    開封第一講書人閱讀 152,878評論 0 344
  • 文/不壞的土叔 我叫張陵,是天一觀的道長纺阔。 經(jīng)常有香客問我攻询,道長,這世上最難降的妖魔是什么州弟? 我笑而不...
    開封第一講書人閱讀 55,306評論 1 279
  • 正文 為了忘掉前任钧栖,我火速辦了婚禮,結(jié)果婚禮上婆翔,老公的妹妹穿的比我還像新娘拯杠。我一直安慰自己,他們只是感情好啃奴,可當我...
    茶點故事閱讀 64,330評論 5 373
  • 文/花漫 我一把揭開白布潭陪。 她就那樣靜靜地躺著,像睡著了一般最蕾。 火紅的嫁衣襯著肌膚如雪依溯。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,071評論 1 285
  • 那天瘟则,我揣著相機與錄音黎炉,去河邊找鬼。 笑死醋拧,一個胖子當著我的面吹牛慷嗜,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播丹壕,決...
    沈念sama閱讀 38,382評論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼庆械,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了菌赖?” 一聲冷哼從身側(cè)響起缭乘,我...
    開封第一講書人閱讀 37,006評論 0 259
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎琉用,沒想到半個月后堕绩,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體薄啥,經(jīng)...
    沈念sama閱讀 43,512評論 1 300
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 35,965評論 2 325
  • 正文 我和宋清朗相戀三年逛尚,在試婚紗的時候發(fā)現(xiàn)自己被綠了垄惧。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 38,094評論 1 333
  • 序言:一個原本活蹦亂跳的男人離奇死亡绰寞,死狀恐怖到逊,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情滤钱,我是刑警寧澤觉壶,帶...
    沈念sama閱讀 33,732評論 4 323
  • 正文 年R本政府宣布,位于F島的核電站件缸,受9級特大地震影響铜靶,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜他炊,卻給世界環(huán)境...
    茶點故事閱讀 39,283評論 3 307
  • 文/蒙蒙 一争剿、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧痊末,春花似錦蚕苇、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,286評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至盒件,卻和暖如春蹬碧,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背炒刁。 一陣腳步聲響...
    開封第一講書人閱讀 31,512評論 1 262
  • 我被黑心中介騙來泰國打工恩沽, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人切心。 一個月前我還...
    沈念sama閱讀 45,536評論 2 354
  • 正文 我出身青樓飒筑,卻偏偏與公主長得像,于是被迫代替她去往敵國和親绽昏。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 42,828評論 2 345

推薦閱讀更多精彩內(nèi)容