parent
350d9b6cc5
commit
81de411291
|
@ -140,10 +140,15 @@ class Interact(Method):
|
||||||
args = [arg('bname', dt="str", p="Buffer Name: ", dv=lambda w: '*Interact*'),
|
args = [arg('bname', dt="str", p="Buffer Name: ", dv=lambda w: '*Interact*'),
|
||||||
arg('cmd', dt="shell", p="Command: ", dv=lambda w: 'bash')]
|
arg('cmd', dt="shell", p="Command: ", dv=lambda w: 'bash')]
|
||||||
modename = None
|
modename = None
|
||||||
|
reuse = False
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
bname = vargs['bname']
|
bname = vargs['bname']
|
||||||
cmd = vargs['cmd']
|
cmd = vargs['cmd']
|
||||||
a = w.application
|
a = w.application
|
||||||
|
if self.reuse and a.has_buffer_name(bname):
|
||||||
|
a.switch_buffer(a.get_buffer_by_name(bname))
|
||||||
|
return
|
||||||
|
|
||||||
a.close_buffer_by_name(bname)
|
a.close_buffer_by_name(bname)
|
||||||
b = XTermBuffer(a, 'bash', ['-c', cmd], name=bname,
|
b = XTermBuffer(a, 'bash', ['-c', cmd], name=bname,
|
||||||
modename=self.modename)
|
modename=self.modename)
|
||||||
|
|
17
mode/lua.py
17
mode/lua.py
|
@ -50,23 +50,16 @@ class LuaCheckSyntax(Method):
|
||||||
class LuaStart(Interact):
|
class LuaStart(Interact):
|
||||||
args = []
|
args = []
|
||||||
modename = 'luapipe'
|
modename = 'luapipe'
|
||||||
|
reuse = True
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
a = w.application
|
Interact._execute(self, w, bname='*Lua*', cmd='lua')
|
||||||
if a.has_buffer_name('*Lua*'):
|
|
||||||
a.switch_buffer(a.get_buffer_by_name('*Lua*'))
|
|
||||||
else:
|
|
||||||
Interact._execute(self, w, bname='*Lua*', cmd='lua')
|
|
||||||
class LuaLoadFile(Interact):
|
class LuaLoadFile(Interact):
|
||||||
args = []
|
args = []
|
||||||
modename = 'luapipe'
|
modename = 'luapipe'
|
||||||
|
reuse = True
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
a = w.application
|
Interact._execute(self, w, bname='*Lua*', cmd='lua')
|
||||||
if a.has_buffer_name('*Lua*'):
|
b = w.application.get_buffer_by_name('*Lua*')
|
||||||
b = a.get_buffer_by_name('*Lua*')
|
|
||||||
a.switch_buffer(b)
|
|
||||||
else:
|
|
||||||
Interact._execute(self, w, bname='*Lua*', cmd='lua')
|
|
||||||
b = a.get_buffer_by_name('*Lua*')
|
|
||||||
path = w.buffer.path
|
path = w.buffer.path
|
||||||
b.pipe_write('dofile("' + path + '");\n')
|
b.pipe_write('dofile("' + path + '");\n')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue