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