parent
dd91be6169
commit
eb087a4e94
17
mode/sh.py
17
mode/sh.py
|
@ -3,6 +3,7 @@ from tab import StackTabber
|
|||
from mode import Fundamental
|
||||
from lex import Grammar, PatternRule, RegionRule, PatternMatchRule, OverridePatternRule
|
||||
from method import Method
|
||||
from method.shell import Interact
|
||||
|
||||
char = '[a-zA-Z0-9_]'
|
||||
word = char + '+'
|
||||
|
@ -170,6 +171,20 @@ class ShCheckSyntax(Method):
|
|||
else:
|
||||
app.data_buffer("*Sh-Check-Syntax*", output)
|
||||
|
||||
class BashStart(Interact):
|
||||
args = []
|
||||
reuse = True
|
||||
def _execute(self, w, **vargs):
|
||||
Interact._execute(self, w, bname='*Bash*', cmd='bash')
|
||||
class BashLoadFile(Interact):
|
||||
args = []
|
||||
reuse = True
|
||||
def _execute(self, w, **vargs):
|
||||
path = w.buffer.path
|
||||
cmd = 'bash %r' % path
|
||||
Interact._execute(self, w, bname='*Bash*', cmd=cmd)
|
||||
b = w.application.get_buffer_by_name('*Bash*')
|
||||
|
||||
class Sh(Fundamental):
|
||||
name = 'sh'
|
||||
paths = ['/etc/profile']
|
||||
|
@ -213,7 +228,7 @@ class Sh(Fundamental):
|
|||
'neval.null': ('cyan', 'default', 'bold'),
|
||||
'neval.end': ('yellow', 'default', 'bold'),
|
||||
}
|
||||
actions = [ShCheckSyntax]
|
||||
actions = [ShCheckSyntax, BashStart, BashLoadFile]
|
||||
_bindings = {
|
||||
'sh-check-syntax': ('C-c s',),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue