Last active
August 17, 2019 00:34
-
-
Save flacle/28a8880d97b22efc12219b9e67d27c72 to your computer and use it in GitHub Desktop.
Quick and Dirty Python 2.7 in Sublime Text 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{"keys": ["shift+ctrl+alt+b"], "command": "repl_open", | |
"caption": "Python2 - RUN current file", | |
"id": "repl_python2_run", | |
"mnemonic": "R", | |
"args": { | |
"type": "subprocess", | |
"encoding": "utf8", | |
"cmd": ["/Users/your-name-here/anaconda/envs/python2/bin/python", "-u", "$file_basename"], | |
"cwd": "$file_path", | |
"syntax": "Packages/Python/Python.tmLanguage", | |
"external_id": "python2" | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can copy and paste this Gist when you want to easily add a keyboard shortcut to execute scripts in a different version of Python with the package SublimeREPL. In this case, Python 2.7. Here I'm using Anaconda with a different environment for hosting Python 2.7. I also didn't see the need to edit the configuration of SublimeREPL to add a custom menu item for Python 2.7 in the user interface.
You can paste this Gist in Sublime -> Preferences -> Key Bindings -> Default (OSX).sublime-keymap -- User. Change your-name-here to your actual account name on the OS.
Note: Key bindings do not work when removing "encoding": "utf8" from the arguments list. Copy & paste as is for a first try