i was amazed from EJ12N screen cast and tried to implement the exec python myself, to see how far can i take it. well i came up with this:
NOTE: if you plan to use it, see better plugin bellow
[code]from math import *
from random import *
import sublime, sublimeplugin
class MiniPyCommand(sublimeplugin.TextCommand):
def run(self, view, args):
script = “”
for region in view.sel():
script = view.substr(region)
view.replace(region, str(eval(script)))
def isEnabled(self, view, args):
return True[/code]
and binding: <binding key="ctrl+e" command="miniPy"/>
so, just ctrl+e on a selected text, and tada! THANKS EJ12N !!!
anyway, i write this here because of my limited python knowledge. i thought it would be really nice if i could do something like:
$x=0
$x++
$x++
...
or
$x = "a."
$x".my_class"
etc. any idea how to implement it? if at all?
to be clear i want use variables which will be alive on this mini program, i chose to mark it with $ but that just an idea
ideas/help will be appreciated
vim.