Adding a plugin to Sublime Text 3 - python

My ultimate goal is to be able to execute a single or few lines of code in sublime text 3. I found this partial solution:
Build just one line in Sublime Text 3 - python
The highest rated answer provides a plugin code, but does not explain how to configure a plugin in sublime text editor. I created the code in a plugin file, but not clear how to activate. It says "Hint, make sure python is available on the sublime Text process"- if that means anything.
Any help would be great. Thanks!

Related

How to run code directly from python interpreter in Sublime Text 2?

I'm running a python script using Sublime Text 2. To run the script, I use command B--this works great until I want to explore some variable by typing it into the python interpreter, as the interpreter does not appear to be interactive. Is there any way to be able to input code into Sublime Text 2's interpreter in order to test ideas and code snippets before I add them to the main script?
I don't think sublime support it. I know you can use SublimeREPL when you need pass some users inputs.

Sublime Editor 2: Key-bindings to send command to terminal

I'm very new to Sublime and advanced text editors to be honest and any help/straightening up would be appreciated.
I'd like to set up a key-binding in Sublime Editor 2 that executes a command in Terminal inserting the current file name.
Specifically, I'd like to execute an Rscript that will render the markdown I am working on, i.e. Execute the following file in Terminal (replacing FILE with the filename Sublime is focused on).
Rscript -e "library(rmarkdown);render(*FILE*, "pdf_document")"
I've found a subprocess call that should send a command like this to Terminal.app, but I don't know how to integrate it with Sublime
subprocess.call(['osascript', '-e', 'tell app "Terminal" to do script "Rscript -e "library(rmarkdown);render(*FILE*, "pdf_document")" in window 1'])
Any help or advice would me much appreciated! Thank you!
I'd highly recommend checking out the R-Box plugin from Package Control for working with R. Like many packages, most of the active development work is occurring on the Sublime Text 3 version, so unless there is a really compelling reason to stay with ST2 I strongly suggest you upgrade. There are quite a few reasons to upgrade, which I won't get into here, but suffice it to say that ST3 is fast, stable, and perfectly useable for anyone, and most of all for this particular situations, contains many behind-the-scenes enhancements allowing plugins to do more than ever before.

Sublime Text remove python new property autocomplete

I love sublime text. I know that I can disable autocomplete altogether in the settings, however I just want to disable one of the autocomplete options.
When you type an #property decorator in python you get an autocomplete option called New Property which if selected generates a getter and setter for you. This ends up being more of a pain than a benefit for me. Any ideas about how to remove that autocomplete option?
Sublime Text 2
You can remove Packages/Python/New-Property.sublime-snippet. The Packages directory location depends on the system you are using:
Windows: %APPDATA%\Sublime Text 2\Packages
Linux: ~/.config/sublime-text-2/Packages
OS X: ~/Library/Application Support/Sublime Text 2/Packages
Sublime Text 3
The structure is a little different in Sublime Text 3. Personally I don't use it yet, but this might give you some idea about how to achieve the same result in ST3.
By the way, these solutions are not ideal. When you reinstall or upgrade Sublime Text the snippet will be back. But I'm not aware of any way to disable snippet via user config.

Execute a python script from sublime text 2

I have been learning python since last week weeks. I am using sublime text2 editor.
I have a simple file which prints some small text. How do I run this?
I have tried using ctrl+B but it only builds the file. How can I execute it?
You can accept user input in Sublime Text with SublimeREPL module. Install it via package control.

Sublime Text 2 - running selected python code in the interpreter

While editing a python script in the Sublime Text editor, I would like to run the script line by line, or block after block in the embedded interpreter.
Is there a convenient way how to do that? Perfect way for me would be:
select a few lines of code
hit a shortcut, which will run the selected code inside the interpreter
There are two choices I think, one can be using PdbSublimeTextSupport, available here: http://pypi.python.org/pypi/PdbSublimeTextSupport
Or you can try SublimeREPL, that can run Python code: https://github.com/wuub/SublimeREPL

Categories

Resources