NOTE: if you plan to use it, see better plugin bellow
- Code: Select all
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
and binding:
- Code: Select all
<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:
- Code: Select all
$x=0
$x++
$x++
...
or
- Code: Select all
$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.