├── .gitignore ├── .no-sublime-package ├── Comments.tmPreferences ├── Default (OSX).sublime-keymap ├── Default (Windows).sublime-keymap ├── Default.sublime-commands ├── Main.sublime-menu ├── README.md ├── Stata Enhanced (OSX).sublime-settings ├── Stata Enhanced (Windows).sublime-settings ├── Stata.sublime-build ├── Stata.tmLanguage ├── StataIndentation Rules.tmPreferences ├── Symbol List.tmPreferences ├── messages.json ├── messages ├── 1.0.2.txt ├── 1.0.3.txt ├── 1.0.4.txt ├── 1.0.5.txt ├── 1.1.2.txt ├── 1.1.4.txt ├── 1.2.0.txt ├── 1.2.2.txt ├── 1.2.4.txt ├── 1.2.5.txt ├── 1.2.6.txt ├── 2.0.0.txt ├── 2.0.3.txt ├── 2.1.0.txt ├── 2.1.2.txt ├── 2.1.4.txt ├── 2.1.6.txt ├── 2.1.7.txt ├── 2.2.0.txt ├── 2.2.4.txt └── install.txt ├── stata-send-command-move-next-line.sublime-macro └── text_2_stata.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.cache 2 | *.pyc 3 | -------------------------------------------------------------------------------- /.no-sublime-package: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewheiss/SublimeStataEnhanced/c64d3702b0cb9db8e1d1a4b7be75c3355763cde2/.no-sublime-package -------------------------------------------------------------------------------- /Comments.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Comments 7 | scope 8 | source.stata 9 | settings 10 | 11 | shellVariables 12 | 13 | 14 | name 15 | TM_COMMENT_START 16 | value 17 | * 18 | 19 | 20 | name 21 | TM_COMMENT_START_2 22 | value 23 | /* 24 | 25 | 26 | name 27 | TM_COMMENT_END_2 28 | value 29 | */ 30 | 31 | 32 | name 33 | TM_COMMENT_START_3 34 | value 35 | // 36 | 37 | 38 | name 39 | TM_COMMENT_DISABLE_INDENT_2 40 | value 41 | yes 42 | 43 | 44 | 45 | uuid 46 | 38DBCCE5-2005-410C-B7D7-013097751AC8 47 | 48 | 49 | -------------------------------------------------------------------------------- /Default (OSX).sublime-keymap: -------------------------------------------------------------------------------- 1 | [ 2 | { "keys": ["super+enter"], "command": "run_macro_file", "args": {"file": "Packages/Stata Enhanced/stata-send-command-move-next-line.sublime-macro"}, "context": 3 | [ 4 | { "key": "selector", "operator": "equal", "operand": "source.stata" } 5 | ] 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /Default (Windows).sublime-keymap: -------------------------------------------------------------------------------- 1 | [ 2 | { "keys": ["ctrl+enter"], "command": "run_macro_file", "args": {"file": "Packages/Stata Enhanced/stata-send-command-move-next-line.sublime-macro"}, "context": 3 | [ 4 | { "key": "selector", "operator": "equal", "operand": "source.stata" } 5 | ] 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /Default.sublime-commands: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "caption": "Send line/selection to Stata", 4 | "command": "text_2_stata" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /Main.sublime-menu: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "tools", 4 | "children": 5 | [ 6 | { 7 | "caption": "Stata Enhanced", 8 | "children": 9 | [ 10 | { 11 | "caption": "Send line/selection to Stata", 12 | "command": "text_2_stata" 13 | } 14 | ] 15 | } 16 | ] 17 | }, 18 | { 19 | "id": "preferences", 20 | "children": 21 | [ 22 | { 23 | "caption": "Package Settings", 24 | "mnemonic": "P", 25 | "id": "package-settings", 26 | "children": 27 | [ 28 | { 29 | "caption": "Stata Enhanced", 30 | "children": 31 | [ 32 | { 33 | "command": "open_file", 34 | "args": { 35 | "file": "${packages}/Stata Enhanced/Stata Enhanced (OSX).sublime-settings", 36 | "platform": "OSX" 37 | }, 38 | "caption": "Settings – Default" 39 | }, 40 | { 41 | "command": "open_file", 42 | "args": {"file": 43 | "${packages}/Stata Enhanced/Stata Enhanced (Windows).sublime-settings", 44 | "platform": "Windows" 45 | }, 46 | "caption": "Settings – Default" 47 | }, 48 | { 49 | "command": "open_file", 50 | "args": {"file": "${packages}/User/Stata Enhanced.sublime-settings"}, 51 | "caption": "Settings – User" 52 | }, 53 | { 54 | "command": "open_file_settings", 55 | "caption": "Settings – Syntax Specific – User" 56 | }, 57 | { "caption": "-" }, 58 | { 59 | "command": "open_file", 60 | "args": { 61 | "file": "${packages}/Stata Enhanced/Default (OSX).sublime-keymap", 62 | "platform": "OSX" 63 | }, 64 | "caption": "Key Bindings – Default" 65 | }, 66 | { 67 | "command": "open_file", 68 | "args": { 69 | "file": "${packages}/Stata Enhanced/Default (Windows).sublime-keymap", 70 | "platform": "Windows" 71 | }, 72 | "caption": "Key Bindings – Default" 73 | }, 74 | { 75 | "command": "open_file", 76 | "args": { 77 | "file": "${packages}/User/Default (OSX).sublime-keymap", 78 | "platform": "OSX" 79 | }, 80 | "caption": "Key Bindings – User" 81 | }, 82 | { 83 | "command": "open_file", 84 | "args": { 85 | "file": "${packages}/User/Default (Windows).sublime-keymap", 86 | "platform": "Windows" 87 | }, 88 | "caption": "Key Bindings – User" 89 | } 90 | ] 91 | } 92 | ] 93 | } 94 | ] 95 | } 96 | ] 97 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sublime Stata Enhanced 2 | 3 | * Version 2.2.4 4 | * Date: June 16, 2017 5 | 6 | This package adds basic support for Stata (11–15, Windows and OS X) and comes with: 7 | 8 | * Language definition for `.do` and `.ado` files 9 | * Commands for sending individual lines or selections to Stata (available via the command palette and with keyboard shortcuts): 10 | * (*OS X*) Send current line or selection to Stata: `super+enter` 11 | * (*Windows*) Send current line or selection to Stata: `ctrl+enter` 12 | * A build system for Stata files 13 | 14 | ## Background 15 | 16 | This is a modified version of [Steve Harris's Stata package](https://github.com/docsteveharris/stata). Because of scripting limitations in Stata < 12, his version relied on creating temporary `.do` files to pass commands to Stata. Stata 13 added fancy new AppleScript commands (specifically `DoCommand` and `DoCommandAsync`) that allow for scripted commands and eliminate the need for temporary files. Because of that, this package is far simpler than other Sublime Text packages. 17 | 18 | For compatability with previous versions of Stata, however, I have included commands that create temporary files, as in the original Stata package. As such, this package works with Stata 11 and above on both OS X and Windows. 19 | 20 | 21 | ## Installation 22 | 23 | There are two ways to install this package: 24 | 25 | 1. Search for "Stata Enhanced" on [Package Control](https://sublime.wbond.net/) 26 | 2. Copy the entire plugin folder to `~/Library/Application Support/Sublime Text 2/Packages` or `~/Library/Application Support/Sublime Text 3/Packages` 27 | 28 | 29 | ## Configuration options 30 | 31 | ### OS X 32 | 33 | * (**Stata 11 and 12 only**) This package sends selected code to a temporary file and then opens that file in Stata via Finder. In order for it to work correctly on your system, you must ensure two things are true: 34 | 1. `.do` files must be set to open in Stata by default in Finder (right click on a `.do` file > "Get Info" > "Open with" > "Change all…" > Select Stata. 35 | 2. `.do` files opened in Stata need to be run, not edited. Change this in Preferences > Do-file Editor > Advanced > Edit do-files opened from the Finder in Do-file Editor (uncheck this) 36 | 37 | By default, when sending code to Stata on OS X, Sublime Text will maintain focus so you can continue to edit, following the pattern of RStudio, which sends code to the R console from the script editor without changing focus away from the editor. If you prefer for Stata to take focus after sending lines or selections, set the `switch_focus_to_stata` to `true` in `Stata Enhanced (OS X).sublime-settings`. 38 | 39 | ### Windows 40 | 41 | * (**All versions of Stata**) Set the full path of your Stata installation (with slashes reversed) in `Stata Enhanced (Windows).sublime-settings` (default is `"C:/Program Files (x86)/Stata13/StataSE-64.exe"`) 42 | * This package sends selected code to a temporary file and then opens that file in Stata. In order for it to work correctly on your system, you must ensure that `.do` files opened in Stata are run, not edited. Change this in Do-file Editor > Edit > Preferences > Advanced > Edit do-files opened from Windows instead of executing them (uncheck this) 43 | 44 | 45 | ## Roadmap and wish list 46 | 47 | * Stata 13 for Windows [has support for Automation APIs](http://www.stata.com/automation/). It would be cool to use those instead of temporary files (like how the OS X version of the plugin uses temporary files for Stata 11–12, but the API for 13). 48 | -------------------------------------------------------------------------------- /Stata Enhanced (OSX).sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "stata_name": "auto", 3 | "switch_focus_to_stata": false 4 | } 5 | -------------------------------------------------------------------------------- /Stata Enhanced (Windows).sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "stata_name": "C:/Program Files (x86)/Stata13/StataSE-64.exe" 3 | } 4 | -------------------------------------------------------------------------------- /Stata.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "target": "stata_run_complete", 3 | "selector": "source.stata", 4 | } -------------------------------------------------------------------------------- /Stata.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | do 8 | ado 9 | 10 | foldingStartMarker 11 | \s*\(\s*$ 12 | foldingStopMarker 13 | ^\s*\) 14 | keyEquivalent 15 | ^~S 16 | name 17 | Stata 18 | patterns 19 | 20 | 21 | match 22 | \b(if|in|for|by|bys|bysort|xi|quietly|capture|exit|qui|cap|program|end)\b 23 | name 24 | keyword.control.stata 25 | 26 | 27 | match 28 | \b([\s,]+replace|[\s,]+clear|[\s,]+append|all|text|long|wide|using|drop|force)\b 29 | name 30 | keyword.options.stata 31 | 32 | 33 | match 34 | (\b\d+(\.\d+)?\b) 35 | name 36 | constant.numeric.stata 37 | 38 | 39 | match 40 | (\b[A-Za-z0-9_]+\.dta|[A-Za-z0-9_]+\.txt|[A-Za-z0-9_]+\.dct|[A-Za-z0-9_]+\.do|[A-Za-z0-9_]+\.ado|\$\w+)\b 41 | name 42 | variable.language.stata 43 | 44 | 45 | match 46 | \b(upper|trim|subinstr|regexm)\b 47 | name 48 | keyword.function.stata 49 | 50 | 51 | match 52 | \b(myprog[A-Za-z0-9_]+)\b 53 | name 54 | constant.language.stata 55 | 56 | 57 | begin 58 | `(?!") 59 | end 60 | (?<!")' 61 | name 62 | string.quoted.single.stata 63 | patterns 64 | 65 | 66 | include 67 | #compoundquote 68 | 69 | 70 | include 71 | #singlequote 72 | 73 | 74 | match 75 | \\. 76 | name 77 | constant.character.escaped.untitled 78 | 79 | 80 | 81 | 82 | begin 83 | (?<!`)"(?!') 84 | end 85 | (?<!`)"(?!') 86 | name 87 | string.quoted.double.stata 88 | patterns 89 | 90 | 91 | match 92 | \\[^"] 93 | name 94 | constant.character.escaped.untitled 95 | 96 | 97 | 98 | 99 | begin 100 | `" 101 | end 102 | "' 103 | name 104 | string.quoted.double.compound.stata 105 | patterns 106 | 107 | 108 | include 109 | #compoundquote 110 | 111 | 112 | include 113 | #singlequote 114 | 115 | 116 | match 117 | \\[^"] 118 | name 119 | constant.character.escaped.untitled 120 | 121 | 122 | 123 | 124 | begin 125 | /\* 126 | end 127 | \*/ 128 | name 129 | comment.block.stata 130 | patterns 131 | 132 | 133 | include 134 | #commentblock 135 | 136 | 137 | 138 | 139 | match 140 | (;\*\s*\#|^\s*\*\s*\#|\t\*\s*\#).*$\n? 141 | name 142 | comment.line.fakeheader.stata 143 | 144 | 145 | match 146 | (;\*|^\s*\*|\t\*).*$\n? 147 | name 148 | comment.line.star.stata 149 | 150 | 151 | match 152 | (^)\/\/.*$ 153 | name 154 | comment.line.double-slash-newline.stata 155 | 156 | 157 | match 158 | \s\/\/.*$ 159 | name 160 | comment.line.double-slash.stata 161 | 162 | 163 | match 164 | \s+\/\/\/.*$\n\n 165 | name 166 | invalid.illegal.line-continuation.stata 167 | 168 | 169 | match 170 | \b(collin|unzipfile|zipfile|eclplot|rspike|parmest|parmby|gllamm|xtsum|xtmepoisson|firstnm|xtmelogit|rcsgen|stdescribe|atts|pscore|sem|running|misstable|stjm|stpm2|xtdescribe|rarea|about|ac|ac_7|acprplot|acprplot_7|adjust|ado|adopath|adoupdate|alpha|ameans|an|ano|anov|anova|anova_estat|anova_terms|anovadef|aorder|ap|app|appe|appen|append|arch|arch_dr|arch_estat|arch_p|archlm|areg|areg_p|args|arima|arima_dr|arima_estat|arima_p|as|asmprobit|asmprobit_estat|asmprobit_lf|asmprobit_mfx__dlg|asmprobit_p|ass|asse|asser|assert|avplot|avplot_7|avplots|avplots_7|bcskew0|bgodfrey|binreg|bip0_lf|biplot|bipp_lf|bipr_lf|bipr_p|biprobit|bitest|bitesti|bitowt|blogit|bmemsize|boot|bootsamp|bootstrap|bootstrap_8|boxco_l|boxco_p|boxcox|boxcox_6|boxcox_p|bprobit|br|break|brier|bro|brow|brows|browse|brr|brrstat|bs|bs_7|bsampl_w|bsample|bsample_7|bsqreg|bstat|bstat_7|bstat_8|bstrap|bstrap_7|ca|ca_estat|ca_p|cabiplot|camat|canon|canon_8|canon_8_p|canon_estat|canon_p|cap|caprojection|capt|captu|captur|capture|cat|cc|cchart|cchart_7|cci|cd|censobs_table|centile|cf|char|chdir|checkdlgfiles|checkestimationsample|checkhlpfiles|checksum|chelp|ci|cii|cl|class|classutil|clear|cli|clis|clist|clo|clog|clog_lf|clog_p|clogi|clogi_sw|clogit|clogit_lf|clogit_p|clogitp|clogl_sw|cloglog|clonevar|clslistarray|cluster|cluster_measures|cluster_stop|cluster_tree|cluster_tree_8|clustermat|cmdlog|cnr|cnre|cnreg|cnreg_p|cnreg_sw|cnsreg|codebook|collaps4|collapse|colormult_nb|colormult_nw|compare|compress|conf|confi|confir|confirm|conren|cons|const|constr|constra|constrai|constrain|constraint|continue|contract|copy|copyright|copysource|cor|corc|corr|corr2data|corr_anti|corr_kmo|corr_smc|corre|correl|correla|correlat|correlate|corrgram|cou|coun|count|cox|cox_p|cox_sw|coxbase|coxhaz|coxvar|cprplot|cprplot_7|crc|cret|cretu|cretur|creturn|cross|cs|cscript|cscript_log|csi|ct|ct_is|ctset|ctst_5|ctst_st|cttost|cumsp|cumsp_7|cumul|cusum|cusum_7|cutil|d|datasig|datasign|datasigna|datasignat|datasignatu|datasignatur|datasignature|datetof|db|dbeta|de|dec|deco|decod|decode|deff|des|desc|descr|descri|describ|describe|destring|dfbeta|dfgls|dfuller|di|di_g|dir|dirstats|dis|discard|disp|disp_res|disp_s|displ|displa|display|do|doe|doed|doedi|doedit|dotplot|dotplot_7|dprobit|drawnorm|drop|ds|ds_util|dstdize|duplicates|durbina|dwstat|dydx|e|ed|edi|edit|egen|eivreg|else|emdef|en|enc|enco|encod|encode|eq|erase|ereg|ereg_lf|ereg_p|ereg_sw|ereghet|ereghet_glf|ereghet_glf_sh|ereghet_gp|ereghet_ilf|ereghet_ilf_sh|ereghet_ip|eret|eretu|eretur|ereturn|err|erro|error|est|est_cfexist|est_cfname|est_clickable|est_expand|est_hold|est_table|est_unhold|est_unholdok|estat|estat_default|estat_summ|estat_vce_only|esti|estimates|etodow|etof|etomdy|ex|exi|exit|expand|expandcl|fac|fact|facto|factor|factor_estat|factor_p|factor_pca_rotated|factor_rotate|factormat|fcast|fcast_compute|fcast_graph|fdades|fdadesc|fdadescr|fdadescri|fdadescrib|fdadescribe|fdasav|fdasave|fdause|fh_st|file|filefilter|fillin|find_hlp_file|findfile|findit|findit_7|fit|fl|fli|flis|flist|for|for5_0|foreach|form|forma|format|forv|forva|forval|forvalu|forvalue|forvalues|fpredict|frac_154|frac_adj|frac_chk|frac_cox|frac_ddp|frac_dis|frac_dv|frac_in|frac_mun|frac_pp|frac_pq|frac_pv|frac_wgt|frac_xo|fracgen|fracplot|fracplot_7|fracpoly|fracpred|fron_ex|fron_hn|fron_p|fron_tn|fron_tn2|frontier|ftodate|ftoe|ftomdy|ftowdate|g|gamhet_glf|gamhet_gp|gamhet_ilf|gamhet_ip|gamma|gamma_d2|gamma_p|gamma_sw|gammahet|gdi_hexagon|gdi_spokes|ge|gen|gene|gener|genera|generat|generate|genrank|genstd|genvmean|gettoken|gl|gladder|gladder_7|glim_l01|glim_l02|glim_l03|glim_l04|glim_l05|glim_l06|glim_l07|glim_l08|glim_l09|glim_l10|glim_l11|glim_l12|glim_lf|glim_mu|glim_nw1|glim_nw2|glim_nw3|glim_p|glim_v1|glim_v2|glim_v3|glim_v4|glim_v5|glim_v6|glim_v7|glm|glm_6|glm_p|glm_sw|glmpred|glo|glob|globa|global|glogit|glogit_8|glogit_p|gmeans|gnbre_lf|gnbreg|gnbreg_5|gnbreg_p|gomp_lf|gompe_sw|gomper_p|gompertz|gompertzhet|gomphet_glf|gomphet_glf_sh|gomphet_gp|gomphet_ilf|gomphet_ilf_sh|gomphet_ip|gphdot|gphpen|gphprint|gprefs|gprobi_p|gprobit|gprobit_8|gr|gr7|gr_copy|gr_current|gr_db|gr_describe|gr_dir|gr_draw|gr_draw_replay|gr_drop|gr_edit|gr_editviewopts|gr_example|gr_example2|gr_export|gr_print|gr_qscheme|gr_query|gr_read|gr_rename|gr_replay|gr_save|gr_set|gr_setscheme|gr_table|gr_undo|gr_use|graph|graph7|grebar|greigen|greigen_7|greigen_8|grmeanby|grmeanby_7|gs_fileinfo|gs_filetype|gs_graphinfo|gs_stat|gsort|gwood|h|hadimvo|hareg|hausman|haver|he|heck_d2|heckma_p|heckman|heckp_lf|heckpr_p|heckprob|hel|help|hereg|hetpr_lf|hetpr_p|hetprob|hettest|hexdump|hilite|hist|hist_7|histogram|hlogit|hlu|hmeans|hotel|hotelling|hprobit|hreg|hsearch|icd9|icd9_ff|icd9p|if|iis|impute|imtest|inbase|include|inf|infi|infil|infile|infix|inp|inpu|input|ins|insheet|insp|inspe|inspec|inspect|integ|inten|intreg|intreg_7|intreg_p|intrg2_ll|intrg_ll|intrg_ll2|ipolate|iqreg|ir|irf|irf_create|irfm|iri|is_svy|is_svysum|isid|istdize|ivprob_1_lf|ivprob_lf|ivprobit|ivprobit_p|ivreg|ivreg_footnote|ivtob_1_lf|ivtob_lf|ivtobit|ivtobit_p|jackknife|jacknife|jknife|jknife_6|jknife_8|jkstat|joinby|kalarma1|kap|kap_3|kapmeier|kappa|kapwgt|kdensity|kdensity_7|keep|ksm|ksmirnov|ktau|kwallis|l|la|lab|labe|label|labelbook|ladder|levels|levelsof|leverage|lfit|lfit_p|li|lincom|line|linktest|lis|list|lloghet_glf|lloghet_glf_sh|lloghet_gp|lloghet_ilf|lloghet_ilf_sh|lloghet_ip|llogi_sw|llogis_p|llogist|llogistic|llogistichet|lnorm_lf|lnorm_sw|lnorma_p|lnormal|lnormalhet|lnormhet_glf|lnormhet_glf_sh|lnormhet_gp|lnormhet_ilf|lnormhet_ilf_sh|lnormhet_ip|lnskew0|loadingplot|loc|loca|local|log|logi|logis_lf|logistic|logistic_p|logit|logit_estat|logit_p|loglogs|logrank|loneway|lookfor|lookup|lowess|lowess_7|lpredict|lrecomp|lroc|lroc_7|lrtest|ls|lsens|lsens_7|lsens_x|lstat|ltable|ltable_7|ltriang|lv|lvr2plot|lvr2plot_7|m|ma|mac|macr|macro|makecns|man|manova|manova_estat|manova_p|manovatest|mantel|mark|markin|markout|marksample|mat|mat_capp|mat_order|mat_put_rr|mat_rapp|mata|mata_clear|mata_describe|mata_drop|mata_matdescribe|mata_matsave|mata_matuse|mata_memory|mata_mlib|mata_mosave|mata_rename|mata_which|matalabel|matcproc|matlist|matname|matr|matri|matrix|matrix_input__dlg|matstrik|mcc|mcci|md0_|md1_|md1debug_|md2_|md2debug_|mds|mds_estat|mds_p|mdsconfig|mdslong|mdsmat|mdsshepard|mdytoe|mdytof|me_derd|mean|means|median|memory|memsize|meqparse|mer|merg|merge|mfp|mfx|mhelp|mhodds|minbound|mixed_ll|mixed_ll_reparm|mkassert|mkdir|mkmat|mkspline|ml|ml_5|ml_adjs|ml_bhhhs|ml_c_d|ml_check|ml_clear|ml_cnt|ml_debug|ml_defd|ml_e0|ml_e0_bfgs|ml_e0_cycle|ml_e0_dfp|ml_e0i|ml_e1|ml_e1_bfgs|ml_e1_bhhh|ml_e1_cycle|ml_e1_dfp|ml_e2|ml_e2_cycle|ml_ebfg0|ml_ebfr0|ml_ebfr1|ml_ebh0q|ml_ebhh0|ml_ebhr0|ml_ebr0i|ml_ecr0i|ml_edfp0|ml_edfr0|ml_edfr1|ml_edr0i|ml_eds|ml_eer0i|ml_egr0i|ml_elf|ml_elf_bfgs|ml_elf_bhhh|ml_elf_cycle|ml_elf_dfp|ml_elfi|ml_elfs|ml_enr0i|ml_enrr0|ml_erdu0|ml_erdu0_bfgs|ml_erdu0_bhhh|ml_erdu0_bhhhq|ml_erdu0_cycle|ml_erdu0_dfp|ml_erdu0_nrbfgs|ml_exde|ml_footnote|ml_geqnr|ml_grad0|ml_graph|ml_hbhhh|ml_hd0|ml_hold|ml_init|ml_inv|ml_log|ml_max|ml_mlout|ml_mlout_8|ml_model|ml_nb0|ml_opt|ml_p|ml_plot|ml_query|ml_rdgrd|ml_repor|ml_s_e|ml_score|ml_searc|ml_technique|ml_unhold|mleval|mlf_|mlmatbysum|mlmatsum|mlog|mlogi|mlogit|mlogit_footnote|mlogit_p|mlopts|mlsum|mlvecsum|mnl0_|mor|more|mov|move|mprobit|mprobit_lf|mprobit_p|mrdu0_|mrdu1_|mvdecode|mvencode|mvreg|mvreg_estat|n|nbreg|nbreg_al|nbreg_lf|nbreg_p|nbreg_sw|nestreg|net|newey|newey_7|newey_p|news|nl|nl_7|nl_9|nl_9_p|nl_p|nl_p_7|nlcom|nlcom_p|nlexp2|nlexp2_7|nlexp2a|nlexp2a_7|nlexp3|nlexp3_7|nlgom3|nlgom3_7|nlgom4|nlgom4_7|nlinit|nllog3|nllog3_7|nllog4|nllog4_7|nlog_rd|nlogit|nlogit_p|nlogitgen|nlogittree|nlpred|no|nobreak|noi|nois|noisi|noisil|noisily|note|notes|notes_dlg|nptrend|numlabel|numlist|odbc|old_ver|olo|olog|ologi|ologi_sw|ologit|ologit_p|ologitp|on|one|onew|onewa|oneway|op_colnm|op_comp|op_diff|op_inv|op_str|opr|opro|oprob|oprob_sw|oprobi|oprobi_p|oprobit|oprobitp|opts_exclusive|order|orthog|orthpoly|ou|out|outf|outfi|outfil|outfile|outs|outsh|outshe|outshee|outsheet|ovtest|pac|pac_7|palette|parse|parse_dissim|pause|pca|pca_8|pca_display|pca_estat|pca_p|pca_rotate|pcamat|pchart|pchart_7|pchi|pchi_7|pcorr|pctile|pentium|pergram|pergram_7|permute|permute_8|personal|peto_st|pkcollapse|pkcross|pkequiv|pkexamine|pkexamine_7|pkshape|pksumm|pksumm_7|pl|plo|plot|plugin|pnorm|pnorm_7|poisgof|poiss_lf|poiss_sw|poisso_p|poisson|poisson_estat|post|postclose|postfile|postutil|pperron|pr|prais|prais_e|prais_e2|prais_p|predict|predictnl|preserve|print|pro|prob|probi|probit|probit_estat|probit_p|proc_time|procoverlay|procrustes|procrustes_estat|procrustes_p|profiler|prog|progr|progra|program|prop|proportion|prtest|prtesti|pwcorr|pwd|q\s|qby|qbys|qchi|qchi_7|qladder|qladder_7|qnorm|qnorm_7|qqplot|qqplot_7|qreg|qreg_c|qreg_p|qreg_sw|qu|quadchk|quantile|quantile_7|que|quer|query|qui|quie|quiet|quietl|quietly|range|ranksum|ratio|rchart|rchart_7|rcof|recast|recode|reg|reg3|reg3_p|regdw|regr|regre|regre_p2|regres|regres_p|regress|regress_estat|regriv_p|remap|ren|rena|renam|rename|renpfix|repeat|replace|reshape|restore|ret|retu|retur|return|rmdir|robvar|roccomp|roccomp_7|roccomp_8|rocf_lf|rocfit|rocfit_8|rocgold|rocplot|rocplot_7|roctab|roctab_7|rolling|rologit|rologit_p|rot|rota|rotat|rotate|rotatemat|rreg|rreg_p|ru|run|runtest|rvfplot|rvfplot_7|rvpplot|rvpplot_7|sa|safesum|sample|sampsi|sav|save|savedresults|saveold|sc|sca|scal|scala|scalar|scatter|scm_mine|sco|scob_lf|scob_p|scobi_sw|scobit|scor|score|scoreplot|scoreplot_help|scree|screeplot|screeplot_help|sdtest|sdtesti|se|search|separate|seperate|serrbar|serrbar_7|serset|set|set_defaults|sfrancia|sh|she|shel|shell|shewhart|shewhart_7|signestimationsample|signrank|signtest|simul|simul_7|simulate|simulate_8|sktest|sleep|slogit|slogit_d2|slogit_p|smooth|snapspan|so|sor|sort|spearman|spikeplot|spikeplot_7|spikeplt|spline_x|split|sqreg|sqreg_p|sret|sretu|sretur|sreturn|ssc|st|st_ct|st_hc|st_hcd|st_hcd_sh|st_is|st_issys|st_note|st_promo|st_set|st_show|st_smpl|st_subid|stack|statsby|statsby_8|stbase|stci|stci_7|stcox|stcox_estat|stcox_fr|stcox_fr_ll|stcox_p|stcox_sw|stcoxkm|stcoxkm_7|stcstat|stcurv|stcurve|stcurve_7|stdes|stem|stepwise|stereg|stfill|stgen|stir|stjoin|stmc|stmh|stphplot|stphplot_7|stphtest|stphtest_7|stptime|strate|strate_7|streg|streg_sw|streset|sts|sts_7|stset|stsplit|stsum|sttocc|sttoct|stvary|stweib|su|suest|suest_8|sum|summ|summa|summar|summari|summariz|summarize|sunflower|sureg|survcurv|survsum|svar|svar_p|svmat|svy|svy_disp|svy_dreg|svy_est|svy_est_7|svy_estat|svy_get|svy_gnbreg_p|svy_head|svy_header|svy_heckman_p|svy_heckprob_p|svy_intreg_p|svy_ivreg_p|svy_logistic_p|svy_logit_p|svy_mlogit_p|svy_nbreg_p|svy_ologit_p|svy_oprobit_p|svy_poisson_p|svy_probit_p|svy_regress_p|svy_sub|svy_sub_7|svy_x|svy_x_7|svy_x_p|svydes|svydes_8|svygen|svygnbreg|svyheckman|svyheckprob|svyintreg|svyintreg_7|svyintrg|svyivreg|svylc|svylog_p|svylogit|svymarkout|svymarkout_8|svymean|svymlog|svymlogit|svynbreg|svyolog|svyologit|svyoprob|svyoprobit|svyopts|svypois|svypois_7|svypoisson|svyprobit|svyprobt|svyprop|svyprop_7|svyratio|svyreg|svyreg_p|svyregress|svyset|svyset_7|svyset_8|svytab|svytab_7|svytest|svytotal|sw|sw_8|swcnreg|swcox|swereg|swilk|swlogis|swlogit|swologit|swoprbt|swpois|swprobit|swqreg|swtobit|swweib|symmetry|symmi|symplot|symplot_7|syntax|sysdescribe|sysdir|sysuse|szroeter|ta|tab|tab1|tab2|tab_or|tabd|tabdi|tabdis|tabdisp|tabi|table|tabodds|tabodds_7|tabstat|tabu|tabul|tabula|tabulat|tabulate|te|tempfile|tempname|tempvar|tes|test|testnl|testparm|teststd|tetrachoric|time_it|timer|tis|tob|tobi|tobit|tobit_p|tobit_sw|token|tokeni|tokeniz|tokenize|tostring|total|translate|translator|transmap|treat_ll|treatr_p|treatreg|trim|trnb_cons|trnb_mean|trpoiss_d2|trunc_ll|truncr_p|truncreg|tsappend|tset|tsfill|tsline|tsline_ex|tsreport|tsrevar|tsrline|tsset|tssmooth|tsunab|ttest|ttesti|tut_chk|tut_wait|tutorial|tw|tware_st|two|twoway|twoway__fpfit_serset|twoway__function_gen|twoway__histogram_gen|twoway__ipoint_serset|twoway__ipoints_serset|twoway__kdensity_gen|twoway__lfit_serset|twoway__normgen_gen|twoway__pci_serset|twoway__qfit_serset|twoway__scatteri_serset|twoway__sunflower_gen|twoway_ksm_serset|ty|typ|type|typeof|u|unab|unabbrev|unabcmd|update|us|use|uselabel|var|var_mkcompanion|var_p|varbasic|varfcast|vargranger|varirf|varirf_add|varirf_cgraph|varirf_create|varirf_ctable|varirf_describe|varirf_dir|varirf_drop|varirf_erase|varirf_graph|varirf_ograph|varirf_rename|varirf_set|varirf_table|varlmar|varnorm|varsoc|varstable|varstable_w|varstable_w2|varwle|vce|vec|vec_fevd|vec_mkphi|vec_p|vec_p_w|vecirf_create|veclmar|veclmar_w|vecnorm|vecnorm_w|vecrank|vecstable|verinst|vers|versi|versio|version|view|viewsource|vif|vwls|wdatetof|webdescribe|webseek|webuse|weib1_lf|weib2_lf|weib_lf|weib_lf0|weibhet_glf|weibhet_glf_sh|weibhet_glfa|weibhet_glfa_sh|weibhet_gp|weibhet_ilf|weibhet_ilf_sh|weibhet_ilfa|weibhet_ilfa_sh|weibhet_ip|weibu_sw|weibul_p|weibull|weibull_c|weibull_s|weibullhet|wh|whelp|whi|which|whil|while|wilc_st|wilcoxon|win|wind|windo|window|winexec|wntestb|wntestb_7|wntestq|xchart|xchart_7|xcorr|xcorr_7|xi|xi_6|xmlsav|xmlsave|xmluse|xpose|xsh|xshe|xshel|xshell|xt_iis|xt_tis|xtab_p|xtabond|xtbin_p|xtclog|xtcloglog|xtcloglog_8|xtcloglog_d2|xtcloglog_pa_p|xtcloglog_re_p|xtcnt_p|xtcorr|xtdata|xtdes|xtfront_p|xtfrontier|xtgee|xtgee_elink|xtgee_estat|xtgee_makeivar|xtgee_p|xtgee_plink|xtgls|xtgls_p|xthaus|xthausman|xtht_p|xthtaylor|xtile|xtint_p|xtintreg|xtintreg_8|xtintreg_d2|xtintreg_p|xtivp_1|xtivp_2|xtivreg|xtline|xtline_ex|xtlogit|xtlogit_8|xtlogit_d2|xtlogit_fe_p|xtlogit_pa_p|xtlogit_re_p|xtmixed|xtmixed_estat|xtmixed_p|xtnb_fe|xtnb_lf|xtnbreg|xtnbreg_pa_p|xtnbreg_refe_p|xtpcse|xtpcse_p|xtpois|xtpoisson|xtpoisson_d2|xtpoisson_pa_p|xtpoisson_refe_p|xtpred|xtprobit|xtprobit_8|xtprobit_d2|xtprobit_re_p|xtps_fe|xtps_lf|xtps_ren|xtps_ren_8|xtrar_p|xtrc|xtrc_p|xtrchh|xtrefe_p|xtreg|xtreg_be|xtreg_fe|xtreg_ml|xtreg_pa_p|xtreg_re|xtregar|xtrere_p|xtset|xtsf_ll|xtsf_llti|xtsum|xttab|xttest0|xttobit|xttobit_8|xttobit_p|xttrans|yx|yxview__barlike_draw|yxview_area_draw|yxview_bar_draw|yxview_dot_draw|yxview_dropline_draw|yxview_function_draw|yxview_iarrow_draw|yxview_ilabels_draw|yxview_normal_draw|yxview_pcarrow_draw|yxview_pcbarrow_draw|yxview_pccapsym_draw|yxview_pcscatter_draw|yxview_pcspike_draw|yxview_rarea_draw|yxview_rbar_draw|yxview_rbarm_draw|yxview_rcap_draw|yxview_rcapsym_draw|yxview_rconnected_draw|yxview_rline_draw|yxview_rscatter_draw|yxview_rspike_draw|yxview_spike_draw|yxview_sunflower_draw|zap_s|zinb|zinb_llf|zinb_plf|zip|zip_llf|zip_p|zip_plf|zt_ct_5|zt_hc_5|zt_hcd_5|zt_is_5|zt_iss_5|zt_sho_5|zt_smp_5|ztbase_5|ztcox_5|ztdes_5|ztereg_5|ztfill_5|ztgen_5|ztir_5|ztjoin_5|ztnb|ztnb_p|ztp|ztp_p|zts_5|ztset_5|ztspli_5|ztsum_5|zttoct_5|ztvary_5|ztweib_5)\b 171 | name 172 | constant.language.stata 173 | 174 | 175 | repository 176 | 177 | commentblock 178 | 179 | begin 180 | /\* 181 | end 182 | \*/ 183 | patterns 184 | 185 | 186 | include 187 | #commentblock 188 | 189 | 190 | 191 | singlequote 192 | 193 | begin 194 | `(?!") 195 | end 196 | (?<!")' 197 | patterns 198 | 199 | 200 | include 201 | #compoundquote 202 | 203 | 204 | include 205 | #singlequote 206 | 207 | 208 | 209 | compoundquote 210 | 211 | begin 212 | `" 213 | end 214 | "' 215 | patterns 216 | 217 | 218 | include 219 | #compoundquote 220 | 221 | 222 | include 223 | #singlequote 224 | 225 | 226 | 227 | 228 | scopeName 229 | source.stata 230 | uuid 231 | C49120AC-6ECC-11D9-ACC8-000D93589AF6 232 | 233 | 234 | 235 | -------------------------------------------------------------------------------- /StataIndentation Rules.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Indentation Rules 7 | scope 8 | source.stata 9 | settings 10 | 11 | decreaseIndentPattern 12 | (?x) 13 | ^\s*\}\s*$ 14 | |^\s*end\s*$ 15 | 16 | increaseIndentPattern 17 | (?x) 18 | ^.*\{\s*$ 19 | |^mata\:$ 20 | |^\s*program\s*define.*$ 21 | 22 | indentParens 23 | 24 | 25 | uuid 26 | C49120AC-6ECC-11D9-ACC8-000D93589AF6 27 | 28 | 29 | -------------------------------------------------------------------------------- /Symbol List.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Symbols List 7 | scope 8 | comment.line.fakeheader.stata 9 | settings 10 | 11 | showInSymbolList 12 | 1 13 | 14 | 15 | -------------------------------------------------------------------------------- /messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "install": "messages/install.txt", 3 | "1.0.2": "messages/1.0.2.txt", 4 | "1.0.3": "messages/1.0.3.txt", 5 | "1.0.4": "messages/1.0.4.txt", 6 | "1.0.5": "messages/1.0.5.txt", 7 | "1.1.2": "messages/1.1.2.txt", 8 | "1.1.4": "messages/1.1.4.txt", 9 | "1.2.0": "messages/1.2.0.txt", 10 | "1.2.2": "messages/1.2.2.txt", 11 | "1.2.4": "messages/1.2.4.txt", 12 | "1.2.5": "messages/1.2.5.txt", 13 | "1.2.6": "messages/1.2.6.txt", 14 | "2.0.0": "messages/2.0.0.txt", 15 | "2.0.3": "messages/2.0.3.txt", 16 | "2.1.0": "messages/2.1.0.txt", 17 | "2.1.2": "messages/2.1.2.txt", 18 | "2.1.6": "messages/2.1.6.txt", 19 | "2.1.7": "messages/2.1.7.txt", 20 | "2.2.0": "messages/2.2.0.txt", 21 | "2.2.4": "messages/2.2.4.txt" 22 | } 23 | -------------------------------------------------------------------------------- /messages/1.0.2.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 1.0.2 3 | ---------------------- 4 | 5 | Fixes: 6 | * Build system now works on files with spaces in their names (thanks to @FichteFoll!) 7 | -------------------------------------------------------------------------------- /messages/1.0.3.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 1.0.3 3 | ---------------------- 4 | 5 | News: 6 | * Plugin is compatible with Sublime Text 3 7 | -------------------------------------------------------------------------------- /messages/1.0.4.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 1.0.4 3 | ---------------------- 4 | 5 | News: 6 | * Fixed issue with backslash in strings ("\"), thanks to @matthieugomez 7 | -------------------------------------------------------------------------------- /messages/1.0.5.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 1.0.5 3 | ---------------------- 4 | 5 | News: 6 | * Fixed issues with syntax highlighting in compound quotes, embedded single quotes, compound double quotes and comment blocks (thanks to @matthieugomez) 7 | -------------------------------------------------------------------------------- /messages/1.1.2.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 1.1.1 3 | ---------------------- 4 | 5 | New features: 6 | * Sublime Stata 13 now works with Stata 11 and 12 (contrary to its name)! Previous versions of Stata did not have good AppleScript support, so commands had to be copied into a temporary `.do` file and run indirectly. The latest version of this package keeps the nicer AppleScript support for Stata 13, but adds the temporary file-based system for previous versions. 7 | -------------------------------------------------------------------------------- /messages/1.1.4.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Stata Enhanced 1.1.4 3 | ---------------------- 4 | 5 | New features: 6 | * New name! The package is now called "Stata Enhanced" since it works with versions 11-13 7 | 8 | News: 9 | * Fixes lingering issues left over from renaming the package (I forgot to rename a few of the commands and paths) 10 | -------------------------------------------------------------------------------- /messages/1.2.0.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Stata Enhanced 1.2.0 3 | ---------------------- 4 | 5 | New features: 6 | 7 | * Inline comments! Stata ordinarily chokes on inline comments typed/pasted 8 | in the command window. Following the example of Emacs Ado-mode 9 | (http://louabill.org/Stata/ado-mode_install.html), this plugin will now 10 | strip all inline comments from the commands you send. 11 | 12 | So if you send 13 | 14 | display "Testing" // Inline comment here 15 | 16 | or 17 | 18 | display "Testing" /* Inline comment here*/ 19 | 20 | or even 21 | 22 | display /* random comment here */ "Testing" 23 | 24 | the plugin will only send this to Stata: 25 | 26 | display "Testing" 27 | -------------------------------------------------------------------------------- /messages/1.2.2.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Stata Enhanced 1.2.2 3 | ---------------------- 4 | 5 | News: 6 | * Focus returns to Sublime Text after sending a .do file to Stata 11-12 7 | -------------------------------------------------------------------------------- /messages/1.2.4.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Stata Enhanced 1.2.4 3 | ---------------------- 4 | 5 | News: 6 | * Properly handles all cases of `//` comments, URLs, and other commenting edge cases 7 | -------------------------------------------------------------------------------- /messages/1.2.5.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Stata Enhanced 1.2.5 3 | ---------------------- 4 | 5 | News: 6 | * Properly handles commands with `$`, such as `use "${input}/test.dta", clear` 7 | or `use "$dinput/test.dta", clear` (thanks to @cjjmeyer for finding this!) 8 | -------------------------------------------------------------------------------- /messages/1.2.6.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Stata Enhanced 1.2.6 3 | ---------------------- 4 | 5 | News: 6 | * Properly handles commands with `$` in both Stata 13 and Stata 11-12 7 | (thanks to @rangerqu for finding this!) 8 | -------------------------------------------------------------------------------- /messages/2.0.0.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 2.0.0 3 | ---------------------- 4 | 5 | New features: 6 | * Sublime Stata Enhanced now works on Windows! Thanks to [@tonijung](https://github.com/tonijung) for her testing and debugging help. Instructions for configuring the plugin to work on Windows are included in the README. If you run into any problems, please submit an issue at GitHub. 7 | -------------------------------------------------------------------------------- /messages/2.0.3.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 2.0.3 3 | ---------------------- 4 | 5 | Bug fixes: 6 | * Line continuation delimiters are removed properly (fixes #22) 7 | * Lines that contain \s now work properly 8 | -------------------------------------------------------------------------------- /messages/2.1.0.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 2.1.0 3 | ---------------------- 4 | 5 | New feature: 6 | * Comments that start with a # are now treated as a symbol. This means that 7 | you can make a comment like... 8 | 9 | *# This is a header 10 | 11 | or 12 | 13 | * # This is also a header 14 | 15 | ... and it will be listed in the Goto Symbol menu (⌘+R or ctrl+R). 16 | 17 | Thanks to @tedsvo for this feature! 18 | -------------------------------------------------------------------------------- /messages/2.1.2.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 2.1.2 3 | ---------------------- 4 | 5 | Enhancements: 6 | * `bysort` is now highlighted (thanks @Ufos92!) 7 | * Default and user settings and keybindings are now available from the 8 | Sublime Text preferences menu. In the past, I foolishly told people to 9 | edit Default (XXX).sublime-keymap to change the shortcut for the Stata 10 | 13+ or Stata < 13 commands, but every time this package updated, those 11 | modifications were overwritten. Now it's easier to get to "User/Default 12 | (XXX).sublime-keymap". 13 | -------------------------------------------------------------------------------- /messages/2.1.4.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 2.1.4 3 | ---------------------- 4 | 5 | Enhancements: 6 | * Add indentation rules (thanks @matthieugomez!) 7 | 8 | Fixes: 9 | * Remove errant comma in menu settings file (fixes #35; thanks @twolock!) 10 | * Properly handle lines with comments after line continuation characters (fixes #23; thanks @NilsEnevoldsen!) 11 | -------------------------------------------------------------------------------- /messages/2.1.6.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 2.1.6 3 | ---------------------- 4 | 5 | Enhancements: 6 | * OS X only: Add setting that lets Stata activate and take focus after 7 | sending a line or selection (`switch_focus_to_stata`). By default, 8 | Sublime Text will keep focus. (Thanks @nickeubank!) 9 | -------------------------------------------------------------------------------- /messages/2.1.7.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 2.1.7 3 | ---------------------- 4 | 5 | Enhancements: 6 | * Allow user to send entire file when attempting to send a selection with 7 | more than 8191 characters (fixes issue #34; thanks @elbersb!) 8 | -------------------------------------------------------------------------------- /messages/2.2.0.txt: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | Sublime Stata 13 2.2.0 3 | ---------------------- 4 | 5 | Enhancements (thanks to @elbersb)!: 6 | * Merge the two version-specific commands into one; this get rids of some 7 | of the required configuration (also fixes #43) 8 | * Build system now works on Windows as well; should work better on OS X 9 | (i.e., also for older versions of Stata) 10 | * Stata is found automatically on OS X; for OS X users, the plugin should 11 | now work without any configuration at all 12 | -------------------------------------------------------------------------------- /messages/2.2.4.txt: -------------------------------------------------------------------------------- 1 | ---------------------------- 2 | Sublime Stata Enhanced 2.2.4 3 | ---------------------------- 4 | 5 | Fixes: 6 | * Package should now work with Stata 15. 7 | -------------------------------------------------------------------------------- /messages/install.txt: -------------------------------------------------------------------------------- 1 | ---------------- 2 | Sublime Stata 13 3 | ---------------- 4 | 5 | Thanks for installing the Sublime Stata 13 plugin! 6 | 7 | 8 | ## ----------------------- IMPORTANT (for OS X) ----------------------- ## 9 | 10 | If you are using Stata **11*** or **12**, make sure that: 11 | 1. .do files are set to open in Stata by default in Finder 12 | 2. .do files are automatically run when opened in Stata: 13 | Change this in Preferences > Do-file Editor > Advanced > 14 | Edit do-files opened from the Finder in Do-file Editor (uncheck this) 15 | 16 | ## -------------------------------------------------------------------- ## 17 | 18 | 19 | ## ---------------------- IMPORTANT (for Windows) --------------------- ## 20 | 21 | Follow the instructions in the README file to configure this plugin 22 | to work with your installation of Stata. 23 | 24 | Quickstart: 25 | 1. Set the `stata_name` variable in the `.sublime-settings` file to 26 | the *full path* of your Stata executable, with slashes *reversed* 27 | (e.g. "C:/Program Files (x86)/Stata13/StataSE-64.exe") 28 | 2. Make sure that .do files are automatically run when opened in Stata: 29 | Change this in Do-file Editor > Edit > Preferences > Advanced > 30 | Edit do-files opened from Windows instead of executing them (uncheck this) 31 | 32 | ## -------------------------------------------------------------------- ## 33 | -------------------------------------------------------------------------------- /stata-send-command-move-next-line.sublime-macro: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "command": "text_2_stata" 4 | }, 5 | { 6 | "args": 7 | { 8 | "by": "lines", 9 | "forward": true 10 | }, 11 | "command": "move" 12 | }, 13 | { 14 | "args": 15 | { 16 | "to": "hardbol" 17 | }, 18 | "command": "move_to" 19 | } 20 | ] 21 | -------------------------------------------------------------------------------- /text_2_stata.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sublime_plugin 3 | import sublime 4 | import re 5 | import subprocess 6 | 7 | settingsfile = "Stata Enhanced.sublime-settings" 8 | 9 | def strip_inline_comments(text): 10 | # This is really brute force and hackish. Ideally we could use ST scopes to 11 | # only remove comments instead of trying to parse everything with regex 12 | # (since there will inevitably be edge cases that should/shouldn't be 13 | # removed). ST kind of has that functionality: 14 | # self.view.find_by_selector('comment') 15 | # But this is a good stopgap for now. 16 | clean = text 17 | 18 | # Take care of line continuation 19 | clean = re.sub("/{3,}.*\\n", " ", clean) 20 | 21 | # Remove /* ... */ comments (handles multiple lines) + // comments 22 | # 23 | # Bonus! Handles these cases correctly: 24 | # * "This is a /* string */" 25 | # * "This is // also a string" 26 | # * "URLs work too. http://www.example.com" 27 | # 28 | # Code adapted from http://stackoverflow.com/a/18381470/120898 29 | def remove_comments(string): 30 | pattern = r"(\".*?(?= 13: 117 | cmd = """osascript<< END 118 | tell application id "{}" 119 | {} 120 | DoCommandAsync "do \\\"{}\\\"" with addToReview 121 | end tell 122 | END""".format(stata_app_id, switch_focus, file_name) 123 | os.system(cmd) 124 | elif sublime.platform() == "osx" and version <= 12: 125 | # Get ST version for returning focus to ST 126 | if int(sublime.version()) > 3000: 127 | st_name = "Sublime Text" 128 | else: 129 | st_name = "Sublime Text 2" 130 | 131 | cmd = """osascript -e 'tell application "Finder" to open POSIX file "{0}"' -e 'tell application "{1}" to activate' &""".format(file_name, st_name) 132 | os.system(cmd) 133 | elif sublime.platform() == "windows": 134 | filepath = os.path.dirname(file_name) 135 | 136 | vbs_cmd = """CreateObject("WScript.Shell").Run \"\""{0}\"" \""{1}\"\"", 4, false """.format(settings.get('stata_name'), file_name) 137 | 138 | vbs_path = os.path.join(filepath, 'open_in_stata.vbs') 139 | vbs_file = open(vbs_path, 'w') 140 | vbs_file.write(vbs_cmd) 141 | vbs_file.close() 142 | 143 | cmd = "cscript.exe {0}".format("\"" + vbs_path + "\"") 144 | os.system(cmd) 145 | os.remove(vbs_path) 146 | 147 | class text_2_stataCommand(sublime_plugin.TextCommand): 148 | """ Run selection or current line *directly* in Stata""" 149 | 150 | def run(self, edit): 151 | settings = sublime.load_settings(settingsfile) 152 | 153 | # Get the selection; if nothing is selected, get the current line 154 | all_text = "" 155 | sels = self.view.sel() 156 | for sel in sels: 157 | all_text = all_text + self.view.substr(sel) 158 | if len(all_text) == 0: 159 | all_text = self.view.substr(self.view.line(sel)) 160 | all_text = all_text + "\n" 161 | 162 | # Get rid of inline comments 163 | all_text = strip_inline_comments(all_text) 164 | 165 | # Switch focus to Stata or not after sending a command depending on a setting 166 | if settings.get('switch_focus_to_stata'): 167 | switch_focus = "activate" 168 | else: 169 | switch_focus = "" 170 | 171 | if sublime.platform() == "osx": 172 | version, stata_app_id = get_stata_version(settings.get('stata_name')) 173 | 174 | if sublime.platform() == "osx" and version >= 13: 175 | all_text = all_text.replace('\\', '\\\\\\').replace('"', '\\"'). \ 176 | replace('`', '\\`').replace('$', "\\$").strip() 177 | 178 | # Stata only allows 8192 characters. 179 | if len(all_text)<8192: 180 | # Send the command to Stata with AppleScript 181 | cmd = """osascript<< END 182 | tell application id "{}" 183 | {} 184 | DoCommandAsync "{}" with addToReview 185 | end tell 186 | END""".format(stata_app_id, switch_focus, all_text) 187 | print(cmd) 188 | os.system(cmd) 189 | else: 190 | if sublime.ok_cancel_dialog("This selection is too long to run.\n\nWould you like to run the whole do file?", "Run complete file"): 191 | self.view.window().run_command("stata_run_complete") 192 | 193 | elif sublime.platform() == "osx" and version <= 12: 194 | # Get the path to the current file 195 | filename = self.view.file_name() 196 | filepath = os.path.dirname(filename) 197 | 198 | # Write the selection to a temporary file in the current directory 199 | dofile_path = os.path.join(filepath, 'sublime2stata.do') 200 | this_file = open(dofile_path, 'w') 201 | this_file.write(all_text) 202 | this_file.close() 203 | 204 | # Get ST version for returning focus to ST 205 | if int(sublime.version()) > 3000: 206 | st_name = "Sublime Text" 207 | else: 208 | st_name = "Sublime Text 2" 209 | 210 | cmd = """osascript -e 'tell application "Finder" to open POSIX file "{0}"' -e 'tell application "{1}" to activate' &""".format(dofile_path, st_name) 211 | os.system(cmd) 212 | 213 | elif sublime.platform() == "windows": 214 | # Get the path to the current file 215 | filename = self.view.file_name() 216 | filepath = os.path.dirname(filename) 217 | 218 | # Write the selection to a temporary file in the current directory 219 | dofile_path = os.path.join(filepath, 'sublime2stata.do') 220 | this_file = open(dofile_path, 'w') 221 | this_file.write(all_text) 222 | this_file.close() 223 | 224 | vbs_cmd = """CreateObject("WScript.Shell").Run \"\""{0}\"" \""{1}\"\"", 4, false """.format(settings.get('stata_name'), dofile_path) 225 | 226 | vbs_path = os.path.join(filepath, 'open_in_stata.vbs') 227 | vbs_file = open(vbs_path, 'w') 228 | vbs_file.write(vbs_cmd) 229 | vbs_file.close() 230 | 231 | cmd = "cscript.exe {0}".format("\"" + vbs_path + "\"") 232 | os.system(cmd) 233 | os.remove(vbs_path) 234 | --------------------------------------------------------------------------------