parent
eeb6a677eb
commit
fa5f7908d4
|
@ -6,7 +6,6 @@ class DirBuffer(Buffer):
|
||||||
def __init__(self, path, name=None):
|
def __init__(self, path, name=None):
|
||||||
Buffer.__init__(self)
|
Buffer.__init__(self)
|
||||||
self.path = os.path.realpath(path)
|
self.path = os.path.realpath(path)
|
||||||
|
|
||||||
self.settings['hide-dot'] = True
|
self.settings['hide-dot'] = True
|
||||||
self.settings['type-sort'] = False
|
self.settings['type-sort'] = False
|
||||||
def changed(self):
|
def changed(self):
|
||||||
|
@ -74,6 +73,8 @@ class PathListBuffer(DirBuffer):
|
||||||
self.paths = list(paths)
|
self.paths = list(paths)
|
||||||
self.path = os.getcwd()
|
self.path = os.getcwd()
|
||||||
self._name = name
|
self._name = name
|
||||||
|
self.settings['hide-dot'] = False
|
||||||
|
self.settings['type-sort'] = False
|
||||||
def path_exists(self):
|
def path_exists(self):
|
||||||
raise Exception
|
raise Exception
|
||||||
def _get_names(self):
|
def _get_names(self):
|
||||||
|
|
|
@ -94,7 +94,6 @@ class DirCmd(Method):
|
||||||
(status, output) = commands.getstatusoutput(cmd)
|
(status, output) = commands.getstatusoutput(cmd)
|
||||||
if status != 0:
|
if status != 0:
|
||||||
w.set_error("%s failed (exit %d)" % (self.name, status))
|
w.set_error("%s failed (exit %d)" % (self.name, status))
|
||||||
#w.application.methods['refresh-view'].execute(w, filename=path)
|
|
||||||
dirutil.find_name(w, basename)
|
dirutil.find_name(w, basename)
|
||||||
|
|
||||||
class Chmod(DirCmd):
|
class Chmod(DirCmd):
|
||||||
|
@ -111,7 +110,6 @@ class Chmod(DirCmd):
|
||||||
else:
|
else:
|
||||||
w.set_error("Not a valid mode: %r" % vargs['mode'])
|
w.set_error("Not a valid mode: %r" % vargs['mode'])
|
||||||
self._run(w, **vargs)
|
self._run(w, **vargs)
|
||||||
|
|
||||||
class Chown(DirCmd):
|
class Chown(DirCmd):
|
||||||
args = [Argument('owner', type=type(''), prompt="New Owner: ")]
|
args = [Argument('owner', type=type(''), prompt="New Owner: ")]
|
||||||
def _make_cmd(self, w, path, **vargs):
|
def _make_cmd(self, w, path, **vargs):
|
||||||
|
|
|
@ -39,16 +39,18 @@ class StringGrammar4(Grammar):
|
||||||
|
|
||||||
class PythonGrammar(Grammar):
|
class PythonGrammar(Grammar):
|
||||||
rules = [
|
rules = [
|
||||||
PatternRule('functionname', '(?<=def )[a-zA-Z_][a-zA-Z0-9_]*'),
|
PatternRule('python.def', '(?<=def )[a-zA-Z_][a-zA-Z0-9_]*'),
|
||||||
PatternRule('classname', '(?<=class )[a-zA-Z_][a-zA-Z0-9_]*'),
|
PatternRule('python.class', '(?<=class )[a-zA-Z_][a-zA-Z0-9_]*'),
|
||||||
PatternRule('python.reserved', '(?:True|None|False|Exception|self)(?![a-zA-Z0-9_])'),
|
PatternRule('python.reserved', '(?:True|None|False|Exception|self)(?![a-zA-Z0-9_])'),
|
||||||
PatternRule('python.keyword', '(?:yield|with|while|try|return|raise|print|pass|or|not|lambda|is|in|import|if|global|from|for|finally|exec|except|else|elif|del|def|continue|class|break|assert|as|and)(?![a-zA-Z0-9_])'),
|
PatternRule('python.keyword', '(?:yield|with|while|try|return|raise|print|pass|or|not|lambda|is|in|import|if|global|from|for|finally|exec|except|else|elif|del|def|continue|class|break|assert|as|and)(?![a-zA-Z0-9_])'),
|
||||||
PatternRule(r"python.builtin", r'(?<!\.)(?:zip|xrange|vars|unicode|unichr|type|tuple|super|sum|str|staticmethod|sorted|slice|setattr|set|round|repr|reduce|raw_input|range|property|pow|ord|open|oct|object|max|min|map|long|locals|list|len|iter|issubclass|isinstance|int|input|id|hex|hash|hasattr|globals|getattr|frozenset|float|filter|file|execfile|eval|enumerate|divmod|dir|dict|delattr|complex|compile|coerce|cmp|classmethod|chr|callable|bool)(?![a-zA-Z0-9_])'),
|
PatternRule(r"python.builtin", r'(?<!\.)(?:zip|xrange|vars|unicode|unichr|type|tuple|super|sum|str|staticmethod|sorted|slice|setattr|set|round|repr|reduce|raw_input|range|property|pow|ord|open|oct|object|max|min|map|long|locals|list|len|iter|issubclass|isinstance|int|input|id|hex|hash|hasattr|globals|getattr|frozenset|float|filter|file|execfile|eval|enumerate|divmod|dir|dict|delattr|complex|compile|coerce|cmp|classmethod|chr|callable|bool)(?![a-zA-Z0-9_])'),
|
||||||
PatternRule('methodcall', r'(?<=\. )[a-zA-Z_][a-zA-Z0-9_]*(?= *\()'),
|
PatternRule('python.method', r'(?<=\. )[a-zA-Z_][a-zA-Z0-9_]*(?= *\()'),
|
||||||
PatternRule('functioncall', r'[a-zA-Z_][a-zA-Z0-9_]*(?= *\()'),
|
PatternRule('python.function', r'[a-zA-Z_][a-zA-Z0-9_]*(?= *\()'),
|
||||||
PatternRule('system_identifier', '__[a-zA-Z0-9_]+__'),
|
|
||||||
PatternRule('private_identifier', '__[a-zA-Z0-9_]*'),
|
PatternRule('python.system_identifier', '__[a-zA-Z0-9_]+__'),
|
||||||
PatternRule('hidden_identifier', '_[a-zA-Z0-9_]*'),
|
PatternRule('python.private_identifier', '__[a-zA-Z0-9_]*'),
|
||||||
|
PatternRule('python.hidden_identifier', '_[a-zA-Z0-9_]*'),
|
||||||
|
PatternRule('python.identifier', '[a-zA-Z_][a-zA-Z0-9_]*'),
|
||||||
|
|
||||||
RegionRule('rawstring', 'r"""', StringGrammar4, '"""'),
|
RegionRule('rawstring', 'r"""', StringGrammar4, '"""'),
|
||||||
RegionRule('rawstring', "r'''", StringGrammar3, "'''"),
|
RegionRule('rawstring', "r'''", StringGrammar3, "'''"),
|
||||||
|
@ -59,13 +61,12 @@ class PythonGrammar(Grammar):
|
||||||
RegionRule('string', 'u?"', StringGrammar2, '"'),
|
RegionRule('string', 'u?"', StringGrammar2, '"'),
|
||||||
RegionRule('string', "u?'", StringGrammar1, "'"),
|
RegionRule('string', "u?'", StringGrammar1, "'"),
|
||||||
|
|
||||||
PatternRule('identifier', '[a-zA-Z_][a-zA-Z0-9_]*'),
|
|
||||||
PatternRule('delimiter', r'\(|\)|\[|\]|{|}|@|,|:|\.|`|=|;|\+=|-=|\*=|/=|//=|%=|&=|\|=|\^=|>>=|<<=|\*\*='),
|
PatternRule('delimiter', r'\(|\)|\[|\]|{|}|@|,|:|\.|`|=|;|\+=|-=|\*=|/=|//=|%=|&=|\|=|\^=|>>=|<<=|\*\*='),
|
||||||
PatternRule(r"integer", r"(?<![\.0-9a-zA-Z_])(?:0|-?[1-9][0-9]*|0[0-7]+|0[xX][0-9a-fA-F]+)[lL]?(?![\.0-9a-zA-Z_])"),
|
PatternRule(r"python.integer", r"(?<![\.0-9a-zA-Z_])(?:0|-?[1-9][0-9]*|0[0-7]+|0[xX][0-9a-fA-F]+)[lL]?(?![\.0-9a-zA-Z_])"),
|
||||||
PatternRule(r"float", r"(?<![\.0-9a-zA-Z_])(?:-?[0-9]+\.[0-9]*|-?\.[0-9]+|(?:[0-9]|[0-9]+\.[0-9]*|-?\.[0-9]+)[eE][\+-]?[0-9]+)(?![\.0-9a-zA-Z_])"),
|
PatternRule(r"python.float", r"(?<![\.0-9a-zA-Z_])(?:-?[0-9]+\.[0-9]*|-?\.[0-9]+|(?:[0-9]|[0-9]+\.[0-9]*|-?\.[0-9]+)[eE][\+-]?[0-9]+)(?![\.0-9a-zA-Z_])"),
|
||||||
PatternRule(r"imaginary", r"(?<![\.0-9a-zA-Z_])(?:[0-9]+|(?:[0-9]+\.[0-9]*|\.[0-9]+|(?:[0-9]|[0-9]+\.[0-9]*|\.[0-9]+)[eE][\+-]?[0-9]+)[jJ])(?![\.0-9a-zA-Z_])"),
|
PatternRule(r"python.imaginary", r"(?<![\.0-9a-zA-Z_])(?:[0-9]+|(?:[0-9]+\.[0-9]*|\.[0-9]+|(?:[0-9]|[0-9]+\.[0-9]*|\.[0-9]+)[eE][\+-]?[0-9]+)[jJ])(?![\.0-9a-zA-Z_])"),
|
||||||
|
|
||||||
PatternRule(r"operator", r"\+|<>|<<|<=|<|-|>>|>=|>|\*\*|&|\*|\||/|\^|==|//|~|!=|%"),
|
PatternRule(r"python.operator", r"\+|<>|<<|<=|<|-|>>|>=|>|\*\*|&|\*|\||/|\^|==|//|~|!=|%"),
|
||||||
|
|
||||||
OverridePatternRule('comment', '#@@:(?P<token>[.a-zA-Z0-9_]+):(?P<mode>[.a-zA-Z0-9_]+) *$'),
|
OverridePatternRule('comment', '#@@:(?P<token>[.a-zA-Z0-9_]+):(?P<mode>[.a-zA-Z0-9_]+) *$'),
|
||||||
PatternRule('comment', '#.*$'),
|
PatternRule('comment', '#.*$'),
|
||||||
|
@ -439,11 +440,11 @@ class PythonContext(context.Context):
|
||||||
class_match = And(Optional(Name('spaces')),
|
class_match = And(Optional(Name('spaces')),
|
||||||
Match('python.keyword', 'class'),
|
Match('python.keyword', 'class'),
|
||||||
Name('spaces'),
|
Name('spaces'),
|
||||||
Name('classname'))
|
Name('python.class'))
|
||||||
func_match = And(Optional(Name('spaces')),
|
func_match = And(Optional(Name('spaces')),
|
||||||
Match('python.keyword', 'def'),
|
Match('python.keyword', 'def'),
|
||||||
Name('spaces'),
|
Name('spaces'),
|
||||||
Name('functionname'))
|
Name('python.def'))
|
||||||
def __init__(self, mode):
|
def __init__(self, mode):
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.names = None
|
self.names = None
|
||||||
|
@ -556,18 +557,26 @@ class Python(mode.Fundamental):
|
||||||
closetags = {')': '(', ']': '[', '}': '{'}
|
closetags = {')': '(', ']': '[', '}': '{'}
|
||||||
commentc = '#'
|
commentc = '#'
|
||||||
colors = {
|
colors = {
|
||||||
'python.keyword': ('cyan', 'default', 'bold'),
|
'python.def': ('blue', 'default', 'bold'),
|
||||||
|
'python.class': ('yellow', 'default', 'bold'),
|
||||||
'python.reserved': ('magenta', 'default', 'bold'),
|
'python.reserved': ('magenta', 'default', 'bold'),
|
||||||
|
'python.keyword': ('cyan', 'default', 'bold'),
|
||||||
'python.builtin': ('cyan', 'default', 'bold'),
|
'python.builtin': ('cyan', 'default', 'bold'),
|
||||||
'functionname': ('blue', 'default', 'bold'),
|
'python.method': ('default', 'default'),
|
||||||
#'classname': ('green', 'default', 'bold'),
|
'python.function': ('default', 'default'),
|
||||||
'classname': ('yellow', 'default', 'bold'),
|
'python.system_identifier': ('cyan', 'default', 'bold'),
|
||||||
|
'python.private_identifier': ('default', 'default'),
|
||||||
|
'python.hidden_identifier': ('default', 'default'),
|
||||||
|
'python.identifier': ('default', 'default'),
|
||||||
|
'python.integer': ('default', 'default'),
|
||||||
|
'python.float': ('default', 'default'),
|
||||||
|
'python.imaginary': ('default', 'default'),
|
||||||
|
'python.operator': ('default', 'default'),
|
||||||
'rawstring.start': ('green', 'default', 'bold'),
|
'rawstring.start': ('green', 'default', 'bold'),
|
||||||
'rawstring.data': ('green', 'default', 'bold'),
|
'rawstring.data': ('green', 'default', 'bold'),
|
||||||
'rawstring.null': ('green', 'default', 'bold'),
|
'rawstring.null': ('green', 'default', 'bold'),
|
||||||
'rawstring.escaped': ('magenta', 'default', 'bold'),
|
'rawstring.escaped': ('magenta', 'default', 'bold'),
|
||||||
'rawstring.end': ('green', 'default', 'bold'),
|
'rawstring.end': ('green', 'default', 'bold'),
|
||||||
'system_identifier': ('cyan', 'default', 'bold'),
|
|
||||||
}
|
}
|
||||||
config = {
|
config = {
|
||||||
'python.lib': '.',
|
'python.lib': '.',
|
||||||
|
@ -586,7 +595,6 @@ class Python(mode.Fundamental):
|
||||||
"pythonclass": PythonClassCompleter(None),
|
"pythonclass": PythonClassCompleter(None),
|
||||||
}
|
}
|
||||||
|
|
||||||
#format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(mark)s %(perc)s [%(name)s] %(vc-info)s"
|
|
||||||
format = "%(flag)s %(bname)s (%(mname)s) %(indent)s %(cursor)s %(perc)s [%(name)s] %(vc-info)s"
|
format = "%(flag)s %(bname)s (%(mname)s) %(indent)s %(cursor)s %(perc)s [%(name)s] %(vc-info)s"
|
||||||
header_size = 3
|
header_size = 3
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue