mirror of https://github.com/akelge/zsh
New version of files.
Full Vim support Support for MacVim This time it is correct
This commit is contained in:
parent
1adfd6ab9a
commit
fa62ff9b67
|
@ -0,0 +1,599 @@
|
||||||
|
"pythoncomplete.vim - Omni Completion for python
|
||||||
|
" Maintainer: Aaron Griffin <aaronmgriffin@gmail.com>
|
||||||
|
" Version: 0.7
|
||||||
|
" Last Updated: 19 Oct 2006
|
||||||
|
"
|
||||||
|
" Changes
|
||||||
|
" TODO:
|
||||||
|
" User defined docstrings aren't handled right...
|
||||||
|
" 'info' item output can use some formatting work
|
||||||
|
" Add an "unsafe eval" mode, to allow for return type evaluation
|
||||||
|
" Complete basic syntax along with import statements
|
||||||
|
" i.e. "import url<c-x,c-o>"
|
||||||
|
" Continue parsing on invalid line??
|
||||||
|
"
|
||||||
|
" v 0.7
|
||||||
|
" * Fixed function list sorting (_ and __ at the bottom)
|
||||||
|
" * Removed newline removal from docs. It appears vim handles these better in
|
||||||
|
" recent patches
|
||||||
|
"
|
||||||
|
" v 0.6:
|
||||||
|
" * Fixed argument completion
|
||||||
|
" * Removed the 'kind' completions, as they are better indicated
|
||||||
|
" with real syntax
|
||||||
|
" * Added tuple assignment parsing (whoops, that was forgotten)
|
||||||
|
" * Fixed import handling when flattening scope
|
||||||
|
"
|
||||||
|
" v 0.5:
|
||||||
|
" Yeah, I skipped a version number - 0.4 was never public.
|
||||||
|
" It was a bugfix version on top of 0.3. This is a complete
|
||||||
|
" rewrite.
|
||||||
|
"
|
||||||
|
|
||||||
|
if !has('python')
|
||||||
|
echo "Error: Required vim compiled with +python"
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! pythoncomplete#Complete(findstart, base)
|
||||||
|
"findstart = 1 when we need to get the text length
|
||||||
|
if a:findstart == 1
|
||||||
|
let line = getline('.')
|
||||||
|
let idx = col('.')
|
||||||
|
while idx > 0
|
||||||
|
let idx -= 1
|
||||||
|
let c = line[idx]
|
||||||
|
if c =~ '\w'
|
||||||
|
continue
|
||||||
|
elseif ! c =~ '\.'
|
||||||
|
let idx = -1
|
||||||
|
break
|
||||||
|
else
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return idx
|
||||||
|
"findstart = 0 when we need to return the list of completions
|
||||||
|
else
|
||||||
|
"vim no longer moves the cursor upon completion... fix that
|
||||||
|
let line = getline('.')
|
||||||
|
let idx = col('.')
|
||||||
|
let cword = ''
|
||||||
|
while idx > 0
|
||||||
|
let idx -= 1
|
||||||
|
let c = line[idx]
|
||||||
|
if c =~ '\w' || c =~ '\.' || c == '('
|
||||||
|
let cword = c . cword
|
||||||
|
continue
|
||||||
|
elseif strlen(cword) > 0 || idx == 0
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
execute "python vimcomplete('" . cword . "', '" . a:base . "')"
|
||||||
|
return g:pythoncomplete_completions
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:DefPython()
|
||||||
|
python << PYTHONEOF
|
||||||
|
import sys, tokenize, cStringIO, types
|
||||||
|
from token import NAME, DEDENT, NEWLINE, STRING
|
||||||
|
|
||||||
|
debugstmts=[]
|
||||||
|
def dbg(s): debugstmts.append(s)
|
||||||
|
def showdbg():
|
||||||
|
for d in debugstmts: print "DBG: %s " % d
|
||||||
|
|
||||||
|
def vimcomplete(context,match):
|
||||||
|
global debugstmts
|
||||||
|
debugstmts = []
|
||||||
|
try:
|
||||||
|
import vim
|
||||||
|
def complsort(x,y):
|
||||||
|
try:
|
||||||
|
xa = x['abbr']
|
||||||
|
ya = y['abbr']
|
||||||
|
if xa[0] == '_':
|
||||||
|
if xa[1] == '_' and ya[0:2] == '__':
|
||||||
|
return xa > ya
|
||||||
|
elif ya[0:2] == '__':
|
||||||
|
return -1
|
||||||
|
elif y[0] == '_':
|
||||||
|
return xa > ya
|
||||||
|
else:
|
||||||
|
return 1
|
||||||
|
elif ya[0] == '_':
|
||||||
|
return -1
|
||||||
|
else:
|
||||||
|
return xa > ya
|
||||||
|
except:
|
||||||
|
return 0
|
||||||
|
cmpl = Completer()
|
||||||
|
cmpl.evalsource('\n'.join(vim.current.buffer),vim.eval("line('.')"))
|
||||||
|
all = cmpl.get_completions(context,match)
|
||||||
|
all.sort(complsort)
|
||||||
|
dictstr = '['
|
||||||
|
# have to do this for double quoting
|
||||||
|
for cmpl in all:
|
||||||
|
dictstr += '{'
|
||||||
|
for x in cmpl: dictstr += '"%s":"%s",' % (x,cmpl[x])
|
||||||
|
dictstr += '"icase":0},'
|
||||||
|
if dictstr[-1] == ',': dictstr = dictstr[:-1]
|
||||||
|
dictstr += ']'
|
||||||
|
#dbg("dict: %s" % dictstr)
|
||||||
|
vim.command("silent let g:pythoncomplete_completions = %s" % dictstr)
|
||||||
|
#dbg("Completion dict:\n%s" % all)
|
||||||
|
except vim.error:
|
||||||
|
dbg("VIM Error: %s" % vim.error)
|
||||||
|
|
||||||
|
class Completer(object):
|
||||||
|
def __init__(self):
|
||||||
|
self.compldict = {}
|
||||||
|
self.parser = PyParser()
|
||||||
|
|
||||||
|
def evalsource(self,text,line=0):
|
||||||
|
sc = self.parser.parse(text,line)
|
||||||
|
src = sc.get_code()
|
||||||
|
dbg("source: %s" % src)
|
||||||
|
try: exec(src) in self.compldict
|
||||||
|
except: dbg("parser: %s, %s" % (sys.exc_info()[0],sys.exc_info()[1]))
|
||||||
|
for l in sc.locals:
|
||||||
|
try: exec(l) in self.compldict
|
||||||
|
except: dbg("locals: %s, %s [%s]" % (sys.exc_info()[0],sys.exc_info()[1],l))
|
||||||
|
|
||||||
|
def _cleanstr(self,doc):
|
||||||
|
return doc.replace('"',' ').replace("'",' ')
|
||||||
|
|
||||||
|
def get_arguments(self,func_obj):
|
||||||
|
def _ctor(obj):
|
||||||
|
try: return class_ob.__init__.im_func
|
||||||
|
except AttributeError:
|
||||||
|
for base in class_ob.__bases__:
|
||||||
|
rc = _find_constructor(base)
|
||||||
|
if rc is not None: return rc
|
||||||
|
return None
|
||||||
|
|
||||||
|
arg_offset = 1
|
||||||
|
if type(func_obj) == types.ClassType: func_obj = _ctor(func_obj)
|
||||||
|
elif type(func_obj) == types.MethodType: func_obj = func_obj.im_func
|
||||||
|
else: arg_offset = 0
|
||||||
|
|
||||||
|
arg_text=''
|
||||||
|
if type(func_obj) in [types.FunctionType, types.LambdaType]:
|
||||||
|
try:
|
||||||
|
cd = func_obj.func_code
|
||||||
|
real_args = cd.co_varnames[arg_offset:cd.co_argcount]
|
||||||
|
defaults = func_obj.func_defaults or ''
|
||||||
|
defaults = map(lambda name: "=%s" % name, defaults)
|
||||||
|
defaults = [""] * (len(real_args)-len(defaults)) + defaults
|
||||||
|
items = map(lambda a,d: a+d, real_args, defaults)
|
||||||
|
if func_obj.func_code.co_flags & 0x4:
|
||||||
|
items.append("...")
|
||||||
|
if func_obj.func_code.co_flags & 0x8:
|
||||||
|
items.append("***")
|
||||||
|
arg_text = (','.join(items)) + ')'
|
||||||
|
|
||||||
|
except:
|
||||||
|
dbg("arg completion: %s: %s" % (sys.exc_info()[0],sys.exc_info()[1]))
|
||||||
|
pass
|
||||||
|
if len(arg_text) == 0:
|
||||||
|
# The doc string sometimes contains the function signature
|
||||||
|
# this works for alot of C modules that are part of the
|
||||||
|
# standard library
|
||||||
|
doc = func_obj.__doc__
|
||||||
|
if doc:
|
||||||
|
doc = doc.lstrip()
|
||||||
|
pos = doc.find('\n')
|
||||||
|
if pos > 0:
|
||||||
|
sigline = doc[:pos]
|
||||||
|
lidx = sigline.find('(')
|
||||||
|
ridx = sigline.find(')')
|
||||||
|
if lidx > 0 and ridx > 0:
|
||||||
|
arg_text = sigline[lidx+1:ridx] + ')'
|
||||||
|
if len(arg_text) == 0: arg_text = ')'
|
||||||
|
return arg_text
|
||||||
|
|
||||||
|
def get_completions(self,context,match):
|
||||||
|
dbg("get_completions('%s','%s')" % (context,match))
|
||||||
|
stmt = ''
|
||||||
|
if context: stmt += str(context)
|
||||||
|
if match: stmt += str(match)
|
||||||
|
try:
|
||||||
|
result = None
|
||||||
|
all = {}
|
||||||
|
ridx = stmt.rfind('.')
|
||||||
|
if len(stmt) > 0 and stmt[-1] == '(':
|
||||||
|
result = eval(_sanitize(stmt[:-1]), self.compldict)
|
||||||
|
doc = result.__doc__
|
||||||
|
if doc == None: doc = ''
|
||||||
|
args = self.get_arguments(result)
|
||||||
|
return [{'word':self._cleanstr(args),'info':self._cleanstr(doc)}]
|
||||||
|
elif ridx == -1:
|
||||||
|
match = stmt
|
||||||
|
all = self.compldict
|
||||||
|
else:
|
||||||
|
match = stmt[ridx+1:]
|
||||||
|
stmt = _sanitize(stmt[:ridx])
|
||||||
|
result = eval(stmt, self.compldict)
|
||||||
|
all = dir(result)
|
||||||
|
|
||||||
|
dbg("completing: stmt:%s" % stmt)
|
||||||
|
completions = []
|
||||||
|
|
||||||
|
try: maindoc = result.__doc__
|
||||||
|
except: maindoc = ' '
|
||||||
|
if maindoc == None: maindoc = ' '
|
||||||
|
for m in all:
|
||||||
|
if m == "_PyCmplNoType": continue #this is internal
|
||||||
|
try:
|
||||||
|
dbg('possible completion: %s' % m)
|
||||||
|
if m.find(match) == 0:
|
||||||
|
if result == None: inst = all[m]
|
||||||
|
else: inst = getattr(result,m)
|
||||||
|
try: doc = inst.__doc__
|
||||||
|
except: doc = maindoc
|
||||||
|
typestr = str(inst)
|
||||||
|
if doc == None or doc == '': doc = maindoc
|
||||||
|
|
||||||
|
wrd = m[len(match):]
|
||||||
|
c = {'word':wrd, 'abbr':m, 'info':self._cleanstr(doc)}
|
||||||
|
if "function" in typestr:
|
||||||
|
c['word'] += '('
|
||||||
|
c['abbr'] += '(' + self._cleanstr(self.get_arguments(inst))
|
||||||
|
elif "method" in typestr:
|
||||||
|
c['word'] += '('
|
||||||
|
c['abbr'] += '(' + self._cleanstr(self.get_arguments(inst))
|
||||||
|
elif "module" in typestr:
|
||||||
|
c['word'] += '.'
|
||||||
|
elif "class" in typestr:
|
||||||
|
c['word'] += '('
|
||||||
|
c['abbr'] += '('
|
||||||
|
completions.append(c)
|
||||||
|
except:
|
||||||
|
i = sys.exc_info()
|
||||||
|
dbg("inner completion: %s,%s [stmt='%s']" % (i[0],i[1],stmt))
|
||||||
|
return completions
|
||||||
|
except:
|
||||||
|
i = sys.exc_info()
|
||||||
|
dbg("completion: %s,%s [stmt='%s']" % (i[0],i[1],stmt))
|
||||||
|
return []
|
||||||
|
|
||||||
|
class Scope(object):
|
||||||
|
def __init__(self,name,indent):
|
||||||
|
self.subscopes = []
|
||||||
|
self.docstr = ''
|
||||||
|
self.locals = []
|
||||||
|
self.parent = None
|
||||||
|
self.name = name
|
||||||
|
self.indent = indent
|
||||||
|
|
||||||
|
def add(self,sub):
|
||||||
|
#print 'push scope: [%s@%s]' % (sub.name,sub.indent)
|
||||||
|
sub.parent = self
|
||||||
|
self.subscopes.append(sub)
|
||||||
|
return sub
|
||||||
|
|
||||||
|
def doc(self,str):
|
||||||
|
""" Clean up a docstring """
|
||||||
|
d = str.replace('\n',' ')
|
||||||
|
d = d.replace('\t',' ')
|
||||||
|
while d.find(' ') > -1: d = d.replace(' ',' ')
|
||||||
|
while d[0] in '"\'\t ': d = d[1:]
|
||||||
|
while d[-1] in '"\'\t ': d = d[:-1]
|
||||||
|
self.docstr = d
|
||||||
|
|
||||||
|
def local(self,loc):
|
||||||
|
if not self._hasvaralready(loc):
|
||||||
|
self.locals.append(loc)
|
||||||
|
|
||||||
|
def copy_decl(self,indent=0):
|
||||||
|
""" Copy a scope's declaration only, at the specified indent level - not local variables """
|
||||||
|
return Scope(self.name,indent)
|
||||||
|
|
||||||
|
def _hasvaralready(self,test):
|
||||||
|
"Convienance function... keep out duplicates"
|
||||||
|
if test.find('=') > -1:
|
||||||
|
var = test.split('=')[0].strip()
|
||||||
|
for l in self.locals:
|
||||||
|
if l.find('=') > -1 and var == l.split('=')[0].strip():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def get_code(self):
|
||||||
|
# we need to start with this, to fix up broken completions
|
||||||
|
# hopefully this name is unique enough...
|
||||||
|
str = '"""'+self.docstr+'"""\n'
|
||||||
|
for l in self.locals:
|
||||||
|
if l.startswith('import'): str += l+'\n'
|
||||||
|
str += 'class _PyCmplNoType:\n def __getattr__(self,name):\n return None\n'
|
||||||
|
for sub in self.subscopes:
|
||||||
|
str += sub.get_code()
|
||||||
|
for l in self.locals:
|
||||||
|
if not l.startswith('import'): str += l+'\n'
|
||||||
|
|
||||||
|
return str
|
||||||
|
|
||||||
|
def pop(self,indent):
|
||||||
|
#print 'pop scope: [%s] to [%s]' % (self.indent,indent)
|
||||||
|
outer = self
|
||||||
|
while outer.parent != None and outer.indent >= indent:
|
||||||
|
outer = outer.parent
|
||||||
|
return outer
|
||||||
|
|
||||||
|
def currentindent(self):
|
||||||
|
#print 'parse current indent: %s' % self.indent
|
||||||
|
return ' '*self.indent
|
||||||
|
|
||||||
|
def childindent(self):
|
||||||
|
#print 'parse child indent: [%s]' % (self.indent+1)
|
||||||
|
return ' '*(self.indent+1)
|
||||||
|
|
||||||
|
class Class(Scope):
|
||||||
|
def __init__(self, name, supers, indent):
|
||||||
|
Scope.__init__(self,name,indent)
|
||||||
|
self.supers = supers
|
||||||
|
def copy_decl(self,indent=0):
|
||||||
|
c = Class(self.name,self.supers,indent)
|
||||||
|
for s in self.subscopes:
|
||||||
|
c.add(s.copy_decl(indent+1))
|
||||||
|
return c
|
||||||
|
def get_code(self):
|
||||||
|
str = '%sclass %s' % (self.currentindent(),self.name)
|
||||||
|
if len(self.supers) > 0: str += '(%s)' % ','.join(self.supers)
|
||||||
|
str += ':\n'
|
||||||
|
if len(self.docstr) > 0: str += self.childindent()+'"""'+self.docstr+'"""\n'
|
||||||
|
if len(self.subscopes) > 0:
|
||||||
|
for s in self.subscopes: str += s.get_code()
|
||||||
|
else:
|
||||||
|
str += '%spass\n' % self.childindent()
|
||||||
|
return str
|
||||||
|
|
||||||
|
|
||||||
|
class Function(Scope):
|
||||||
|
def __init__(self, name, params, indent):
|
||||||
|
Scope.__init__(self,name,indent)
|
||||||
|
self.params = params
|
||||||
|
def copy_decl(self,indent=0):
|
||||||
|
return Function(self.name,self.params,indent)
|
||||||
|
def get_code(self):
|
||||||
|
str = "%sdef %s(%s):\n" % \
|
||||||
|
(self.currentindent(),self.name,','.join(self.params))
|
||||||
|
if len(self.docstr) > 0: str += self.childindent()+'"""'+self.docstr+'"""\n'
|
||||||
|
str += "%spass\n" % self.childindent()
|
||||||
|
return str
|
||||||
|
|
||||||
|
class PyParser:
|
||||||
|
def __init__(self):
|
||||||
|
self.top = Scope('global',0)
|
||||||
|
self.scope = self.top
|
||||||
|
|
||||||
|
def _parsedotname(self,pre=None):
|
||||||
|
#returns (dottedname, nexttoken)
|
||||||
|
name = []
|
||||||
|
if pre == None:
|
||||||
|
tokentype, token, indent = self.next()
|
||||||
|
if tokentype != NAME and token != '*':
|
||||||
|
return ('', token)
|
||||||
|
else: token = pre
|
||||||
|
name.append(token)
|
||||||
|
while True:
|
||||||
|
tokentype, token, indent = self.next()
|
||||||
|
if token != '.': break
|
||||||
|
tokentype, token, indent = self.next()
|
||||||
|
if tokentype != NAME: break
|
||||||
|
name.append(token)
|
||||||
|
return (".".join(name), token)
|
||||||
|
|
||||||
|
def _parseimportlist(self):
|
||||||
|
imports = []
|
||||||
|
while True:
|
||||||
|
name, token = self._parsedotname()
|
||||||
|
if not name: break
|
||||||
|
name2 = ''
|
||||||
|
if token == 'as': name2, token = self._parsedotname()
|
||||||
|
imports.append((name, name2))
|
||||||
|
while token != "," and "\n" not in token:
|
||||||
|
tokentype, token, indent = self.next()
|
||||||
|
if token != ",": break
|
||||||
|
return imports
|
||||||
|
|
||||||
|
def _parenparse(self):
|
||||||
|
name = ''
|
||||||
|
names = []
|
||||||
|
level = 1
|
||||||
|
while True:
|
||||||
|
tokentype, token, indent = self.next()
|
||||||
|
if token in (')', ',') and level == 1:
|
||||||
|
names.append(name)
|
||||||
|
name = ''
|
||||||
|
if token == '(':
|
||||||
|
level += 1
|
||||||
|
elif token == ')':
|
||||||
|
level -= 1
|
||||||
|
if level == 0: break
|
||||||
|
elif token == ',' and level == 1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
name += str(token)
|
||||||
|
return names
|
||||||
|
|
||||||
|
def _parsefunction(self,indent):
|
||||||
|
self.scope=self.scope.pop(indent)
|
||||||
|
tokentype, fname, ind = self.next()
|
||||||
|
if tokentype != NAME: return None
|
||||||
|
|
||||||
|
tokentype, open, ind = self.next()
|
||||||
|
if open != '(': return None
|
||||||
|
params=self._parenparse()
|
||||||
|
|
||||||
|
tokentype, colon, ind = self.next()
|
||||||
|
if colon != ':': return None
|
||||||
|
|
||||||
|
return Function(fname,params,indent)
|
||||||
|
|
||||||
|
def _parseclass(self,indent):
|
||||||
|
self.scope=self.scope.pop(indent)
|
||||||
|
tokentype, cname, ind = self.next()
|
||||||
|
if tokentype != NAME: return None
|
||||||
|
|
||||||
|
super = []
|
||||||
|
tokentype, next, ind = self.next()
|
||||||
|
if next == '(':
|
||||||
|
super=self._parenparse()
|
||||||
|
elif next != ':': return None
|
||||||
|
|
||||||
|
return Class(cname,super,indent)
|
||||||
|
|
||||||
|
def _parseassignment(self):
|
||||||
|
assign=''
|
||||||
|
tokentype, token, indent = self.next()
|
||||||
|
if tokentype == tokenize.STRING or token == 'str':
|
||||||
|
return '""'
|
||||||
|
elif token == '(' or token == 'tuple':
|
||||||
|
return '()'
|
||||||
|
elif token == '[' or token == 'list':
|
||||||
|
return '[]'
|
||||||
|
elif token == '{' or token == 'dict':
|
||||||
|
return '{}'
|
||||||
|
elif tokentype == tokenize.NUMBER:
|
||||||
|
return '0'
|
||||||
|
elif token == 'open' or token == 'file':
|
||||||
|
return 'file'
|
||||||
|
elif token == 'None':
|
||||||
|
return '_PyCmplNoType()'
|
||||||
|
elif token == 'type':
|
||||||
|
return 'type(_PyCmplNoType)' #only for method resolution
|
||||||
|
else:
|
||||||
|
assign += token
|
||||||
|
level = 0
|
||||||
|
while True:
|
||||||
|
tokentype, token, indent = self.next()
|
||||||
|
if token in ('(','{','['):
|
||||||
|
level += 1
|
||||||
|
elif token in (']','}',')'):
|
||||||
|
level -= 1
|
||||||
|
if level == 0: break
|
||||||
|
elif level == 0:
|
||||||
|
if token in (';','\n'): break
|
||||||
|
assign += token
|
||||||
|
return "%s" % assign
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
type, token, (lineno, indent), end, self.parserline = self.gen.next()
|
||||||
|
if lineno == self.curline:
|
||||||
|
#print 'line found [%s] scope=%s' % (line.replace('\n',''),self.scope.name)
|
||||||
|
self.currentscope = self.scope
|
||||||
|
return (type, token, indent)
|
||||||
|
|
||||||
|
def _adjustvisibility(self):
|
||||||
|
newscope = Scope('result',0)
|
||||||
|
scp = self.currentscope
|
||||||
|
while scp != None:
|
||||||
|
if type(scp) == Function:
|
||||||
|
slice = 0
|
||||||
|
#Handle 'self' params
|
||||||
|
if scp.parent != None and type(scp.parent) == Class:
|
||||||
|
slice = 1
|
||||||
|
p = scp.params[0]
|
||||||
|
i = p.find('=')
|
||||||
|
if i != -1: p = p[:i]
|
||||||
|
newscope.local('%s = %s' % (scp.params[0],scp.parent.name))
|
||||||
|
for p in scp.params[slice:]:
|
||||||
|
i = p.find('=')
|
||||||
|
if i == -1:
|
||||||
|
newscope.local('%s = _PyCmplNoType()' % p)
|
||||||
|
else:
|
||||||
|
newscope.local('%s = %s' % (p[:i],_sanitize(p[i+1])))
|
||||||
|
|
||||||
|
for s in scp.subscopes:
|
||||||
|
ns = s.copy_decl(0)
|
||||||
|
newscope.add(ns)
|
||||||
|
for l in scp.locals: newscope.local(l)
|
||||||
|
scp = scp.parent
|
||||||
|
|
||||||
|
self.currentscope = newscope
|
||||||
|
return self.currentscope
|
||||||
|
|
||||||
|
#p.parse(vim.current.buffer[:],vim.eval("line('.')"))
|
||||||
|
def parse(self,text,curline=0):
|
||||||
|
self.curline = int(curline)
|
||||||
|
buf = cStringIO.StringIO(''.join(text) + '\n')
|
||||||
|
self.gen = tokenize.generate_tokens(buf.readline)
|
||||||
|
self.currentscope = self.scope
|
||||||
|
|
||||||
|
try:
|
||||||
|
freshscope=True
|
||||||
|
while True:
|
||||||
|
tokentype, token, indent = self.next()
|
||||||
|
#dbg( 'main: token=[%s] indent=[%s]' % (token,indent))
|
||||||
|
|
||||||
|
if tokentype == DEDENT or token == "pass":
|
||||||
|
self.scope = self.scope.pop(indent)
|
||||||
|
elif token == 'def':
|
||||||
|
func = self._parsefunction(indent)
|
||||||
|
if func == None:
|
||||||
|
print "function: syntax error..."
|
||||||
|
continue
|
||||||
|
freshscope = True
|
||||||
|
self.scope = self.scope.add(func)
|
||||||
|
elif token == 'class':
|
||||||
|
cls = self._parseclass(indent)
|
||||||
|
if cls == None:
|
||||||
|
print "class: syntax error..."
|
||||||
|
continue
|
||||||
|
freshscope = True
|
||||||
|
self.scope = self.scope.add(cls)
|
||||||
|
|
||||||
|
elif token == 'import':
|
||||||
|
imports = self._parseimportlist()
|
||||||
|
for mod, alias in imports:
|
||||||
|
loc = "import %s" % mod
|
||||||
|
if len(alias) > 0: loc += " as %s" % alias
|
||||||
|
self.scope.local(loc)
|
||||||
|
freshscope = False
|
||||||
|
elif token == 'from':
|
||||||
|
mod, token = self._parsedotname()
|
||||||
|
if not mod or token != "import":
|
||||||
|
print "from: syntax error..."
|
||||||
|
continue
|
||||||
|
names = self._parseimportlist()
|
||||||
|
for name, alias in names:
|
||||||
|
loc = "from %s import %s" % (mod,name)
|
||||||
|
if len(alias) > 0: loc += " as %s" % alias
|
||||||
|
self.scope.local(loc)
|
||||||
|
freshscope = False
|
||||||
|
elif tokentype == STRING:
|
||||||
|
if freshscope: self.scope.doc(token)
|
||||||
|
elif tokentype == NAME:
|
||||||
|
name,token = self._parsedotname(token)
|
||||||
|
if token == '=':
|
||||||
|
stmt = self._parseassignment()
|
||||||
|
if stmt != None:
|
||||||
|
self.scope.local("%s = %s" % (name,stmt))
|
||||||
|
freshscope = False
|
||||||
|
except StopIteration: #thrown on EOF
|
||||||
|
pass
|
||||||
|
except:
|
||||||
|
dbg("parse error: %s, %s @ %s" %
|
||||||
|
(sys.exc_info()[0], sys.exc_info()[1], self.parserline))
|
||||||
|
return self._adjustvisibility()
|
||||||
|
|
||||||
|
def _sanitize(str):
|
||||||
|
val = ''
|
||||||
|
level = 0
|
||||||
|
for c in str:
|
||||||
|
if c in ('(','{','['):
|
||||||
|
level += 1
|
||||||
|
elif c in (']','}',')'):
|
||||||
|
level -= 1
|
||||||
|
elif level == 0:
|
||||||
|
val += c
|
||||||
|
return val
|
||||||
|
|
||||||
|
sys.path.extend(['.','..'])
|
||||||
|
PYTHONEOF
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call s:DefPython()
|
||||||
|
" vim: set et ts=4:
|
|
@ -0,0 +1,79 @@
|
||||||
|
set background=dark
|
||||||
|
|
||||||
|
hi clear
|
||||||
|
|
||||||
|
if exists("syntax_on")
|
||||||
|
syntax reset
|
||||||
|
endif
|
||||||
|
|
||||||
|
let colors_name = "freya"
|
||||||
|
|
||||||
|
hi Normal ctermbg=0 ctermfg=7 cterm=none guibg=#2a2a2a guifg=#dcdccc gui=none
|
||||||
|
|
||||||
|
hi Cursor guibg=fg guifg=bg gui=none
|
||||||
|
hi CursorColumn guibg=#3f3f3f gui=none
|
||||||
|
hi CursorLine guibg=#3f3f3f gui=none
|
||||||
|
hi DiffAdd guibg=#008b00 guifg=fg gui=none
|
||||||
|
hi DiffChange guibg=#00008b guifg=fg gui=none
|
||||||
|
hi DiffDelete guibg=#8b0000 guifg=fg gui=none
|
||||||
|
hi DiffText guibg=#0000cd guifg=fg gui=bold
|
||||||
|
hi Directory guibg=bg guifg=#d4b064 gui=none
|
||||||
|
hi ErrorMsg guibg=bg guifg=#f07070 gui=bold
|
||||||
|
hi FoldColumn ctermbg=bg guibg=bg guifg=#c2b680 gui=none
|
||||||
|
hi Folded guibg=#101010 guifg=#c2b680 gui=none
|
||||||
|
hi IncSearch guibg=#866a4f guifg=fg gui=none
|
||||||
|
hi LineNr guibg=bg guifg=#9f8f80 gui=none
|
||||||
|
hi ModeMsg guibg=bg guifg=fg gui=bold
|
||||||
|
hi MoreMsg guibg=bg guifg=#dabfa5 gui=bold
|
||||||
|
hi NonText ctermfg=8 guibg=bg guifg=#9f8f80 gui=bold
|
||||||
|
hi Pmenu guibg=#a78869 guifg=#000000 gui=none
|
||||||
|
hi PmenuSbar guibg=#B99F86 guifg=fg gui=none
|
||||||
|
hi PmenuSel guibg=#c0aa94 guifg=bg gui=none
|
||||||
|
hi PmenuThumb guibg=#f7f7f1 guifg=bg gui=none
|
||||||
|
hi Question guibg=bg guifg=#dabfa5 gui=bold
|
||||||
|
hi Search guibg=#c0aa94 guifg=bg gui=none
|
||||||
|
hi SignColumn ctermbg=bg guibg=bg guifg=#c2b680 gui=none
|
||||||
|
hi SpecialKey guibg=bg guifg=#d4b064 gui=none
|
||||||
|
if has("spell")
|
||||||
|
hi SpellBad guisp=#f07070 gui=undercurl
|
||||||
|
hi SpellCap guisp=#7070f0 gui=undercurl
|
||||||
|
hi SpellLocal guisp=#70f0f0 gui=undercurl
|
||||||
|
hi SpellRare guisp=#f070f0 gui=undercurl
|
||||||
|
endif
|
||||||
|
hi StatusLine ctermbg=7 ctermfg=0 guibg=#736559 guifg=#f7f7f1 gui=bold
|
||||||
|
hi StatusLineNC ctermbg=8 ctermfg=0 guibg=#564d43 guifg=#f7f7f1 gui=none
|
||||||
|
hi TabLine guibg=#564d43 guifg=#f7f7f1 gui=underline
|
||||||
|
hi TabLineFill guibg=#564d43 guifg=#f7f7f1 gui=underline
|
||||||
|
hi TabLineSel guibg=bg guifg=#f7f7f1 gui=bold
|
||||||
|
hi Title ctermbg=0 ctermfg=15 guifg=#f7f7f1 gui=bold
|
||||||
|
hi VertSplit ctermbg=7 ctermfg=0 guibg=#564d43 guifg=#f7f7f1 gui=none
|
||||||
|
if version >= 700
|
||||||
|
hi Visual ctermbg=7 ctermfg=0 guibg=#5f5f5f gui=none
|
||||||
|
else
|
||||||
|
hi Visual ctermbg=7 ctermfg=0 guibg=#5f5f5f guifg=fg gui=none
|
||||||
|
endif
|
||||||
|
hi VisualNOS guibg=bg guifg=#c0aa94 gui=bold,underline
|
||||||
|
hi WarningMsg guibg=bg guifg=#f07070 gui=none
|
||||||
|
hi WildMenu guibg=#c0aa94 guifg=bg gui=bold
|
||||||
|
|
||||||
|
hi Comment guibg=bg guifg=#c2b680 gui=none
|
||||||
|
hi Constant guibg=bg guifg=#f8af80 gui=none
|
||||||
|
hi Error guibg=bg guifg=#f07070 gui=none
|
||||||
|
hi Identifier guibg=bg guifg=#dabfa5 gui=none
|
||||||
|
hi Ignore guibg=bg guifg=bg gui=none
|
||||||
|
hi lCursor guibg=#c0aa94 guifg=bg gui=none
|
||||||
|
hi MatchParen guibg=#008b8b gui=none
|
||||||
|
hi PreProc guibg=bg guifg=#c2d0ae gui=none
|
||||||
|
hi Special guibg=bg guifg=#d4b064 gui=none
|
||||||
|
hi Statement guibg=bg guifg=#e0af91 gui=bold
|
||||||
|
hi Todo guibg=#aed0ae guifg=bg gui=none
|
||||||
|
hi Type guibg=bg guifg=#dabfa5 gui=bold
|
||||||
|
hi Underlined guibg=bg guifg=#d4b064 gui=underline
|
||||||
|
|
||||||
|
hi htmlBold ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold
|
||||||
|
hi htmlItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=italic
|
||||||
|
hi htmlUnderline ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=underline
|
||||||
|
hi htmlBoldItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,italic
|
||||||
|
hi htmlBoldUnderline ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,underline
|
||||||
|
hi htmlBoldUnderlineItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,underline,italic
|
||||||
|
hi htmlUnderlineItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=underline,italic
|
|
@ -0,0 +1,212 @@
|
||||||
|
" Vim color file
|
||||||
|
" Name: inkpot.vim
|
||||||
|
" Maintainer: Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
|
||||||
|
" This should work in the GUI, rxvt-unicode (88 colour mode) and xterm (256
|
||||||
|
" colour mode). It won't work in 8/16 colour terminals.
|
||||||
|
"
|
||||||
|
" To use a black background, :let g:inkpot_black_background = 1
|
||||||
|
|
||||||
|
set background=dark
|
||||||
|
hi clear
|
||||||
|
if exists("syntax_on")
|
||||||
|
syntax reset
|
||||||
|
endif
|
||||||
|
|
||||||
|
let colors_name = "inkpot"
|
||||||
|
|
||||||
|
" map a urxvt cube number to an xterm-256 cube number
|
||||||
|
fun! <SID>M(a)
|
||||||
|
return strpart("0135", a:a, 1) + 0
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" map a urxvt colour to an xterm-256 colour
|
||||||
|
fun! <SID>X(a)
|
||||||
|
if &t_Co == 88
|
||||||
|
return a:a
|
||||||
|
else
|
||||||
|
if a:a == 8
|
||||||
|
return 237
|
||||||
|
elseif a:a < 16
|
||||||
|
return a:a
|
||||||
|
elseif a:a > 79
|
||||||
|
return 232 + (3 * (a:a - 80))
|
||||||
|
else
|
||||||
|
let l:b = a:a - 16
|
||||||
|
let l:x = l:b % 4
|
||||||
|
let l:y = (l:b / 4) % 4
|
||||||
|
let l:z = (l:b / 16)
|
||||||
|
return 16 + <SID>M(l:x) + (6 * <SID>M(l:y)) + (36 * <SID>M(l:z))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
if ! exists("g:inkpot_black_background")
|
||||||
|
let g:inkpot_black_background = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
if has("gui_running")
|
||||||
|
if ! g:inkpot_black_background
|
||||||
|
hi Normal gui=NONE guifg=#cfbfad guibg=#1e1e27
|
||||||
|
else
|
||||||
|
hi Normal gui=NONE guifg=#cfbfad guibg=#000000
|
||||||
|
endif
|
||||||
|
|
||||||
|
hi IncSearch gui=BOLD guifg=#303030 guibg=#cd8b60
|
||||||
|
hi Search gui=NONE guifg=#303030 guibg=#cd8b60
|
||||||
|
hi ErrorMsg gui=BOLD guifg=#ffffff guibg=#ce4e4e
|
||||||
|
hi WarningMsg gui=BOLD guifg=#ffffff guibg=#ce8e4e
|
||||||
|
hi ModeMsg gui=BOLD guifg=#7e7eae guibg=NONE
|
||||||
|
hi MoreMsg gui=BOLD guifg=#7e7eae guibg=NONE
|
||||||
|
hi Question gui=BOLD guifg=#ffcd00 guibg=NONE
|
||||||
|
|
||||||
|
hi StatusLine gui=BOLD guifg=#b9b9b9 guibg=#3e3e5e
|
||||||
|
hi User1 gui=BOLD guifg=#00ff8b guibg=#3e3e5e
|
||||||
|
hi User2 gui=BOLD guifg=#7070a0 guibg=#3e3e5e
|
||||||
|
hi StatusLineNC gui=NONE guifg=#b9b9b9 guibg=#3e3e5e
|
||||||
|
hi VertSplit gui=NONE guifg=#b9b9b9 guibg=#3e3e5e
|
||||||
|
|
||||||
|
hi WildMenu gui=BOLD guifg=#eeeeee guibg=#6e6eaf
|
||||||
|
|
||||||
|
hi MBENormal guifg=#cfbfad guibg=#2e2e3f
|
||||||
|
hi MBEChanged guifg=#eeeeee guibg=#2e2e3f
|
||||||
|
hi MBEVisibleNormal guifg=#cfcfcd guibg=#4e4e8f
|
||||||
|
hi MBEVisibleChanged guifg=#eeeeee guibg=#4e4e8f
|
||||||
|
|
||||||
|
hi DiffText gui=NONE guifg=#ffffcd guibg=#4a2a4a
|
||||||
|
hi DiffChange gui=NONE guifg=#ffffcd guibg=#306b8f
|
||||||
|
hi DiffDelete gui=NONE guifg=#ffffcd guibg=#6d3030
|
||||||
|
hi DiffAdd gui=NONE guifg=#ffffcd guibg=#306d30
|
||||||
|
|
||||||
|
hi Cursor gui=NONE guifg=#404040 guibg=#8b8bff
|
||||||
|
hi lCursor gui=NONE guifg=#404040 guibg=#8fff8b
|
||||||
|
hi CursorIM gui=NONE guifg=#404040 guibg=#8b8bff
|
||||||
|
|
||||||
|
hi Folded gui=NONE guifg=#cfcfcd guibg=#4b208f
|
||||||
|
hi FoldColumn gui=NONE guifg=#8b8bcd guibg=#2e2e2e
|
||||||
|
|
||||||
|
hi Directory gui=NONE guifg=#00ff8b guibg=NONE
|
||||||
|
hi LineNr gui=NONE guifg=#8b8bcd guibg=#2e2e2e
|
||||||
|
hi NonText gui=BOLD guifg=#8b8bcd guibg=NONE
|
||||||
|
hi SpecialKey gui=BOLD guifg=#ab60ed guibg=NONE
|
||||||
|
hi Title gui=BOLD guifg=#af4f4b guibg=NONE
|
||||||
|
hi Visual gui=NONE guifg=#eeeeee guibg=#4e4e8f
|
||||||
|
|
||||||
|
hi Comment gui=NONE guifg=#cd8b00 guibg=NONE
|
||||||
|
hi Constant gui=NONE guifg=#ffcd8b guibg=NONE
|
||||||
|
hi String gui=NONE guifg=#ffcd8b guibg=#404040
|
||||||
|
hi Error gui=NONE guifg=#ffffff guibg=#6e2e2e
|
||||||
|
hi Identifier gui=NONE guifg=#ff8bff guibg=NONE
|
||||||
|
hi Ignore gui=NONE
|
||||||
|
hi Number gui=NONE guifg=#f0ad6d guibg=NONE
|
||||||
|
hi PreProc gui=NONE guifg=#409090 guibg=NONE
|
||||||
|
hi Special gui=NONE guifg=#c080d0 guibg=NONE
|
||||||
|
hi SpecialChar gui=NONE guifg=#c080d0 guibg=#404040
|
||||||
|
hi Statement gui=NONE guifg=#808bed guibg=NONE
|
||||||
|
hi Todo gui=BOLD guifg=#303030 guibg=#d0a060
|
||||||
|
hi Type gui=NONE guifg=#ff8bff guibg=NONE
|
||||||
|
hi Underlined gui=BOLD guifg=#df9f2d guibg=NONE
|
||||||
|
hi TaglistTagName gui=BOLD guifg=#808bed guibg=NONE
|
||||||
|
|
||||||
|
hi perlSpecialMatch gui=NONE guifg=#c080d0 guibg=#404040
|
||||||
|
hi perlSpecialString gui=NONE guifg=#c080d0 guibg=#404040
|
||||||
|
|
||||||
|
hi cSpecialCharacter gui=NONE guifg=#c080d0 guibg=#404040
|
||||||
|
hi cFormat gui=NONE guifg=#c080d0 guibg=#404040
|
||||||
|
|
||||||
|
hi doxygenBrief gui=NONE guifg=#fdab60 guibg=NONE
|
||||||
|
hi doxygenParam gui=NONE guifg=#fdd090 guibg=NONE
|
||||||
|
hi doxygenPrev gui=NONE guifg=#fdd090 guibg=NONE
|
||||||
|
hi doxygenSmallSpecial gui=NONE guifg=#fdd090 guibg=NONE
|
||||||
|
hi doxygenSpecial gui=NONE guifg=#fdd090 guibg=NONE
|
||||||
|
hi doxygenComment gui=NONE guifg=#ad7b20 guibg=NONE
|
||||||
|
hi doxygenSpecial gui=NONE guifg=#fdab60 guibg=NONE
|
||||||
|
hi doxygenSpecialMultilineDesc gui=NONE guifg=#ad600b guibg=NONE
|
||||||
|
hi doxygenSpecialOnelineDesc gui=NONE guifg=#ad600b guibg=NONE
|
||||||
|
|
||||||
|
if v:version >= 700
|
||||||
|
hi Pmenu gui=NONE guifg=#eeeeee guibg=#4e4e8f
|
||||||
|
hi PmenuSel gui=BOLD guifg=#eeeeee guibg=#2e2e3f
|
||||||
|
hi PmenuSbar gui=BOLD guifg=#eeeeee guibg=#6e6eaf
|
||||||
|
hi PmenuThumb gui=BOLD guifg=#eeeeee guibg=#6e6eaf
|
||||||
|
|
||||||
|
hi SpellBad gui=undercurl guisp=#cc6666
|
||||||
|
hi SpellRare gui=undercurl guisp=#cc66cc
|
||||||
|
hi SpellLocal gui=undercurl guisp=#cccc66
|
||||||
|
hi SpellCap gui=undercurl guisp=#66cccc
|
||||||
|
|
||||||
|
hi MatchParen gui=NONE guifg=#404040 guibg=#8fff8b
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if ! g:inkpot_black_background
|
||||||
|
exec "hi Normal cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(80)
|
||||||
|
else
|
||||||
|
exec "hi Normal cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(16)
|
||||||
|
endif
|
||||||
|
|
||||||
|
exec "hi IncSearch cterm=BOLD ctermfg=" . <SID>X(80) . " ctermbg=" . <SID>X(73)
|
||||||
|
exec "hi Search cterm=NONE ctermfg=" . <SID>X(80) . " ctermbg=" . <SID>X(73)
|
||||||
|
exec "hi ErrorMsg cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(48)
|
||||||
|
exec "hi WarningMsg cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(68)
|
||||||
|
exec "hi ModeMsg cterm=BOLD ctermfg=" . <SID>X(38) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi MoreMsg cterm=BOLD ctermfg=" . <SID>X(38) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi Question cterm=BOLD ctermfg=" . <SID>X(52) . " ctermbg=" . "NONE"
|
||||||
|
|
||||||
|
exec "hi StatusLine cterm=BOLD ctermfg=" . <SID>X(85) . " ctermbg=" . <SID>X(81)
|
||||||
|
exec "hi User1 cterm=BOLD ctermfg=" . <SID>X(28) . " ctermbg=" . <SID>X(81)
|
||||||
|
exec "hi User2 cterm=BOLD ctermfg=" . <SID>X(39) . " ctermbg=" . <SID>X(81)
|
||||||
|
exec "hi StatusLineNC cterm=NONE ctermfg=" . <SID>X(84) . " ctermbg=" . <SID>X(81)
|
||||||
|
exec "hi VertSplit cterm=NONE ctermfg=" . <SID>X(84) . " ctermbg=" . <SID>X(81)
|
||||||
|
|
||||||
|
exec "hi WildMenu cterm=BOLD ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(38)
|
||||||
|
|
||||||
|
exec "hi MBENormal ctermfg=" . <SID>X(85) . " ctermbg=" . <SID>X(81)
|
||||||
|
exec "hi MBEChanged ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(81)
|
||||||
|
exec "hi MBEVisibleNormal ctermfg=" . <SID>X(85) . " ctermbg=" . <SID>X(82)
|
||||||
|
exec "hi MBEVisibleChanged ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(82)
|
||||||
|
|
||||||
|
exec "hi DiffText cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(34)
|
||||||
|
exec "hi DiffChange cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(17)
|
||||||
|
exec "hi DiffDelete cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(32)
|
||||||
|
exec "hi DiffAdd cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(20)
|
||||||
|
|
||||||
|
exec "hi Folded cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(35)
|
||||||
|
exec "hi FoldColumn cterm=NONE ctermfg=" . <SID>X(39) . " ctermbg=" . <SID>X(80)
|
||||||
|
|
||||||
|
exec "hi Directory cterm=NONE ctermfg=" . <SID>X(28) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi LineNr cterm=NONE ctermfg=" . <SID>X(39) . " ctermbg=" . <SID>X(80)
|
||||||
|
exec "hi NonText cterm=BOLD ctermfg=" . <SID>X(39) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi SpecialKey cterm=BOLD ctermfg=" . <SID>X(55) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi Title cterm=BOLD ctermfg=" . <SID>X(48) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi Visual cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(38)
|
||||||
|
|
||||||
|
exec "hi Comment cterm=NONE ctermfg=" . <SID>X(52) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi Constant cterm=NONE ctermfg=" . <SID>X(73) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi String cterm=NONE ctermfg=" . <SID>X(73) . " ctermbg=" . <SID>X(81)
|
||||||
|
exec "hi Error cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(32)
|
||||||
|
exec "hi Identifier cterm=NONE ctermfg=" . <SID>X(53) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi Ignore cterm=NONE"
|
||||||
|
exec "hi Number cterm=NONE ctermfg=" . <SID>X(69) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi PreProc cterm=NONE ctermfg=" . <SID>X(25) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi Special cterm=NONE ctermfg=" . <SID>X(55) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi SpecialChar cterm=NONE ctermfg=" . <SID>X(55) . " ctermbg=" . <SID>X(81)
|
||||||
|
exec "hi Statement cterm=NONE ctermfg=" . <SID>X(27) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi Todo cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(57)
|
||||||
|
exec "hi Type cterm=NONE ctermfg=" . <SID>X(71) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi Underlined cterm=BOLD ctermfg=" . <SID>X(77) . " ctermbg=" . "NONE"
|
||||||
|
exec "hi TaglistTagName cterm=BOLD ctermfg=" . <SID>X(39) . " ctermbg=" . "NONE"
|
||||||
|
|
||||||
|
if v:version >= 700
|
||||||
|
exec "hi Pmenu cterm=NONE ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(82)
|
||||||
|
exec "hi PmenuSel cterm=BOLD ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(38)
|
||||||
|
exec "hi PmenuSbar cterm=BOLD ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(39)
|
||||||
|
exec "hi PmenuThumb cterm=BOLD ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(39)
|
||||||
|
|
||||||
|
exec "hi SpellBad cterm=NONE ctermbg=" . <SID>X(32)
|
||||||
|
exec "hi SpellRare cterm=NONE ctermbg=" . <SID>X(33)
|
||||||
|
exec "hi SpellLocal cterm=NONE ctermbg=" . <SID>X(36)
|
||||||
|
exec "hi SpellCap cterm=NONE ctermbg=" . <SID>X(21)
|
||||||
|
exec "hi MatchParen cterm=NONE ctermbg=" . <SID>X(14) . "ctermfg=" . <SID>X(25)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" vim: set et :
|
|
@ -0,0 +1,80 @@
|
||||||
|
" vim:set ts=8 sts=2 sw=2 tw=0:
|
||||||
|
"
|
||||||
|
" matrix.vim - MATRIX like colorscheme.
|
||||||
|
"
|
||||||
|
" Maintainer: MURAOKA Taro <koron@tka.att.ne.jp>
|
||||||
|
" Last Change: 10-Jun-2003.
|
||||||
|
|
||||||
|
set background=dark
|
||||||
|
hi clear
|
||||||
|
if exists("syntax_on")
|
||||||
|
syntax reset
|
||||||
|
endif
|
||||||
|
let g:colors_name = 'matrix'
|
||||||
|
|
||||||
|
" the character under the cursor
|
||||||
|
hi Cursor guifg=#226622 guibg=#55ff55
|
||||||
|
hi lCursor guifg=#226622 guibg=#55ff55
|
||||||
|
" like Cursor, but used when in IME mode |CursorIM|
|
||||||
|
hi CursorIM guifg=#226622 guibg=#55ff55
|
||||||
|
" directory names (and other special names in listings)
|
||||||
|
hi Directory guifg=#55ff55 guibg=#000000
|
||||||
|
" diff mode: Added line |diff.txt|
|
||||||
|
hi DiffAdd guifg=#55ff55 guibg=#226622 gui=none
|
||||||
|
" diff mode: Changed line |diff.txt|
|
||||||
|
hi DiffChange guifg=#55ff55 guibg=#226622 gui=none
|
||||||
|
" diff mode: Deleted line |diff.txt|
|
||||||
|
hi DiffDelete guifg=#113311 guibg=#113311 gui=none
|
||||||
|
" diff mode: Changed text within a changed line |diff.txt|
|
||||||
|
hi DiffText guifg=#55ff55 guibg=#339933 gui=bold
|
||||||
|
" error messages on the command line
|
||||||
|
hi ErrorMsg guifg=#55ff55 guibg=#339933
|
||||||
|
" the column separating vertically split windows
|
||||||
|
hi VertSplit guifg=#339933 guibg=#339933
|
||||||
|
" line used for closed folds
|
||||||
|
hi Folded guifg=#44cc44 guibg=#113311
|
||||||
|
" 'foldcolumn'
|
||||||
|
hi FoldColumn guifg=#44cc44 guibg=#226622
|
||||||
|
" 'incsearch' highlighting; also used for the text replaced with
|
||||||
|
hi IncSearch guifg=#226622 guibg=#55ff55 gui=none
|
||||||
|
" line number for ":number" and ":#" commands, and when 'number'
|
||||||
|
hi LineNr guifg=#44cc44 guibg=#000000
|
||||||
|
" 'showmode' message (e.g., "-- INSERT --")
|
||||||
|
hi ModeMsg guifg=#44cc44 guibg=#000000
|
||||||
|
" |more-prompt|
|
||||||
|
hi MoreMsg guifg=#44cc44 guibg=#000000
|
||||||
|
" '~' and '@' at the end of the window, characters from
|
||||||
|
hi NonText guifg=#44cc44 guibg=#113311
|
||||||
|
" normal text
|
||||||
|
hi Normal guifg=#44cc44 guibg=#000000
|
||||||
|
" |hit-enter| prompt and yes/no questions
|
||||||
|
hi Question guifg=#44cc44 guibg=#000000
|
||||||
|
" Last search pattern highlighting (see 'hlsearch').
|
||||||
|
hi Search guifg=#113311 guibg=#44cc44 gui=none
|
||||||
|
" Meta and special keys listed with ":map", also for text used
|
||||||
|
hi SpecialKey guifg=#44cc44 guibg=#000000
|
||||||
|
" status line of current window
|
||||||
|
hi StatusLine guifg=#55ff55 guibg=#339933 gui=none
|
||||||
|
" status lines of not-current windows
|
||||||
|
hi StatusLineNC guifg=#113311 guibg=#339933 gui=none
|
||||||
|
" titles for output from ":set all", ":autocmd" etc.
|
||||||
|
hi Title guifg=#55ff55 guibg=#113311 gui=bold
|
||||||
|
" Visual mode selection
|
||||||
|
hi Visual guifg=#55ff55 guibg=#339933 gui=none
|
||||||
|
" Visual mode selection when vim is "Not Owning the Selection".
|
||||||
|
hi VisualNOS guifg=#44cc44 guibg=#000000
|
||||||
|
" warning messages
|
||||||
|
hi WarningMsg guifg=#55ff55 guibg=#000000
|
||||||
|
" current match in 'wildmenu' completion
|
||||||
|
hi WildMenu guifg=#226622 guibg=#55ff55
|
||||||
|
|
||||||
|
hi Comment guifg=#226622 guibg=#000000
|
||||||
|
hi Constant guifg=#55ff55 guibg=#226622
|
||||||
|
hi Special guifg=#44cc44 guibg=#226622
|
||||||
|
hi Identifier guifg=#55ff55 guibg=#000000
|
||||||
|
hi Statement guifg=#55ff55 guibg=#000000 gui=bold
|
||||||
|
hi PreProc guifg=#339933 guibg=#000000
|
||||||
|
hi Type guifg=#55ff55 guibg=#000000 gui=bold
|
||||||
|
hi Underlined guifg=#55ff55 guibg=#000000 gui=underline
|
||||||
|
hi Error guifg=#55ff55 guibg=#339933
|
||||||
|
hi Todo guifg=#113311 guibg=#44cc44 gui=none
|
|
@ -0,0 +1,205 @@
|
||||||
|
if exists("g:moria_style")
|
||||||
|
let s:moria_style = g:moria_style
|
||||||
|
else
|
||||||
|
let s:moria_style = &background
|
||||||
|
endif
|
||||||
|
|
||||||
|
execute "command! -nargs=1 Colo let g:moria_style = \"<args>\" | colo moria"
|
||||||
|
|
||||||
|
if s:moria_style == "black" || s:moria_style == "dark" || s:moria_style == "darkslategray"
|
||||||
|
set background=dark
|
||||||
|
elseif s:moria_style == "light" || s:moria_style == "white"
|
||||||
|
set background=light
|
||||||
|
else
|
||||||
|
let s:moria_style = &background
|
||||||
|
endif
|
||||||
|
|
||||||
|
hi clear
|
||||||
|
|
||||||
|
if exists("syntax_on")
|
||||||
|
syntax reset
|
||||||
|
endif
|
||||||
|
|
||||||
|
let colors_name = "moria"
|
||||||
|
|
||||||
|
if &background == "dark"
|
||||||
|
if s:moria_style == "darkslategray"
|
||||||
|
hi Normal ctermbg=0 ctermfg=7 guibg=#2f4f4f guifg=#d0d0d0 gui=none
|
||||||
|
|
||||||
|
hi CursorColumn guibg=#404040 gui=none
|
||||||
|
hi CursorLine guibg=#404040 gui=none
|
||||||
|
hi FoldColumn ctermbg=bg guibg=bg guifg=#a0c0c0 gui=none
|
||||||
|
hi Folded guibg=#585858 guifg=#c0e0e0 gui=none
|
||||||
|
hi LineNr guifg=#a0c0c0 gui=none
|
||||||
|
hi NonText ctermfg=8 guibg=bg guifg=#a0c0c0 gui=bold
|
||||||
|
hi Pmenu guibg=#80a0a0 guifg=#000000 gui=none
|
||||||
|
hi PmenuSbar guibg=#608080 guifg=fg gui=none
|
||||||
|
hi PmenuThumb guibg=#c0e0e0 guifg=bg gui=none
|
||||||
|
hi SignColumn ctermbg=bg guibg=bg guifg=#a0c0c0 gui=none
|
||||||
|
hi StatusLine ctermbg=7 ctermfg=0 guibg=#507070 guifg=fg gui=bold
|
||||||
|
hi StatusLineNC ctermbg=8 ctermfg=0 guibg=#406060 guifg=fg gui=none
|
||||||
|
hi TabLine guibg=#567676 guifg=fg gui=underline
|
||||||
|
hi TabLineFill guibg=#567676 guifg=fg gui=underline
|
||||||
|
hi VertSplit ctermbg=7 ctermfg=0 guibg=#406060 guifg=fg gui=none
|
||||||
|
if version >= 700
|
||||||
|
hi Visual ctermbg=7 ctermfg=0 guibg=#608080 gui=none
|
||||||
|
else
|
||||||
|
hi Visual ctermbg=7 ctermfg=0 guibg=#608080 guifg=fg gui=none
|
||||||
|
endif
|
||||||
|
hi VisualNOS guibg=bg guifg=#90b0b0 gui=bold,underline
|
||||||
|
else
|
||||||
|
if s:moria_style == "dark"
|
||||||
|
hi Normal ctermbg=0 ctermfg=7 guibg=#202020 guifg=#d0d0d0 gui=none
|
||||||
|
|
||||||
|
hi CursorColumn guibg=#444444 gui=none
|
||||||
|
hi CursorLine guibg=#444444 gui=none
|
||||||
|
elseif s:moria_style == "black"
|
||||||
|
hi Normal ctermbg=0 ctermfg=7 guibg=#000000 guifg=#d0d0d0 gui=none
|
||||||
|
|
||||||
|
hi CursorColumn guibg=#3a3a3a gui=none
|
||||||
|
hi CursorLine guibg=#3a3a3a gui=none
|
||||||
|
endif
|
||||||
|
hi FoldColumn ctermbg=bg guibg=bg guifg=#a0b0c0 gui=none
|
||||||
|
hi Folded guibg=#585858 guifg=#c0d0e0 gui=none
|
||||||
|
hi LineNr guifg=#a0b0c0 gui=none
|
||||||
|
hi NonText ctermfg=8 guibg=bg guifg=#a0b0c0 gui=bold
|
||||||
|
hi Pmenu guibg=#8090a0 guifg=#000000 gui=none
|
||||||
|
hi PmenuSbar guibg=#607080 guifg=fg gui=none
|
||||||
|
hi PmenuThumb guibg=#c0d0e0 guifg=bg gui=none
|
||||||
|
hi SignColumn ctermbg=bg guibg=bg guifg=#a0b0c0 gui=none
|
||||||
|
hi StatusLine ctermbg=7 ctermfg=0 guibg=#485868 guifg=fg gui=bold
|
||||||
|
hi StatusLineNC ctermbg=8 ctermfg=0 guibg=#304050 guifg=fg gui=none
|
||||||
|
hi TabLine guibg=#566676 guifg=fg gui=underline
|
||||||
|
hi TabLineFill guibg=#566676 guifg=fg gui=underline
|
||||||
|
hi VertSplit ctermbg=7 ctermfg=0 guibg=#304050 guifg=fg gui=none
|
||||||
|
if version >= 700
|
||||||
|
hi Visual ctermbg=7 ctermfg=0 guibg=#607080 gui=none
|
||||||
|
else
|
||||||
|
hi Visual ctermbg=7 ctermfg=0 guibg=#607080 guifg=fg gui=none
|
||||||
|
endif
|
||||||
|
hi VisualNOS guibg=bg guifg=#90a0b0 gui=bold,underline
|
||||||
|
endif
|
||||||
|
hi Cursor guibg=#ffa500 guifg=bg gui=none
|
||||||
|
hi DiffAdd guibg=#008b00 guifg=fg gui=none
|
||||||
|
hi DiffChange guibg=#00008b guifg=fg gui=none
|
||||||
|
hi DiffDelete guibg=#8b0000 guifg=fg gui=none
|
||||||
|
hi DiffText guibg=#0000cd guifg=fg gui=bold
|
||||||
|
hi Directory guibg=bg guifg=#1e90ff gui=none
|
||||||
|
hi ErrorMsg guibg=#ee2c2c guifg=#ffffff gui=bold
|
||||||
|
hi IncSearch guibg=#e0cd78 guifg=#000000 gui=none
|
||||||
|
hi ModeMsg guibg=bg guifg=fg gui=bold
|
||||||
|
hi MoreMsg guibg=bg guifg=#7ec0ee gui=bold
|
||||||
|
hi PmenuSel guibg=#e0e000 guifg=#000000 gui=none
|
||||||
|
hi Question guibg=bg guifg=#e8b87e gui=bold
|
||||||
|
hi Search guibg=#90e090 guifg=#000000 gui=none
|
||||||
|
hi SpecialKey guibg=bg guifg=#e8b87e gui=none
|
||||||
|
if has("spell")
|
||||||
|
hi SpellBad guisp=#ee2c2c gui=undercurl
|
||||||
|
hi SpellCap guisp=#2c2cee gui=undercurl
|
||||||
|
hi SpellLocal guisp=#2ceeee gui=undercurl
|
||||||
|
hi SpellRare guisp=#ee2cee gui=undercurl
|
||||||
|
endif
|
||||||
|
hi TabLineSel guibg=bg guifg=fg gui=bold
|
||||||
|
hi Title ctermbg=0 ctermfg=15 guifg=fg gui=bold
|
||||||
|
hi WarningMsg guibg=bg guifg=#ee2c2c gui=bold
|
||||||
|
hi WildMenu guibg=#e0e000 guifg=#000000 gui=bold
|
||||||
|
|
||||||
|
hi Comment guibg=bg guifg=#d0d0a0 gui=none
|
||||||
|
hi Constant guibg=bg guifg=#87df71 gui=none
|
||||||
|
hi Error guibg=bg guifg=#ee2c2c gui=none
|
||||||
|
hi Identifier guibg=bg guifg=#7ee0ce gui=none
|
||||||
|
hi Ignore guibg=bg guifg=bg gui=none
|
||||||
|
hi lCursor guibg=#00e700 guifg=#000000 gui=none
|
||||||
|
hi MatchParen guibg=#008b8b gui=none
|
||||||
|
hi PreProc guibg=bg guifg=#d7a0d7 gui=none
|
||||||
|
hi Special guibg=bg guifg=#e8b87e gui=none
|
||||||
|
hi Statement guibg=bg guifg=#7ec0ee gui=none
|
||||||
|
hi Todo guibg=#e0e000 guifg=#000000 gui=none
|
||||||
|
hi Type guibg=bg guifg=#f09479 gui=none
|
||||||
|
hi Underlined guibg=bg guifg=#00a0ff gui=underline
|
||||||
|
|
||||||
|
hi htmlBold ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold
|
||||||
|
hi htmlItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=italic
|
||||||
|
hi htmlUnderline ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=underline
|
||||||
|
hi htmlBoldItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,italic
|
||||||
|
hi htmlBoldUnderline ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,underline
|
||||||
|
hi htmlBoldUnderlineItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,underline,italic
|
||||||
|
hi htmlUnderlineItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=underline,italic
|
||||||
|
elseif &background == "light"
|
||||||
|
if s:moria_style == "light"
|
||||||
|
hi Normal ctermbg=15 ctermfg=0 guibg=#f0f0f0 guifg=#000000 gui=none
|
||||||
|
|
||||||
|
hi CursorColumn guibg=#d4d4d4 gui=none
|
||||||
|
hi CursorLine guibg=#d4d4d4 gui=none
|
||||||
|
elseif s:moria_style == "white"
|
||||||
|
hi Normal ctermbg=15 ctermfg=0 guibg=#ffffff guifg=#000000 gui=none
|
||||||
|
|
||||||
|
hi CursorColumn guibg=#dbdbdb gui=none
|
||||||
|
hi CursorLine guibg=#dbdbdb gui=none
|
||||||
|
endif
|
||||||
|
hi Cursor guibg=#883400 guifg=bg gui=none
|
||||||
|
hi DiffAdd guibg=#008b00 guifg=#ffffff gui=none
|
||||||
|
hi DiffChange guibg=#00008b guifg=#ffffff gui=none
|
||||||
|
hi DiffDelete guibg=#8b0000 guifg=#ffffff gui=none
|
||||||
|
hi DiffText guibg=#0000cd guifg=#ffffff gui=bold
|
||||||
|
hi Directory guibg=bg guifg=#0000f0 gui=none
|
||||||
|
hi ErrorMsg guibg=#ee2c2c guifg=#ffffff gui=bold
|
||||||
|
hi FoldColumn ctermbg=bg guibg=bg guifg=#506070 gui=none
|
||||||
|
hi Folded guibg=#c5c5c5 guifg=#203040 gui=none
|
||||||
|
hi IncSearch guibg=#ffcd78 gui=none
|
||||||
|
hi LineNr guifg=#506070 gui=none
|
||||||
|
hi ModeMsg ctermbg=15 ctermfg=0 guibg=bg guifg=fg gui=bold
|
||||||
|
hi MoreMsg guibg=bg guifg=#1f3f81 gui=bold
|
||||||
|
hi NonText ctermfg=8 guibg=bg guifg=#506070 gui=bold
|
||||||
|
hi Pmenu guibg=#8a9aaa guifg=#000000 gui=none
|
||||||
|
hi PmenuSbar guibg=#708090 guifg=fg gui=none
|
||||||
|
hi PmenuSel guibg=#ffff00 guifg=#000000 gui=none
|
||||||
|
hi PmenuThumb guibg=#b0c0d0 guifg=fg gui=none
|
||||||
|
hi Question guibg=bg guifg=#813f11 gui=bold
|
||||||
|
hi Search guibg=#a0f0a0 gui=none
|
||||||
|
hi SignColumn ctermbg=bg guibg=bg guifg=#506070 gui=none
|
||||||
|
hi SpecialKey guibg=bg guifg=#912f11 gui=none
|
||||||
|
if has("spell")
|
||||||
|
hi SpellBad guisp=#ee2c2c gui=undercurl
|
||||||
|
hi SpellCap guisp=#2c2cee gui=undercurl
|
||||||
|
hi SpellLocal guisp=#008b8b gui=undercurl
|
||||||
|
hi SpellRare guisp=#ee2cee gui=undercurl
|
||||||
|
endif
|
||||||
|
hi StatusLine ctermbg=0 ctermfg=15 guibg=#a0b0c0 guifg=fg gui=bold
|
||||||
|
hi StatusLineNC ctermbg=7 ctermfg=0 guibg=#b0c0d0 guifg=fg gui=none
|
||||||
|
hi TabLine guibg=#b4c4d4 guifg=fg gui=underline
|
||||||
|
hi TabLineFill guibg=#b4c4d4 guifg=fg gui=underline
|
||||||
|
hi TabLineSel guibg=bg guifg=fg gui=bold
|
||||||
|
hi Title guifg=fg gui=bold
|
||||||
|
hi VertSplit ctermbg=7 ctermfg=0 guibg=#b0c0d0 guifg=fg gui=none
|
||||||
|
if version >= 700
|
||||||
|
hi Visual ctermbg=7 ctermfg=0 guibg=#c0d0e0 gui=none
|
||||||
|
else
|
||||||
|
hi Visual ctermbg=7 ctermfg=0 guibg=#c0d0e0 guifg=fg gui=none
|
||||||
|
endif
|
||||||
|
hi VisualNOS guibg=bg guifg=#90a0b0 gui=bold,underline
|
||||||
|
hi WarningMsg guibg=bg guifg=#ee2c2c gui=bold
|
||||||
|
hi WildMenu guibg=#ffff00 guifg=fg gui=bold
|
||||||
|
|
||||||
|
hi Comment guibg=bg guifg=#786000 gui=none
|
||||||
|
hi Constant guibg=bg guifg=#077807 gui=none
|
||||||
|
hi Error guibg=bg guifg=#ee2c2c gui=none
|
||||||
|
hi Identifier guibg=bg guifg=#007080 gui=none
|
||||||
|
hi Ignore guibg=bg guifg=bg gui=none
|
||||||
|
hi lCursor guibg=#008000 guifg=#ffffff gui=none
|
||||||
|
hi MatchParen guibg=#00ffff gui=none
|
||||||
|
hi PreProc guibg=bg guifg=#800090 gui=none
|
||||||
|
hi Special guibg=bg guifg=#912f11 gui=none
|
||||||
|
hi Statement guibg=bg guifg=#1f3f81 gui=bold
|
||||||
|
hi Todo guibg=#ffff00 guifg=fg gui=none
|
||||||
|
hi Type guibg=bg guifg=#912f11 gui=bold
|
||||||
|
hi Underlined guibg=bg guifg=#0000cd gui=underline
|
||||||
|
|
||||||
|
hi htmlBold guibg=bg guifg=fg gui=bold
|
||||||
|
hi htmlItalic guibg=bg guifg=fg gui=italic
|
||||||
|
hi htmlUnderline guibg=bg guifg=fg gui=underline
|
||||||
|
hi htmlBoldItalic guibg=bg guifg=fg gui=bold,italic
|
||||||
|
hi htmlBoldUnderline guibg=bg guifg=fg gui=bold,underline
|
||||||
|
hi htmlBoldUnderlineItalic guibg=bg guifg=fg gui=bold,underline,italic
|
||||||
|
hi htmlUnderlineItalic guibg=bg guifg=fg gui=underline,italic
|
||||||
|
endif
|
|
@ -0,0 +1,111 @@
|
||||||
|
" Vim color file
|
||||||
|
" Maintainer: Tom Regner <regner@dievision.de>
|
||||||
|
" Last Change: 2002-12-05
|
||||||
|
" Version: 1.1
|
||||||
|
" URL: http://vim.sourceforge.net/script.php?script_id=368
|
||||||
|
|
||||||
|
|
||||||
|
""" Init
|
||||||
|
set background=dark
|
||||||
|
highlight clear
|
||||||
|
if exists("syntax_on")
|
||||||
|
syntax reset
|
||||||
|
endif
|
||||||
|
let g:colors_name = "oceandeep"
|
||||||
|
|
||||||
|
|
||||||
|
""""""""\ Colors \""""""""
|
||||||
|
|
||||||
|
|
||||||
|
"""" GUI Colors
|
||||||
|
|
||||||
|
highlight Cursor gui=None guibg=PaleTurquoise3 guifg=White
|
||||||
|
highlight CursorIM gui=bold guifg=white guibg=PaleTurquoise3
|
||||||
|
highlight Directory guifg=LightSeaGreen guibg=bg
|
||||||
|
highlight DiffAdd gui=None guifg=fg guibg=DarkCyan
|
||||||
|
highlight DiffChange gui=None guifg=fg guibg=Green4
|
||||||
|
highlight DiffDelete gui=None guifg=fg guibg=black
|
||||||
|
highlight DiffText gui=bold guifg=fg guibg=bg
|
||||||
|
highlight ErrorMsg guifg=LightYellow guibg=FireBrick
|
||||||
|
" previously 'FillColumn':
|
||||||
|
"highlight FillColumn gui=NONE guifg=black guibg=grey60
|
||||||
|
highlight VertSplit gui=NONE guifg=black guibg=grey60
|
||||||
|
highlight Folded gui=bold guibg=#305060 guifg=#b0d0e0
|
||||||
|
highlight FoldColumn gui=bold guibg=#305060 guifg=#b0d0e0
|
||||||
|
highlight IncSearch gui=reverse guifg=fg guibg=bg
|
||||||
|
highlight LineNr gui=bold guibg=grey6 guifg=LightSkyBlue3
|
||||||
|
highlight ModeMsg guibg=DarkGreen guifg=LightGreen
|
||||||
|
highlight MoreMsg gui=bold guifg=SeaGreen4 guibg=bg
|
||||||
|
if version < 600
|
||||||
|
" same as SpecialKey
|
||||||
|
highlight NonText guibg=#123A4A guifg=#3D5D6D
|
||||||
|
else
|
||||||
|
" Bottom fill (use e.g. same as LineNr)
|
||||||
|
highlight NonText gui=None guibg=#103040 guifg=LightSkyBlue
|
||||||
|
endif
|
||||||
|
highlight Normal gui=None guibg=#103040 guifg=honeydew2
|
||||||
|
highlight Question gui=bold guifg=SeaGreen2 guibg=bg
|
||||||
|
highlight Search gui=NONE guibg=LightSkyBlue4 guifg=NONE
|
||||||
|
highlight SpecialKey guibg=#103040 guifg=#324262
|
||||||
|
highlight StatusLine gui=bold guibg=grey88 guifg=black
|
||||||
|
highlight StatusLineNC gui=NONE guibg=grey60 guifg=grey10
|
||||||
|
highlight Title gui=bold guifg=MediumOrchid1 guibg=bg
|
||||||
|
highlight Visual gui=reverse guibg=WHITE guifg=SeaGreen
|
||||||
|
highlight VisualNOS gui=bold,underline guifg=fg guibg=bg
|
||||||
|
highlight WarningMsg gui=bold guifg=FireBrick1 guibg=bg
|
||||||
|
highlight WildMenu gui=bold guibg=Chartreuse guifg=Black
|
||||||
|
|
||||||
|
|
||||||
|
"""" Syntax Colors
|
||||||
|
|
||||||
|
"highlight Comment gui=reverse guifg=#507080
|
||||||
|
highlight Comment gui=None guifg=#507080
|
||||||
|
|
||||||
|
highlight Constant guifg=cyan3 guibg=bg
|
||||||
|
hi String gui=None guifg=turquoise2 guibg=bg
|
||||||
|
"hi Character gui=None guifg=Cyan guibg=bg
|
||||||
|
highlight Number gui=None guifg=Cyan guibg=bg
|
||||||
|
highlight Boolean gui=bold guifg=Cyan guibg=bg
|
||||||
|
"hi Float gui=None guifg=Cyan guibg=bg
|
||||||
|
|
||||||
|
highlight Identifier guifg=LightSkyBlue3
|
||||||
|
hi Function gui=None guifg=DarkSeaGreen3 guibg=bg
|
||||||
|
|
||||||
|
highlight Statement gui=NONE guifg=LightGreen
|
||||||
|
highlight Conditional gui=None guifg=LightGreen guibg=bg
|
||||||
|
highlight Repeat gui=None guifg=SeaGreen2 guibg=bg
|
||||||
|
"hi Label gui=None guifg=LightGreen guibg=bg
|
||||||
|
highlight Operator gui=None guifg=Chartreuse guibg=bg
|
||||||
|
highlight Keyword gui=bold guifg=LightGreen guibg=bg
|
||||||
|
highlight Exception gui=bold guifg=LightGreen guibg=bg
|
||||||
|
|
||||||
|
highlight PreProc guifg=SkyBlue1
|
||||||
|
hi Include gui=None guifg=LightSteelBlue3 guibg=bg
|
||||||
|
hi Define gui=None guifg=LightSteelBlue2 guibg=bg
|
||||||
|
hi Macro gui=None guifg=LightSkyBlue3 guibg=bg
|
||||||
|
hi PreCondit gui=None guifg=LightSkyBlue2 guibg=bg
|
||||||
|
|
||||||
|
highlight Type gui=NONE guifg=LightBlue
|
||||||
|
hi StorageClass gui=None guifg=LightBlue guibg=bg
|
||||||
|
hi Structure gui=None guifg=LightBlue guibg=bg
|
||||||
|
hi Typedef gui=None guifg=LightBlue guibg=bg
|
||||||
|
|
||||||
|
highlight Special gui=bold guifg=aquamarine3
|
||||||
|
"hi SpecialChar gui=bold guifg=White guibg=bg
|
||||||
|
"hi Tag gui=bold guifg=White guibg=bg
|
||||||
|
"hi Delimiter gui=bold guifg=White guibg=bg
|
||||||
|
"hi SpecialComment gui=bold guifg=White guibg=bg
|
||||||
|
"hi Debug gui=bold guifg=White guibg=bg
|
||||||
|
|
||||||
|
highlight Underlined gui=underline guifg=honeydew4 guibg=bg
|
||||||
|
|
||||||
|
highlight Ignore guifg=#204050
|
||||||
|
|
||||||
|
highlight Error guifg=LightYellow guibg=FireBrick
|
||||||
|
|
||||||
|
highlight Todo guifg=Cyan guibg=#507080
|
||||||
|
|
||||||
|
""" OLD COLORS
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,133 @@
|
||||||
|
" Vim color file
|
||||||
|
" Maintainer: Jani Nurminen <jani.nurminen@intellitel.com>
|
||||||
|
" Last Change: $Id$
|
||||||
|
" URL: Not yet...
|
||||||
|
" License: GPL
|
||||||
|
"
|
||||||
|
" Nothing too fancy, just some alien fruit salad to keep you in the zone.
|
||||||
|
" This syntax file was designed to be used with dark environments and
|
||||||
|
" low light situations. Of course, if it works during a daybright office, go
|
||||||
|
" ahead :)
|
||||||
|
"
|
||||||
|
" Owes heavily to other Vim color files! With special mentions
|
||||||
|
" to "BlackDust", "Camo" and "Desert".
|
||||||
|
"
|
||||||
|
" To install, copy to ~/.vim/colors directory. Then :colorscheme zenburn.
|
||||||
|
" See also :help syntax
|
||||||
|
"
|
||||||
|
" CONFIGURABLE PARAMETERS:
|
||||||
|
"
|
||||||
|
" You can use the default (don't set any parameters), or you can
|
||||||
|
" set some parameters to tweak the Zenlook colours.
|
||||||
|
"
|
||||||
|
" * To get more contrast to the Visual selection, use
|
||||||
|
"
|
||||||
|
" let g:zenburn_alternate_Visual = 1
|
||||||
|
"
|
||||||
|
" * To use alternate colouring for Error message, use
|
||||||
|
"
|
||||||
|
" let g:zenburn_alternate_Error = 1
|
||||||
|
"
|
||||||
|
" * The new default for Include is a duller orang.e To use the original
|
||||||
|
" colouring for Include, use
|
||||||
|
"
|
||||||
|
" let g:zenburn_alternate_Include = 1
|
||||||
|
"
|
||||||
|
" * To turn the parameter(s) back to defaults, use unlet.
|
||||||
|
"
|
||||||
|
" That's it, enjoy!
|
||||||
|
"
|
||||||
|
" TODO
|
||||||
|
" - IME colouring (CursorIM)
|
||||||
|
" - obscure syntax groups: check and colourize
|
||||||
|
" - add more groups if necessary
|
||||||
|
|
||||||
|
set background=dark
|
||||||
|
hi clear
|
||||||
|
if exists("syntax_on")
|
||||||
|
syntax reset
|
||||||
|
endif
|
||||||
|
let g:colors_name="zenburn"
|
||||||
|
|
||||||
|
hi Boolean guifg=#dca3a3
|
||||||
|
hi Character guifg=#dca3a3 gui=bold
|
||||||
|
hi Comment guifg=#7f9f7f
|
||||||
|
hi Conditional guifg=#f0dfaf gui=bold
|
||||||
|
hi Constant guifg=#dca3a3 gui=bold
|
||||||
|
hi Cursor guifg=#000d18 guibg=#8faf9f gui=bold
|
||||||
|
hi Debug guifg=#dca3a3 gui=bold
|
||||||
|
hi Define guifg=#ffcfaf gui=bold
|
||||||
|
hi Delimiter guifg=#8f8f8f
|
||||||
|
hi DiffAdd guifg=#709080 guibg=#313c36 gui=bold
|
||||||
|
hi DiffChange guibg=#333333
|
||||||
|
hi DiffDelete guifg=#333333 guibg=#464646
|
||||||
|
hi DiffText guifg=#ecbcbc guibg=#41363c gui=bold
|
||||||
|
hi Directory guifg=#dcdccc gui=bold
|
||||||
|
hi ErrorMsg guifg=#60b48a guibg=#3f3f3f gui=bold
|
||||||
|
hi Exception guifg=#c3bf9f gui=bold
|
||||||
|
hi Float guifg=#c0bed1
|
||||||
|
hi FoldColumn guifg=#93b3a3 guibg=#3f4040
|
||||||
|
hi Folded guifg=#93b3a3 guibg=#3f4040
|
||||||
|
hi Function guifg=#efef8f
|
||||||
|
hi Identifier guifg=#efdcbc
|
||||||
|
hi IncSearch guibg=#f8f893 guifg=#385f38
|
||||||
|
hi Keyword guifg=#f0dfaf gui=bold
|
||||||
|
hi Label guifg=#dfcfaf gui=underline
|
||||||
|
hi LineNr guifg=#7f8f8f guibg=#464646
|
||||||
|
hi Macro guifg=#ffcfaf gui=bold
|
||||||
|
hi ModeMsg guifg=#ffcfaf gui=none
|
||||||
|
hi MoreMsg guifg=#ffffff gui=bold
|
||||||
|
hi NonText guifg=#404040
|
||||||
|
hi Normal guifg=#dcdccc guibg=#3f3f3f
|
||||||
|
hi Number guifg=#8cd0d3
|
||||||
|
hi Operator guifg=#f0efd0
|
||||||
|
hi PreCondit guifg=#dfaf8f gui=bold
|
||||||
|
hi PreProc guifg=#ffcfaf gui=bold
|
||||||
|
hi Question guifg=#ffffff gui=bold
|
||||||
|
hi Repeat guifg=#ffd7a7 gui=bold
|
||||||
|
hi Search guifg=#ffffe0 guibg=#385f38
|
||||||
|
hi SpecialChar guifg=#dca3a3 gui=bold
|
||||||
|
hi SpecialComment guifg=#82a282 gui=bold
|
||||||
|
hi Special guifg=#cfbfaf
|
||||||
|
hi SpecialKey guifg=#9ece9e
|
||||||
|
hi Statement guifg=#e3ceab guibg=#3f3f3f gui=none
|
||||||
|
hi StatusLine guifg=#1e2320 guibg=#acbc90
|
||||||
|
hi StatusLineNC guifg=#2e3330 guibg=#88b090
|
||||||
|
hi StorageClass guifg=#c3bf9f gui=bold
|
||||||
|
hi String guifg=#cc9393
|
||||||
|
hi Structure guifg=#efefaf gui=bold
|
||||||
|
hi Tag guifg=#dca3a3 gui=bold
|
||||||
|
hi Title guifg=#efefef guibg=#3f3f3f gui=bold
|
||||||
|
hi Todo guifg=#7faf8f guibg=#3f3f3f gui=bold
|
||||||
|
hi Typedef guifg=#dfe4cf gui=bold
|
||||||
|
hi Type guifg=#dfdfbf gui=bold
|
||||||
|
hi Underlined guifg=#dcdccc guibg=#3f3f3f gui=underline
|
||||||
|
hi VertSplit guifg=#303030 guibg=#688060
|
||||||
|
hi VisualNOS guifg=#333333 guibg=#f18c96 gui=bold,underline
|
||||||
|
hi WarningMsg guifg=#ffffff guibg=#333333 gui=bold
|
||||||
|
hi WildMenu guibg=#2c302d guifg=#cbecd0 gui=underline
|
||||||
|
|
||||||
|
if exists("g:zenburn_alternate_Visual")
|
||||||
|
" Visual with more contrast, thanks to Steve Hall & Cream posse
|
||||||
|
hi Visual guifg=#000000 guibg=#71d3b4
|
||||||
|
else
|
||||||
|
" use default visual
|
||||||
|
hi Visual guifg=#233323 guibg=#71d3b4
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("g:zenburn_alternate_Error")
|
||||||
|
" use a bit different Error
|
||||||
|
hi Error guifg=#ef9f9f guibg=#201010 gui=bold
|
||||||
|
else
|
||||||
|
" default
|
||||||
|
hi Error guifg=#e37170 guibg=#332323 gui=none
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("g:zenburn_alternate_Include")
|
||||||
|
" original setting
|
||||||
|
hi Include guifg=#ffcfaf gui=bold
|
||||||
|
else
|
||||||
|
" new, less contrasted one
|
||||||
|
hi Include guifg=#dfaf8f gui=bold
|
||||||
|
endif
|
||||||
|
" TODO check every syntax group that they're ok
|
|
@ -0,0 +1,991 @@
|
||||||
|
*NERD_commenter.txt* Plugin for commenting code
|
||||||
|
|
||||||
|
|
||||||
|
NERD COMMENTER REFERENCE MANUAL~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
CONTENTS *NERDCommenterContents*
|
||||||
|
|
||||||
|
1.Intro...................................|NERDCommenter|
|
||||||
|
2.Functionality provided..................|NERDComFunctionality|
|
||||||
|
2.1 Functionality Summary.............|NERDComFunctionalitySummary|
|
||||||
|
2.2 Functionality Details.............|NERDComFunctionalityDetails|
|
||||||
|
2.2.1 Comment map.................|NERDComComment|
|
||||||
|
2.2.2 Nested comment map..........|NERDComNestedComment|
|
||||||
|
2.2.3 Toggle comment map..........|NERDComToggleComment|
|
||||||
|
2.2.4 Minimal comment map.........|NERDComMinimalComment|
|
||||||
|
2.2.5 Invert comment map..........|NERDComInvertComment|
|
||||||
|
2.2.6 Sexy comment map............|NERDComSexyComment|
|
||||||
|
2.2.7 Yank comment map............|NERDComYankComment|
|
||||||
|
2.2.8 Comment to EOL map..........|NERDComEOLComment|
|
||||||
|
2.2.9 Append com to line map......|NERDComAppendComment|
|
||||||
|
2.2.10 Insert comment map.........|NERDComInsertComment|
|
||||||
|
2.2.11 Use alternate delims map...|NERDComAltDelim|
|
||||||
|
2.2.12 Comment aligned maps.......|NERDComAlignedComment|
|
||||||
|
2.2.13 Uncomment line map.........|NERDComUncommentLine|
|
||||||
|
2.3 Supported filetypes...............|NERDComFiletypes|
|
||||||
|
2.4 Sexy Comments.....................|NERDComSexyComments|
|
||||||
|
2.5 The NERDComment function..........|NERDComNERDComment|
|
||||||
|
3.Options.................................|NERDComOptions|
|
||||||
|
3.1 Options summary...................|NERDComOptionsSummary|
|
||||||
|
3.2 Options details...................|NERDComOptionsDetails|
|
||||||
|
3.3 Default delimiter Options.........|NERDComDefaultDelims|
|
||||||
|
4. Customising key mappings...............|NERDComMappings|
|
||||||
|
5. Issues with the script.................|NERDComIssues|
|
||||||
|
5.1 Delimiter detection heuristics....|NERDComHeuristics|
|
||||||
|
5.2 Nesting issues....................|NERDComNesting|
|
||||||
|
6.About.. ............................|NERDComAbout|
|
||||||
|
7.Changelog...............................|NERDComChangelog|
|
||||||
|
8.Credits.................................|NERDComCredits|
|
||||||
|
9.License.................................|NERDComLicense|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
1. Intro *NERDCommenter*
|
||||||
|
|
||||||
|
The NERD commenter provides many different commenting operations and styles
|
||||||
|
which are invoked via key mappings and a menu. These operations are available
|
||||||
|
for most filetypes.
|
||||||
|
|
||||||
|
There are also options that allow to tweak the commenting engine to your
|
||||||
|
taste.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
2. Functionality provided *NERDComFunctionality*
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.1 Functionality summary *NERDComFunctionalitySummary*
|
||||||
|
|
||||||
|
The following key mappings are provided by default (there is also a menu
|
||||||
|
with items corresponding to all the mappings below):
|
||||||
|
|
||||||
|
[count],cc |NERDComComment|
|
||||||
|
Comment out the current line or text selected in visual mode.
|
||||||
|
|
||||||
|
|
||||||
|
[count],cn |NERDComNestedComment|
|
||||||
|
Same as ,cc but forces nesting.
|
||||||
|
|
||||||
|
|
||||||
|
[count],c<space> |NERDComToggleComment|
|
||||||
|
Toggles the comment state of the selected line(s). If the topmost selected
|
||||||
|
line is commented, all selected lines are uncommented and vice versa.
|
||||||
|
|
||||||
|
|
||||||
|
[count],cm |NERDComMinimalComment|
|
||||||
|
Comments the given lines using only one set of multipart delimiters.
|
||||||
|
|
||||||
|
|
||||||
|
[count],ci |NERDComInvertComment|
|
||||||
|
Toggles the comment state of the selected line(s) individually.
|
||||||
|
|
||||||
|
|
||||||
|
[count],cs |NERDComSexyComment|
|
||||||
|
Comments out the selected lines ``sexily''
|
||||||
|
|
||||||
|
|
||||||
|
[count],cy |NERDComYankComment|
|
||||||
|
Same as ,cc except that the commented line(s) are yanked first.
|
||||||
|
|
||||||
|
|
||||||
|
,c$ |NERDComEOLComment|
|
||||||
|
Comments the current line from the cursor to the end of line.
|
||||||
|
|
||||||
|
|
||||||
|
,cA |NERDComAppendComment|
|
||||||
|
Adds comment delimiters to the end of line and goes into insert mode between
|
||||||
|
them.
|
||||||
|
|
||||||
|
|
||||||
|
|NERDComInsertComment|
|
||||||
|
Adds comment delimiters at the current cursor position and inserts between.
|
||||||
|
Disabled by default.
|
||||||
|
|
||||||
|
|
||||||
|
,ca |NERDComAltDelim|
|
||||||
|
Switches to the alternative set of delimiters.
|
||||||
|
|
||||||
|
|
||||||
|
[count],cl
|
||||||
|
[count],cb |NERDComAlignedComment|
|
||||||
|
Same as |NERDComComment| except that the delimiters are aligned down the
|
||||||
|
left side (,cl) or both sides (,cb).
|
||||||
|
|
||||||
|
|
||||||
|
[count],cu |NERDComUncommentLine|
|
||||||
|
Uncomments the selected line(s).
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2 Functionality details *NERDComFunctionalityDetails*
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.1 Comment map *NERDComComment*
|
||||||
|
|
||||||
|
Default mapping: [count],cc
|
||||||
|
Mapped to: <plug>NERDCommenterComment
|
||||||
|
Applicable modes: normal visual visual-line visual-block.
|
||||||
|
|
||||||
|
|
||||||
|
Comments out the current line. If multiple lines are selected in visual-line
|
||||||
|
mode, they are all commented out. If some text is selected in visual or
|
||||||
|
visual-block mode then the script will try to comment out the exact text that
|
||||||
|
is selected using multi-part delimiters if they are available.
|
||||||
|
|
||||||
|
If a [count] is given in normal mode, the mapping works as though that many
|
||||||
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.2 Nested comment map *NERDComNestedComment*
|
||||||
|
|
||||||
|
Default mapping: [count],cn
|
||||||
|
Mapped to: <plug>NERDCommenterNest
|
||||||
|
Applicable modes: normal visual visual-line visual-block.
|
||||||
|
|
||||||
|
Performs nested commenting. Works the same as ,cc except that if a line is
|
||||||
|
already commented then it will be commented again.
|
||||||
|
|
||||||
|
If |'NERDUsePlaceHolders'| is set then the previous comment delimiters will
|
||||||
|
be replaced by place-holder delimiters if needed. Otherwise the nested
|
||||||
|
comment will only be added if the current commenting delimiters have no right
|
||||||
|
delimiter (to avoid syntax errors)
|
||||||
|
|
||||||
|
If a [count] is given in normal mode, the mapping works as though that many
|
||||||
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
|
Related options:
|
||||||
|
|'NERDDefaultNesting'|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.3 Toggle comment map *NERDComToggleComment*
|
||||||
|
|
||||||
|
Default mapping: [count],c<space>
|
||||||
|
Mapped to: <plug>NERDCommenterToggle
|
||||||
|
Applicable modes: normal visual-line.
|
||||||
|
|
||||||
|
Toggles commenting of the lines selected. The behaviour of this mapping
|
||||||
|
depends on whether the first line selected is commented or not. If so, all
|
||||||
|
selected lines are uncommented and vice versa.
|
||||||
|
|
||||||
|
With this mapping, a line is only considered to be commented if it starts with
|
||||||
|
a left delimiter.
|
||||||
|
|
||||||
|
If a [count] is given in normal mode, the mapping works as though that many
|
||||||
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.4 Minimal comment map *NERDComMinimalComment*
|
||||||
|
|
||||||
|
Default mapping: [count],cm
|
||||||
|
Mapped to: <plug>NERDCommenterMinimal
|
||||||
|
Applicable modes: normal visual-line.
|
||||||
|
|
||||||
|
Comments the selected lines using one set of multipart delimiters if possible.
|
||||||
|
|
||||||
|
For example: if you are programming in c and you select 5 lines and press ,cm
|
||||||
|
then a '/*' will be placed at the start of the top line and a '*/' will be
|
||||||
|
placed at the end of the last line.
|
||||||
|
|
||||||
|
Sets of multipart comment delimiters that are between the top and bottom
|
||||||
|
selected lines are replaced with place holders (see |'NERDLPlace'|) if
|
||||||
|
|'NERDUsePlaceHolders'| is set for the current filetype. If it is not, then
|
||||||
|
the comment will be aborted if place holders are required to prevent illegal
|
||||||
|
syntax.
|
||||||
|
|
||||||
|
If a [count] is given in normal mode, the mapping works as though that many
|
||||||
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.5 Invert comment map *NERDComInvertComment*
|
||||||
|
|
||||||
|
Default mapping: ,ci
|
||||||
|
Mapped to: <plug>NERDCommenterInvert
|
||||||
|
Applicable modes: normal visual-line.
|
||||||
|
|
||||||
|
Inverts the commented state of each selected line. If the a selected line is
|
||||||
|
commented then it is uncommented and vice versa. Each line is examined and
|
||||||
|
commented/uncommented individually.
|
||||||
|
|
||||||
|
With this mapping, a line is only considered to be commented if it starts with
|
||||||
|
a left delimiter.
|
||||||
|
|
||||||
|
If a [count] is given in normal mode, the mapping works as though that many
|
||||||
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.6 Sexy comment map *NERDComSexyComment*
|
||||||
|
|
||||||
|
Default mapping: [count],cs
|
||||||
|
Mapped to: <plug>NERDCommenterSexy
|
||||||
|
Applicable modes: normal, visual-line.
|
||||||
|
|
||||||
|
Comments the selected line(s) ``sexily''... see |NERDComSexyComments| for
|
||||||
|
a description of what sexy comments are. Can only be done on filetypes for
|
||||||
|
which there is at least one set of multipart comment delimiters specified.
|
||||||
|
|
||||||
|
Sexy comments cannot be nested and lines inside a sexy comment cannot be
|
||||||
|
commented again.
|
||||||
|
|
||||||
|
If a [count] is given in normal mode, the mapping works as though that many
|
||||||
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
|
Related options:
|
||||||
|
|'NERDCompactSexyComs'|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.7 Yank comment map *NERDComYankComment*
|
||||||
|
|
||||||
|
Default mapping: [count],cy
|
||||||
|
Mapped to: <plug>NERDCommenterYank
|
||||||
|
Applicable modes: normal visual visual-line visual-block.
|
||||||
|
|
||||||
|
Same as ,cc except that it yanks the line(s) that are commented first.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.8 Comment to EOL map *NERDComEOLComment*
|
||||||
|
|
||||||
|
Default mapping: ,c$
|
||||||
|
Mapped to: <plug>NERDCommenterToEOL
|
||||||
|
Applicable modes: normal.
|
||||||
|
|
||||||
|
Comments the current line from the current cursor position up to the end of
|
||||||
|
the line.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.9 Append com to line map *NERDComAppendComment*
|
||||||
|
|
||||||
|
Default mapping: ,cA
|
||||||
|
Mapped to: <plug>NERDCommenterAppend
|
||||||
|
Applicable modes: normal.
|
||||||
|
|
||||||
|
Appends comment delimiters to the end of the current line and goes
|
||||||
|
to insert mode between the new delimiters.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.10 Insert comment map *NERDComInsertComment*
|
||||||
|
|
||||||
|
Default mapping: disabled by default.
|
||||||
|
Map it to: <plug>NERDCommenterInInsert
|
||||||
|
Applicable modes: insert.
|
||||||
|
|
||||||
|
Adds comment delimiters at the current cursor position and inserts
|
||||||
|
between them.
|
||||||
|
|
||||||
|
NOTE: prior to version 2.1.17 this was mapped to ctrl-c. To restore this
|
||||||
|
mapping add >
|
||||||
|
let NERDComInsertMap='<c-c>'
|
||||||
|
<
|
||||||
|
to your vimrc.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.11 Use alternate delims map *NERDComAltDelim*
|
||||||
|
|
||||||
|
Default mapping: ,ca
|
||||||
|
Mapped to: <plug>NERDCommenterAltDelims
|
||||||
|
Applicable modes: normal.
|
||||||
|
|
||||||
|
Changes to the alternative commenting style if one is available. For example,
|
||||||
|
if the user is editing a c++ file using // comments and they hit ,ca
|
||||||
|
then they will be switched over to /**/ comments.
|
||||||
|
|
||||||
|
See also |NERDComDefaultDelims|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.12 Comment aligned maps *NERDComAlignedComment*
|
||||||
|
|
||||||
|
Default mappings: [count],cl [count],cb
|
||||||
|
Mapped to: <plug>NERDCommenterAlignLeft
|
||||||
|
<plug>NERDCommenterAlignBoth
|
||||||
|
Applicable modes: normal visual-line.
|
||||||
|
|
||||||
|
Same as ,cc except that the comment delimiters are aligned on the left side or
|
||||||
|
both sides respectively. These comments are always nested if the line(s) are
|
||||||
|
already commented.
|
||||||
|
|
||||||
|
If a [count] is given in normal mode, the mapping works as though that many
|
||||||
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.2.13 Uncomment line map *NERDComUncommentLine*
|
||||||
|
|
||||||
|
Default mapping: [count],cu
|
||||||
|
Mapped to: <plug>NERDCommenterUncomment
|
||||||
|
Applicable modes: normal visual visual-line visual-block.
|
||||||
|
|
||||||
|
Uncomments the current line. If multiple lines are selected in
|
||||||
|
visual mode then they are all uncommented.
|
||||||
|
|
||||||
|
When uncommenting, if the line contains multiple sets of delimiters then the
|
||||||
|
``outtermost'' pair of delimiters will be removed.
|
||||||
|
|
||||||
|
The script uses a set of heurisics to distinguish ``real'' delimiters from
|
||||||
|
``fake'' ones when uncommenting. See |NERDComIssues| for details.
|
||||||
|
|
||||||
|
If a [count] is given in normal mode, the mapping works as though that many
|
||||||
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
|
Related options:
|
||||||
|
|'NERDRemoveAltComs'|
|
||||||
|
|'NERDRemoveExtraSpaces'|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.3 Supported filetypes *NERDComFiletypes*
|
||||||
|
|
||||||
|
Filetypes that can be commented by this plugin:
|
||||||
|
abaqus abc acedb ada ahdl amiga aml ampl ant apache apachestyle asm68k asm asn
|
||||||
|
aspvbs atlas autohotkey autoit automake ave awk basic b bc bdf bib bindzone
|
||||||
|
bst btm caos catalog c cfg cg ch changelog cl clean clipper cmake conf config
|
||||||
|
context cpp crontab cs csc csp css cterm cupl csv cvs dcl debchangelog
|
||||||
|
debcontrol debsources def diff django docbk dns dosbatch dosini dot dracula
|
||||||
|
dsl dtd dtml dylan ecd eiffel elf elmfilt erlang eruby eterm expect exports
|
||||||
|
fetchmail fgl focexec form fortran foxpro fstab fvwm fx gdb gdmo geek
|
||||||
|
gentoo-package-keywords' gentoo-package-mask' gentoo-package-use' gnuplot
|
||||||
|
gtkrc haskell hb h help hercules hog html htmldjango htmlos ia64 icon idlang
|
||||||
|
idl indent inform inittab ishd iss ist jam java javascript jess jgraph
|
||||||
|
jproperties jproperties jsp kconfig kix kscript lace lex lftp lifelines lilo
|
||||||
|
lisp lite lotos lout lprolog lscript lss lua lynx m4 mail make maple masm
|
||||||
|
master matlab mel mf mib mma model moduala. modula2 modula3 monk mush muttrc
|
||||||
|
named nasm nastran natural ncf netdict netrw nqc nroff nsis objc ocaml occam
|
||||||
|
omlet omnimark openroad opl ora otl ox pascal passwd pcap pccts perl pfmain
|
||||||
|
php phtml pic pike pilrc pine plaintex plm plsql po postscr pov povini ppd
|
||||||
|
ppwiz procmail progress prolog psf ptcap python python qf radiance ratpoison r
|
||||||
|
rc readline rebol registry remind rexx robots rpl rtf ruby sa samba sas sass
|
||||||
|
sather scheme scilab screen scsh sdl sed selectbuf sgml sgmldecl sgmllnx sh
|
||||||
|
sicad simula sinda skill slang sl slrnrc sm smarty smil smith sml snnsnet
|
||||||
|
snnspat snnsres snobol4 spec specman spice sql sqlforms sqlj sqr squid st stp
|
||||||
|
strace svn systemverilog tads taglist tags tak tasm tcl terminfo tex text
|
||||||
|
plaintex texinfo texmf tf tidy tli trasys tsalt tsscl tssgm uc uil vb verilog
|
||||||
|
verilog_systemverilog vgrindefs vhdl vim viminfo virata vo_base vrml vsejcl
|
||||||
|
webmacro wget winbatch wml wvdial xdefaults xf86conf xhtml xkb xmath xml
|
||||||
|
xmodmap xpm2 xpm xslt yacc yaml z8a
|
||||||
|
|
||||||
|
If a language is not in the list of hardcoded supported filetypes then the
|
||||||
|
&commentstring vim option is used.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.4 Sexy Comments *NERDComSexyComments*
|
||||||
|
These are comments that use one set of multipart comment delimiters as well as
|
||||||
|
one other marker symbol. For example: >
|
||||||
|
/*
|
||||||
|
* This is a c style sexy comment
|
||||||
|
* So there!
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This is a c style sexy comment
|
||||||
|
* So there!
|
||||||
|
* But this one is ``compact'' style */
|
||||||
|
<
|
||||||
|
Here the multipart delimiters are /* and */ and the marker is *.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
2.5 The NERDComment function *NERDComNERDComment*
|
||||||
|
|
||||||
|
All of the NERD commenter mappings and menu items invoke a single function
|
||||||
|
which delegates the commenting work to other functions. This function is
|
||||||
|
public and has the prototype: >
|
||||||
|
function! NERDComment(isVisual, type)
|
||||||
|
<
|
||||||
|
The arguments to this function are simple:
|
||||||
|
- isVisual: if you wish to do any kind of visual comment then set this to
|
||||||
|
1 and the function will use the '< and '> marks to find the comment
|
||||||
|
boundries. If set to 0 then the function will operate on the current
|
||||||
|
line.
|
||||||
|
- type: is used to specify what type of commenting operation is to be
|
||||||
|
performed, and it can be one of the following: "sexy", "invert",
|
||||||
|
"minimal", "toggle", "alignLeft", "alignBoth", "norm", "nested",
|
||||||
|
"toEOL", "append", "insert", "uncomment", "yank"
|
||||||
|
|
||||||
|
For example, if you typed >
|
||||||
|
:call NERDComment(1, 'sexy')
|
||||||
|
<
|
||||||
|
then the script would do a sexy comment on the last visual selection.
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
3. Options *NERDComOptions*
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
3.1 Options summary *NERDComOptionsSummary*
|
||||||
|
|
||||||
|
|'loaded_nerd_comments'| Turns off the script.
|
||||||
|
|'NERDAllowAnyVisualDelims'| Allows multipart alternative delims to
|
||||||
|
be used when commenting in
|
||||||
|
visual/visual-block mode.
|
||||||
|
|'NERDBlockComIgnoreEmpty'| Forces right delims to be placed when
|
||||||
|
doing visual-block comments.
|
||||||
|
|'NERDCommentWholeLinesInVMode'| Changes behaviour of visual comments.
|
||||||
|
|'NERDCreateDefaultMappings'| Turn the default mappings on/off.
|
||||||
|
|'NERDDefaultNesting'| Tells the script to use nested comments
|
||||||
|
by default.
|
||||||
|
|'NERDMenuMode'| Specifies how the NERD commenter menu
|
||||||
|
will appear (if at all).
|
||||||
|
|'NERDLPlace'| Specifies what to use as the left
|
||||||
|
delimiter placeholder when nesting
|
||||||
|
comments.
|
||||||
|
|'NERDUsePlaceHolders'| Specifies which filetypes may use
|
||||||
|
placeholders when nesting comments.
|
||||||
|
|'NERDRemoveAltComs'| Tells the script whether to remove
|
||||||
|
alternative comment delimiters when
|
||||||
|
uncommenting.
|
||||||
|
|'NERDRemoveExtraSpaces'| Tells the script to always remove the
|
||||||
|
extra spaces when uncommenting
|
||||||
|
(regardless of whether NERDSpaceDelims
|
||||||
|
is set)
|
||||||
|
|'NERDRPlace'| Specifies what to use as the right
|
||||||
|
delimiter placeholder when nesting
|
||||||
|
comments.
|
||||||
|
|'NERDSpaceDelims'| Specifies whether to add extra spaces
|
||||||
|
around delimiters when commenting, and
|
||||||
|
whether to remove them when
|
||||||
|
uncommenting.
|
||||||
|
|'NERDCompactSexyComs'| Specifies whether to use the compact
|
||||||
|
style sexy comments.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
3.3 Options details *NERDComOptionsDetails*
|
||||||
|
|
||||||
|
To enable any of the below options you should put the given line in your
|
||||||
|
~/.vimrc
|
||||||
|
|
||||||
|
*'loaded_nerd_comments'*
|
||||||
|
If this script is driving you insane you can turn it off by setting this
|
||||||
|
option >
|
||||||
|
let loaded_nerd_comments=1
|
||||||
|
<
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDAllowAnyVisualDelims'*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default: 1.
|
||||||
|
|
||||||
|
If set to 1 then, when doing a visual or visual-block comment (but not a
|
||||||
|
visual-line comment), the script will choose the right delimiters to use for
|
||||||
|
the comment. This means either using the current delimiters if they are
|
||||||
|
multipart or using the alternative delimiters if THEY are multipart. For
|
||||||
|
example if we are editing the following java code: >
|
||||||
|
float foo = 1221;
|
||||||
|
float bar = 324;
|
||||||
|
System.out.println(foo * bar);
|
||||||
|
<
|
||||||
|
If we are using // comments and select the "foo" and "bar" in visual-block
|
||||||
|
mode, as shown left below (where '|'s are used to represent the visual-block
|
||||||
|
boundary), and comment it then the script will use the alternative delims as
|
||||||
|
shown on the right: >
|
||||||
|
|
||||||
|
float |foo| = 1221; float /*foo*/ = 1221;
|
||||||
|
float |bar| = 324; float /*bar*/ = 324;
|
||||||
|
System.out.println(foo * bar); System.out.println(foo * bar);
|
||||||
|
<
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDBlockComIgnoreEmpty'*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default: 1.
|
||||||
|
|
||||||
|
This option affects visual-block mode commenting. If this option is turned
|
||||||
|
on, lines that begin outside the right boundary of the selection block will be
|
||||||
|
ignored.
|
||||||
|
|
||||||
|
For example, if you are commenting this chunk of c code in visual-block mode
|
||||||
|
(where the '|'s are used to represent the visual-block boundary) >
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|int| main(){
|
||||||
|
| | printf("SUCK THIS\n");
|
||||||
|
| | while(1){
|
||||||
|
| | fork();
|
||||||
|
| | }
|
||||||
|
|} |
|
||||||
|
<
|
||||||
|
If NERDBlockComIgnoreEmpty=0 then this code will become: >
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
/*int*/ main(){
|
||||||
|
/* */ printf("SUCK THIS\n");
|
||||||
|
/* */ while(1){
|
||||||
|
/* */ fork();
|
||||||
|
/* */ }
|
||||||
|
/*} */
|
||||||
|
<
|
||||||
|
Otherwise, the code block would become: >
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
/*int*/ main(){
|
||||||
|
printf("SUCK THIS\n");
|
||||||
|
while(1){
|
||||||
|
fork();
|
||||||
|
}
|
||||||
|
/*} */
|
||||||
|
<
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDCommentWholeLinesInVMode'*
|
||||||
|
Values: 0, 1 or 2.
|
||||||
|
Default: 0.
|
||||||
|
|
||||||
|
By default the script tries to comment out exactly what is selected in visual
|
||||||
|
mode (v). For example if you select and comment the following c code (using |
|
||||||
|
to represent the visual boundary): >
|
||||||
|
in|t foo = 3;
|
||||||
|
int bar =| 9;
|
||||||
|
int baz = foo + bar;
|
||||||
|
<
|
||||||
|
This will result in: >
|
||||||
|
in/*t foo = 3;*/
|
||||||
|
/*int bar =*/ 9;
|
||||||
|
int baz = foo + bar;
|
||||||
|
<
|
||||||
|
But some people prefer it if the whole lines are commented like: >
|
||||||
|
/*int foo = 3;*/
|
||||||
|
/*int bar = 9;*/
|
||||||
|
int baz = foo + bar;
|
||||||
|
<
|
||||||
|
If you prefer the second option then stick this line in your vimrc: >
|
||||||
|
let NERDCommentWholeLinesInVMode=1
|
||||||
|
<
|
||||||
|
|
||||||
|
If the filetype you are editing only has no multipart delimiters (for example
|
||||||
|
a shell script) and you hadnt set this option then the above would become >
|
||||||
|
in#t foo = 3;
|
||||||
|
#int bar = 9;
|
||||||
|
<
|
||||||
|
(where # is the comment delimiter) as this is the closest the script can
|
||||||
|
come to commenting out exactly what was selected. If you prefer for whole
|
||||||
|
lines to be commented out when there is no multipart delimiters but the EXACT
|
||||||
|
text that was selected to be commented out if there IS multipart delimiters
|
||||||
|
then stick the following line in your vimrc: >
|
||||||
|
let NERDCommentWholeLinesInVMode=2
|
||||||
|
<
|
||||||
|
|
||||||
|
Note that this option does not affect the behaviour of commenting in
|
||||||
|
|visual-block| mode.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDCreateDefaultMappings'*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default: 1.
|
||||||
|
|
||||||
|
If set to 0, none of the default mappings will be created.
|
||||||
|
|
||||||
|
See also |NERDComMappings|.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDRemoveAltComs'*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default: 1.
|
||||||
|
|
||||||
|
When uncommenting a line (for a filetype with an alternative commenting style)
|
||||||
|
this option tells the script whether to look for, and remove, comment
|
||||||
|
delimiters of the alternative style.
|
||||||
|
|
||||||
|
For example, if you are editing a c++ file using // style comments and you go
|
||||||
|
,cu on this line: >
|
||||||
|
/* This is a c++ comment baby! */
|
||||||
|
<
|
||||||
|
It will not be uncommented if the NERDRemoveAltComs is set to 0.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDRemoveExtraSpaces'*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default: 1.
|
||||||
|
|
||||||
|
By default, the NERD commenter will remove spaces around comment delimiters if
|
||||||
|
either:
|
||||||
|
1. |'NERDSpaceDelims'| is set to 1.
|
||||||
|
2. NERDRemoveExtraSpaces is set to 1.
|
||||||
|
|
||||||
|
This means that if we have the following lines in a c code file: >
|
||||||
|
/* int foo = 5; */
|
||||||
|
/* int bar = 10; */
|
||||||
|
int baz = foo + bar
|
||||||
|
<
|
||||||
|
If either of the above conditions hold then if these lines are uncommented
|
||||||
|
they will become: >
|
||||||
|
int foo = 5;
|
||||||
|
int bar = 10;
|
||||||
|
int baz = foo + bar
|
||||||
|
<
|
||||||
|
Otherwise they would become: >
|
||||||
|
int foo = 5;
|
||||||
|
int bar = 10;
|
||||||
|
int baz = foo + bar
|
||||||
|
<
|
||||||
|
If you want the spaces to be removed only if |'NERDSpaceDelims'| is set then
|
||||||
|
set NERDRemoveExtraSpaces to 0.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDLPlace'*
|
||||||
|
*'NERDRPlace'*
|
||||||
|
Values: arbitrary string.
|
||||||
|
Default:
|
||||||
|
NERDLPlace: "[>"
|
||||||
|
NERDRPlace: "<]"
|
||||||
|
|
||||||
|
These options are used to control the strings used as place-holder delimiters.
|
||||||
|
Place holder delimiters are used when performing nested commenting when the
|
||||||
|
filetype supports commenting styles with both left and right delimiters.
|
||||||
|
To set these options use lines like: >
|
||||||
|
let NERDLPlace="FOO"
|
||||||
|
let NERDRPlace="BAR"
|
||||||
|
<
|
||||||
|
Following the above example, if we have line of c code: >
|
||||||
|
/* int horse */
|
||||||
|
<
|
||||||
|
and we comment it with ,cn it will be changed to: >
|
||||||
|
/*FOO int horse BAR*/
|
||||||
|
<
|
||||||
|
When we uncomment this line it will go back to what it was.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDMenuMode'*
|
||||||
|
Values: 0, 1, 2, 3.
|
||||||
|
Default: 3
|
||||||
|
|
||||||
|
This option can take 4 values:
|
||||||
|
"0": Turns the menu off.
|
||||||
|
"1": Turns the 'comment' menu on with no menu shortcut.
|
||||||
|
"2": Turns the 'comment 'menu on with <alt>-c as the shortcut.
|
||||||
|
"3": Turns the 'Plugin -> comment' menu on with <alt>-c as the shortcut.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDUsePlaceHolders'*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default 1.
|
||||||
|
|
||||||
|
This option is used to specify whether place-holder delimiters should be used
|
||||||
|
when creating a nested comment.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDSpaceDelims'*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default 0.
|
||||||
|
|
||||||
|
Some people prefer a space after the left delimiter and before the right
|
||||||
|
delimiter like this: >
|
||||||
|
/* int foo=2; */
|
||||||
|
<
|
||||||
|
as opposed to this: >
|
||||||
|
/*int foo=2;*/
|
||||||
|
<
|
||||||
|
If you want spaces to be added then set NERDSpaceDelims to 1 in your vimrc.
|
||||||
|
|
||||||
|
See also |'NERDRemoveExtraSpaces'|.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDCompactSexyComs'*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default 0.
|
||||||
|
|
||||||
|
Some people may want their sexy comments to be like this: >
|
||||||
|
/* Hi There!
|
||||||
|
* This is a sexy comment
|
||||||
|
* in c */
|
||||||
|
<
|
||||||
|
As opposed to like this: >
|
||||||
|
/*
|
||||||
|
* Hi There!
|
||||||
|
* This is a sexy comment
|
||||||
|
* in c
|
||||||
|
*/
|
||||||
|
<
|
||||||
|
If this option is set to 1 then the top style will be used.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDDefaultNesting'*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default 1.
|
||||||
|
|
||||||
|
When this option is set to 1, comments are nested automatically. That is, if
|
||||||
|
you hit ,cc on a line that is already commented it will be commented again
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
3.3 Default delimiter customisation *NERDComDefaultDelims*
|
||||||
|
|
||||||
|
If you want the NERD commenter to use the alternative delimiters for a
|
||||||
|
specific filetype by default then put a line of this form into your vimrc: >
|
||||||
|
let NERD_<filetype>_alt_style=1
|
||||||
|
<
|
||||||
|
Example: java uses // style comments by default, but you want it to default to
|
||||||
|
/* */ style comments instead. You would put this line in your vimrc: >
|
||||||
|
let NERD_java_alt_style=1
|
||||||
|
<
|
||||||
|
|
||||||
|
See |NERDComAltDelim| for switching commenting styles at runtime.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
4. Key mapping customisation *NERDComMappings*
|
||||||
|
|
||||||
|
To change a mapping just map another key combo to the internal <plug> mapping.
|
||||||
|
For example, to remap the |NERDComComment| mapping to ",omg" you would put
|
||||||
|
this line in your vimrc: >
|
||||||
|
map ,omg <plug>NERDCommenterComment
|
||||||
|
<
|
||||||
|
This will stop the corresponding default mappings from being created.
|
||||||
|
|
||||||
|
See the help for the mapping in question to see which <plug> mapping to
|
||||||
|
map to.
|
||||||
|
|
||||||
|
See also |'NERDCreateDefaultMappings'|.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
5. Issues with the script *NERDComIssues*
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
5.1 Delimiter detection heuristics *NERDComHeuristics*
|
||||||
|
|
||||||
|
Heuristics are used to distinguish the real comment delimiters
|
||||||
|
|
||||||
|
Because we have comment mappings that place delimiters in the middle of lines,
|
||||||
|
removing comment delimiters is a bit tricky. This is because if comment
|
||||||
|
delimiters appear in a line doesnt mean they really ARE delimiters. For
|
||||||
|
example, Java uses // comments but the line >
|
||||||
|
System.out.println("//");
|
||||||
|
<
|
||||||
|
clearly contains no real comment delimiters.
|
||||||
|
|
||||||
|
To distinguish between ``real'' comment delimiters and ``fake'' ones we use a
|
||||||
|
set of heuristics. For example, one such heuristic states that any comment
|
||||||
|
delimiter that has an odd number of non-escaped " characters both preceding
|
||||||
|
and following it on the line is not a comment because it is probably part of a
|
||||||
|
string. These heuristics, while usually pretty accurate, will not work for all
|
||||||
|
cases.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
5.2 Nesting issues *NERDComNesting*
|
||||||
|
|
||||||
|
If we have some line of code like this: >
|
||||||
|
/*int foo */ = /*5 + 9;*/
|
||||||
|
<
|
||||||
|
This will not be uncommented legally. The NERD commenter will remove the
|
||||||
|
"outter most" delimiters so the line will become: >
|
||||||
|
int foo */ = /*5 + 9;
|
||||||
|
<
|
||||||
|
which almost certainly will not be what you want. Nested sets of comments will
|
||||||
|
uncomment fine though. Eg: >
|
||||||
|
/*int/* foo =*/ 5 + 9;*/
|
||||||
|
<
|
||||||
|
will become: >
|
||||||
|
int/* foo =*/ 5 + 9;
|
||||||
|
<
|
||||||
|
(Note that in the above examples I have deliberately not used place holders
|
||||||
|
for simplicity)
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
6. About *NERDComAbout*
|
||||||
|
|
||||||
|
The author of the NERD commenter is Martyzillatron --- the half robot, half
|
||||||
|
dinosaur bastard son of Megatron and Godzilla. He enjoys destroying
|
||||||
|
metropolises and eating tourist busses.
|
||||||
|
|
||||||
|
Drop him a line at martin_grenfell at msn.com. He would love to hear from you.
|
||||||
|
its a lonely life being the worlds premier terror machine. How would you feel
|
||||||
|
if your face looked like a toaster and a t-rex put together? :(
|
||||||
|
|
||||||
|
The latest stable versions can be found at
|
||||||
|
http://www.vim.org/scripts/script.php?script_id=1218
|
||||||
|
|
||||||
|
The latest dev versions are on github
|
||||||
|
http://github.com/scrooloose/nerdcommenter
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
8. Changelog *NERDComChangelog*
|
||||||
|
|
||||||
|
2.2.2
|
||||||
|
- remove the NERDShutup option and the message is suppresses, this makes
|
||||||
|
the plugin silently rely on &commentstring for unknown filetypes.
|
||||||
|
- add support for dhcpd, limits, ntp, resolv, rgb, sysctl, udevconf and
|
||||||
|
udevrules. Thanks to Thilo Six.
|
||||||
|
- match filetypes case insensitively
|
||||||
|
- add support for mp (metapost), thanks to Andrey Skvortsov.
|
||||||
|
- add support for htmlcheetah, thanks to Simon Hengel.
|
||||||
|
- add support for javacc, thanks to Matt Tolton.
|
||||||
|
- make <%# %> the default delims for eruby, thanks to tpope.
|
||||||
|
- add support for javascript.jquery, thanks to Ivan Devat.
|
||||||
|
- add support for cucumber and pdf. Fix sass and railslog delims,
|
||||||
|
thanks to tpope
|
||||||
|
|
||||||
|
2.2.1
|
||||||
|
- add support for newlisp and clojure, thanks to Matthew Lee Hinman.
|
||||||
|
- fix automake comments, thanks to Elias Pipping
|
||||||
|
- make haml comments default to -# with / as the alternative delimiter,
|
||||||
|
thanks to tpope
|
||||||
|
- add support for actionscript and processing thanks to Edwin Benavides
|
||||||
|
- add support for ps1 (powershell), thanks to Jason Mills
|
||||||
|
- add support for hostsaccess, thanks to Thomas Rowe
|
||||||
|
- add support for CVScommit
|
||||||
|
- add support for asciidoc, git and gitrebase. Thanks to Simon Ruderich.
|
||||||
|
- use # for gitcommit comments, thanks to Simon Ruderich.
|
||||||
|
- add support for mako and genshi, thanks to Keitheis.
|
||||||
|
- add support for conkyrc, thanks to David
|
||||||
|
- add support for SVNannotate, thanks to Miguel Jaque Barbero.
|
||||||
|
- add support for sieve, thanks to Stefan Walk
|
||||||
|
- add support for objj, thanks to Adam Thorsen.
|
||||||
|
|
||||||
|
2.2.0
|
||||||
|
- rewrote the mappings system to be more "standard".
|
||||||
|
- removed all the mapping options. Now, mappings to <plug> mappings are
|
||||||
|
used
|
||||||
|
- see :help NERDComMappings, and :help NERDCreateDefaultMappings for
|
||||||
|
more info
|
||||||
|
- remove "prepend comments" and "right aligned comments".
|
||||||
|
- add support for applescript, calbire, man, SVNcommit, potwiki, txt2tags and SVNinfo.
|
||||||
|
Thanks to nicothakis, timberke, sgronblo, mntnoe, Bernhard Grotz, John
|
||||||
|
O'Shea, François and Giacomo Mariani respectively.
|
||||||
|
- bugfix for haskell delimiters. Thanks to mntnoe.
|
||||||
|
2.1.18
|
||||||
|
- add support for llvm. Thanks to nicothakis.
|
||||||
|
- add support for xquery. Thanks to Phillip Kovalev.
|
||||||
|
2.1.17
|
||||||
|
- fixed haskell delimiters (hackily). Thanks to Elias Pipping.
|
||||||
|
- add support for mailcap. Thanks to Pascal Brueckner.
|
||||||
|
- add support for stata. Thanks to Jerónimo Carballo.
|
||||||
|
- applied a patch from ewfalor to fix an error in the help file with the
|
||||||
|
NERDMapleader doc
|
||||||
|
- disable the insert mode ctrl-c mapping by default, see :help
|
||||||
|
NERDComInsertComment if you wish to restore it
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
8. Credits *NERDComCredits*
|
||||||
|
|
||||||
|
Thanks to the follow people for suggestions and patches:
|
||||||
|
|
||||||
|
Nick Brettell
|
||||||
|
Matthew Hawkins
|
||||||
|
Mathieu Clabaut
|
||||||
|
Greg Searle
|
||||||
|
Nguyen
|
||||||
|
Litchi
|
||||||
|
Jorge Scandaliaris
|
||||||
|
Shufeng Zheng
|
||||||
|
Martin Stubenschrott
|
||||||
|
Markus Erlmann
|
||||||
|
Brent Rice
|
||||||
|
Richard Willis
|
||||||
|
Igor Prischepoff
|
||||||
|
Harry
|
||||||
|
David Bourgeois
|
||||||
|
Eike Von Seggern
|
||||||
|
Torsten Blix
|
||||||
|
Alexander Bosecke
|
||||||
|
Stefano Zacchiroli
|
||||||
|
Norick Chen
|
||||||
|
Joseph Barker
|
||||||
|
Gary Church
|
||||||
|
Tim Carey-Smith
|
||||||
|
Markus Klinik
|
||||||
|
Anders
|
||||||
|
Seth Mason
|
||||||
|
James Hales
|
||||||
|
Heptite
|
||||||
|
Cheng Fang
|
||||||
|
Yongwei Wu
|
||||||
|
David Miani
|
||||||
|
Jeremy Hinegardner
|
||||||
|
Marco
|
||||||
|
Ingo Karkat
|
||||||
|
Zhang Shuhan
|
||||||
|
tpope
|
||||||
|
Ben Schmidt
|
||||||
|
David Fishburn
|
||||||
|
Erik Falor
|
||||||
|
JaGoTerr
|
||||||
|
Elias Pipping
|
||||||
|
mntnoe
|
||||||
|
Mark S.
|
||||||
|
|
||||||
|
|
||||||
|
Thanks to the following people for sending me new filetypes to support:
|
||||||
|
|
||||||
|
The hackers The filetypes~
|
||||||
|
Sam R verilog
|
||||||
|
Jonathan Derque context, plaintext and mail
|
||||||
|
Vigil fetchmail
|
||||||
|
Michael Brunner kconfig
|
||||||
|
Antono Vasiljev netdict
|
||||||
|
Melissa Reid omlet
|
||||||
|
Ilia N Ternovich quickfix
|
||||||
|
John O'Shea RTF, SVNcommitlog and vcscommit, SVNCommit
|
||||||
|
Anders occam
|
||||||
|
Mark Woodward csv
|
||||||
|
fREW gentoo-package-mask,
|
||||||
|
gentoo-package-keywords,
|
||||||
|
gentoo-package-use, and vo_base
|
||||||
|
Alexey verilog_systemverilog, systemverilog
|
||||||
|
Lizendir fstab
|
||||||
|
Michael Böhler autoit, autohotkey and docbk
|
||||||
|
Aaron Small cmake
|
||||||
|
Ramiro htmldjango and django
|
||||||
|
Stefano Zacchiroli debcontrol, debchangelog, mkd
|
||||||
|
Alex Tarkovsky ebuild and eclass
|
||||||
|
Jorge Rodrigues gams
|
||||||
|
Rainer Müller Objective C
|
||||||
|
Jason Mills Groovy, ps1
|
||||||
|
Normandie Azucena vera
|
||||||
|
Florian Apolloner ldif
|
||||||
|
David Fishburn lookupfile
|
||||||
|
Niels Aan de Brugh rst
|
||||||
|
Don Hatlestad ahk
|
||||||
|
Christophe Benz Desktop and xsd
|
||||||
|
Eyolf Østrem lilypond, bbx and lytex
|
||||||
|
Ingo Karkat dosbatch
|
||||||
|
Nicolas Weber markdown, objcpp
|
||||||
|
tinoucas gentoo-conf-d
|
||||||
|
Greg Weber D, haml
|
||||||
|
Bruce Sherrod velocity
|
||||||
|
timberke cobol, calibre
|
||||||
|
Aaron Schaefer factor
|
||||||
|
Mr X asterisk, mplayerconf
|
||||||
|
Kuchma Michael plsql
|
||||||
|
Brett Warneke spectre
|
||||||
|
Pipp lhaskell
|
||||||
|
Renald Buter scala
|
||||||
|
Vladimir Lomov asymptote
|
||||||
|
Marco mrxvtrc, aap
|
||||||
|
nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate,
|
||||||
|
SVNdiff, gitAnnotate, gitdiff, dtrace
|
||||||
|
llvm, applescript
|
||||||
|
Chen Xing Wikipedia
|
||||||
|
Jacobo Diaz dakota, patran
|
||||||
|
Li Jin gentoo-env-d, gentoo-init-d,
|
||||||
|
gentoo-make-conf, grub, modconf, sudoers
|
||||||
|
SpookeyPeanut rib
|
||||||
|
Greg Jandl pyrex/cython
|
||||||
|
Christophe Benz services, gitcommit
|
||||||
|
A Pontus vimperator
|
||||||
|
Stromnov slice, bzr
|
||||||
|
Martin Kustermann pamconf
|
||||||
|
Indriði Einarsson mason
|
||||||
|
Chris map
|
||||||
|
Krzysztof A. Adamski group
|
||||||
|
Pascal Brueckner mailcap
|
||||||
|
Jerónimo Carballo stata
|
||||||
|
Phillip Kovalev xquery
|
||||||
|
Bernhard Grotz potwiki
|
||||||
|
sgronblo man
|
||||||
|
François txt2tags
|
||||||
|
Giacomo Mariani SVNinfo
|
||||||
|
Matthew Lee Hinman newlisp, clojure
|
||||||
|
Elias Pipping automake
|
||||||
|
Edwin Benavides actionscript, processing
|
||||||
|
Thomas Rowe hostsaccess
|
||||||
|
Simon Ruderich asciidoc, git, gitcommit, gitrebase
|
||||||
|
Keitheis mako, genshi
|
||||||
|
David conkyrc
|
||||||
|
Miguel Jaque Barbero SVNannotate
|
||||||
|
Stefan Walk sieve
|
||||||
|
Adam Thorsen objj
|
||||||
|
Thilo Six dhcpd, limits, ntp, resolv, rgb, sysctl,
|
||||||
|
udevconf, udevrules
|
||||||
|
Andrey Skvortsov mp
|
||||||
|
Simon Hengel htmlcheetah
|
||||||
|
Matt Tolton javacc
|
||||||
|
Ivan Devat javascript.jquery
|
||||||
|
tpope cucumber,pdf
|
||||||
|
==============================================================================
|
||||||
|
9. License *NERDComLicense*
|
||||||
|
|
||||||
|
The NERD commenter is released under the wtfpl.
|
||||||
|
See http://sam.zoy.org/wtfpl/COPYING.
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,442 @@
|
||||||
|
*bufexplorer.txt* Buffer Explorer Last Change: 19 Nov 2008
|
||||||
|
|
||||||
|
Buffer Explorer *buffer-explorer* *bufexplorer*
|
||||||
|
Version 7.2.2
|
||||||
|
|
||||||
|
Plugin for easily exploring (or browsing) Vim |:buffers|.
|
||||||
|
|
||||||
|
|bufexplorer-usage| Usage
|
||||||
|
|bufexplorer-installation| Installation
|
||||||
|
|bufexplorer-customization| Customization
|
||||||
|
|bufexplorer-changelog| Change Log
|
||||||
|
|bufexplorer-todo| Todo
|
||||||
|
|bufexplorer-credits| Credits
|
||||||
|
|
||||||
|
For Vim version 7.0 and above.
|
||||||
|
This plugin is only available if 'compatible' is not set.
|
||||||
|
|
||||||
|
{Vi does not have any of this}
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
INSTALLATION *bufexplorer-installation*
|
||||||
|
|
||||||
|
To install:
|
||||||
|
- Download the bufexplorer.zip.
|
||||||
|
- Extract the zip archive into your runtime directory.
|
||||||
|
The archive contains plugin/bufexplorer.vim, and doc/bufexplorer.txt.
|
||||||
|
- Start Vim or goto an existing instance of Vim.
|
||||||
|
- Execute the following command:
|
||||||
|
>
|
||||||
|
:helptag <your runtime directory/doc
|
||||||
|
<
|
||||||
|
This will generate all the help tags for any file located in the doc
|
||||||
|
directory.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
USAGE *bufexplorer-usage*
|
||||||
|
|
||||||
|
To start exploring in the current window, use: >
|
||||||
|
\be OR :BufExplorer
|
||||||
|
To start exploring in a newly split horizontal window, use: >
|
||||||
|
\bs or :HSBufExplorer
|
||||||
|
To start exploring in a newly split vertical window, use: >
|
||||||
|
\bv or :VSBufExplorer
|
||||||
|
|
||||||
|
If you would like to use something other than '\', you may simply change the
|
||||||
|
leader (see |mapleader|).
|
||||||
|
|
||||||
|
Note: If the current buffer is modified when bufexplorer started, the current
|
||||||
|
window is always split and the new bufexplorer is displayed in that new
|
||||||
|
window.
|
||||||
|
|
||||||
|
Commands to use once exploring:
|
||||||
|
|
||||||
|
<enter> Opens the buffer that is under the cursor into the current
|
||||||
|
window.
|
||||||
|
<F1> Toggle help information.
|
||||||
|
<leftmouse> Opens the buffer that is under the cursor into the current
|
||||||
|
window.
|
||||||
|
<shift-enter> Opens the buffer that is under the cursor in another tab.
|
||||||
|
d |:wipeout| the buffer under the cursor from the list.
|
||||||
|
When a buffers is wiped, it will not be shown when unlisted
|
||||||
|
buffer are displayed.
|
||||||
|
D |:delete| the buffer under the cursor from the list.
|
||||||
|
The buffer's 'buflisted' is cleared. This allows for the buffer
|
||||||
|
to be displayed again using the 'show unlisted' command.
|
||||||
|
f Toggles whether you are taken to the active window when
|
||||||
|
selecting a buffer or not.
|
||||||
|
p Toggles the showing of a split filename/pathname.
|
||||||
|
q Quit exploring.
|
||||||
|
r Reverses the order the buffers are listed in.
|
||||||
|
R Toggles relative path/absolute path.
|
||||||
|
s Selects the order the buffers are listed in. Either by buffer
|
||||||
|
number, file name, file extension, most recently used (MRU), or
|
||||||
|
full path.
|
||||||
|
t Opens the buffer that is under the cursor in another tab.
|
||||||
|
u Toggles the showing of "unlisted" buffers.
|
||||||
|
|
||||||
|
Once invoked, Buffer Explorer displays a sorted list (MRU is the default
|
||||||
|
sort method) of all the buffers that are currently opened. You are then
|
||||||
|
able to move the cursor to the line containing the buffer's name you are
|
||||||
|
wanting to act upon. Once you have selected the buffer you would like,
|
||||||
|
you can then either open it, close it(delete), resort the list, reverse
|
||||||
|
the sort, quit exploring and so on...
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
CUSTOMIZATION *bufexplorer-customization*
|
||||||
|
|
||||||
|
*g:bufExplorerDefaultHelp*
|
||||||
|
To control whether the default help is displayed or not, use: >
|
||||||
|
let g:bufExplorerDefaultHelp=0 " Do not show default help.
|
||||||
|
let g:bufExplorerDefaultHelp=1 " Show default help.
|
||||||
|
The default is to show the default help.
|
||||||
|
|
||||||
|
*g:bufExplorerDetailedHelp*
|
||||||
|
To control whether detailed help is display by, use: >
|
||||||
|
let g:bufExplorerDetailedHelp=0 " Do not show detailed help.
|
||||||
|
let g:bufExplorerDetailedHelp=1 " Show detailed help.
|
||||||
|
The default is NOT to show detailed help.
|
||||||
|
|
||||||
|
*g:bufExplorerFindActive*
|
||||||
|
To control whether you are taken to the active window when selecting a buffer,
|
||||||
|
use: >
|
||||||
|
let g:bufExplorerFindActive=0 " Do not go to active window.
|
||||||
|
let g:bufExplorerFindActive=1 " Go to active window.
|
||||||
|
The default is to be taken to the active window.
|
||||||
|
|
||||||
|
*g:bufExplorerReverseSort*
|
||||||
|
To control whether to sort the buffer in reverse order or not, use: >
|
||||||
|
let g:bufExplorerReverseSort=0 " Do not sort in reverse order.
|
||||||
|
let g:bufExplorerReverseSort=1 " Sort in reverse order.
|
||||||
|
The default is NOT to sort in reverse order.
|
||||||
|
|
||||||
|
*g:bufExplorerShowDirectories*
|
||||||
|
Directories usually show up in the list from using a command like ":e .".
|
||||||
|
To control whether to show directories in the buffer list or not, use: >
|
||||||
|
let g:bufExplorerShowDirectories=1 " Show directories.
|
||||||
|
let g:bufExplorerShowDirectories=0 " Don't show directories.
|
||||||
|
The default is to show directories.
|
||||||
|
|
||||||
|
*g:bufExplorerShowRelativePath*
|
||||||
|
To control whether to show absolute paths or relative to the current
|
||||||
|
directory, use: >
|
||||||
|
let g:bufExplorerShowRelativePath=0 " Show absolute paths.
|
||||||
|
let g:bufExplorerShowRelativePath=1 " Show relative paths.
|
||||||
|
The default is to show absolute paths.
|
||||||
|
|
||||||
|
*g:bufExplorerShowUnlisted*
|
||||||
|
To control whether to show unlisted buffer or not, use: >
|
||||||
|
let g:bufExplorerShowUnlisted=0 " Do not show unlisted buffers.
|
||||||
|
let g:bufExplorerShowUnlisted=1 " Show unlisted buffers.
|
||||||
|
The default is to NOT show unlisted buffers.
|
||||||
|
|
||||||
|
*g:bufExplorerSortBy*
|
||||||
|
To control what field the buffers are sorted by, use: >
|
||||||
|
let g:bufExplorerSortBy='extension' " Sort by file extension.
|
||||||
|
let g:bufExplorerSortBy='fullpath' " Sort by full file path name.
|
||||||
|
let g:bufExplorerSortBy='mru' " Sort by most recently used.
|
||||||
|
let g:bufExplorerSortBy='name' " Sort by the buffer's name.
|
||||||
|
let g:bufExplorerSortBy='number' " Sort by the buffer's number.
|
||||||
|
The default is to sort by mru.
|
||||||
|
|
||||||
|
*g:bufExplorerSplitBelow*
|
||||||
|
To control where the new split window will be placed above or below the
|
||||||
|
current window, use: >
|
||||||
|
let g:bufExplorerSplitBelow=1 " Split new window below current.
|
||||||
|
let g:bufExplorerSplitBelow=0 " Split new window above current.
|
||||||
|
The default is to use what ever is set by the global &splitbelow
|
||||||
|
variable.
|
||||||
|
|
||||||
|
*g:bufExplorerSplitOutPathName*
|
||||||
|
To control whether to split out the path and file name or not, use: >
|
||||||
|
let g:bufExplorerSplitOutPathName=1 " Split the path and file name.
|
||||||
|
let g:bufExplorerSplitOutPathName=0 " Don't split the path and file
|
||||||
|
" name.
|
||||||
|
The default is to split the path and file name.
|
||||||
|
|
||||||
|
*g:bufExplorerSplitRight*
|
||||||
|
To control where the new vsplit window will be placed to the left or right of
|
||||||
|
current window, use: >
|
||||||
|
let g:bufExplorerSplitRight=0 " Split left.
|
||||||
|
let g:bufExplorerSplitRight=1 " Split right.
|
||||||
|
The default is to use the global &splitright.
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
CHANGE LOG *bufexplorer-changelog*
|
||||||
|
|
||||||
|
7.2.2 - Fix:
|
||||||
|
* Thanks to David L. Dight for spotting and fixing an issue when
|
||||||
|
using ctrl^. bufexplorer would incorrectly handle the previous
|
||||||
|
buffer so that when ctrl^ was pressed the incorrect file was opened.
|
||||||
|
7.2.1 - Fix:
|
||||||
|
* Thanks to Dimitar for spotting and fixing a feature that was
|
||||||
|
inadvertently left out of the previous version. The feature was
|
||||||
|
when bufexplorer was used together with WinManager, you could use
|
||||||
|
the tab key to open a buffer in a split window.
|
||||||
|
7.2.0 - Enhancements:
|
||||||
|
* For all those missing the \bs and \bv commands, these have now
|
||||||
|
returned. Thanks to Phil O'Connell for asking for the return of
|
||||||
|
these missing features and helping test out this version.
|
||||||
|
Fixes:
|
||||||
|
* Fixed problem with the bufExplorerFindActive code not working
|
||||||
|
correctly.
|
||||||
|
* Fixed an incompatibility between bufexplorer and netrw that caused
|
||||||
|
buffers to be incorrectly removed from the MRU list.
|
||||||
|
7.1.7 - Fixes:
|
||||||
|
* TaCahiroy fixed several issues related to opening a buffer in a
|
||||||
|
tab.
|
||||||
|
7.1.6 - Fixes:
|
||||||
|
* Removed ff=unix from modeline in bufexplorer.txt. Found by Bill
|
||||||
|
McCarthy.
|
||||||
|
7.1.5 - Fixes:
|
||||||
|
* Could not open unnamed buffers. Fixed by TaCahiroy.
|
||||||
|
7.1.4 - Fixes:
|
||||||
|
* Sometimes when a file's path has 'white space' in it, extra buffers
|
||||||
|
would be created containing each piece of the path. i.e:
|
||||||
|
opening c:\document and settings\test.txt would create a buffer
|
||||||
|
named "and" and a buffer named "Documents". This was reported and
|
||||||
|
fixed by TaCa Yoss.
|
||||||
|
7.1.3 - Fixes:
|
||||||
|
* Added code to allow only one instance of the plugin to run at a
|
||||||
|
time. Thanks Dennis Hostetler.
|
||||||
|
7.1.2 - Fixes:
|
||||||
|
* Fixed a jumplist issue spotted by JiangJun. I overlooked the
|
||||||
|
'jumplist' and with a couple calls to 'keepjumps', everything is
|
||||||
|
fine again.
|
||||||
|
* Went back to just having a plugin file, no autoload file. By having
|
||||||
|
the autoload, WinManager was no longer working and without really
|
||||||
|
digging into the cause, it was easier to go back to using just a
|
||||||
|
plugin file.
|
||||||
|
7.1.1 - Fixes:
|
||||||
|
* A problem spotted by Thomas Arendsen Hein.
|
||||||
|
When running Vim (7.1.94), error E493 was being thrown.
|
||||||
|
Enhancements:
|
||||||
|
* Added 'D' for 'delete' buffer as the 'd' command was a 'wipe'
|
||||||
|
buffer.
|
||||||
|
7.1.0 - Another 'major' update, some by Dave Larson, some by me.
|
||||||
|
* Making use of 'autoload' now to make the plugin load quicker.
|
||||||
|
* Removed '\bs' and '\bv'. These are now controlled by the user. The
|
||||||
|
user can issue a ':sp' or ':vs' to create a horizontal or vertical
|
||||||
|
split window and then issue a '\be'
|
||||||
|
* Added handling of tabs.
|
||||||
|
7.0.17 - Fixed issue with 'drop' command.
|
||||||
|
Various enhancements and improvements.
|
||||||
|
7.0.16 - Fixed issue reported by Liu Jiaping on non Windows systems, which was
|
||||||
|
...
|
||||||
|
Open file1, open file2, modify file1, open bufexplorer, you get the
|
||||||
|
following error:
|
||||||
|
|
||||||
|
--------8<--------
|
||||||
|
Error detected while processing function
|
||||||
|
<SNR>14_StartBufExplorer..<SNR>14_SplitOpen:
|
||||||
|
line 4:
|
||||||
|
E37: No write since last change (add ! to override)
|
||||||
|
|
||||||
|
But the worse thing is, when I want to save the current buffer and
|
||||||
|
type ':w', I get another error message:
|
||||||
|
E382: Cannot write, 'buftype' option is set
|
||||||
|
--------8<--------
|
||||||
|
|
||||||
|
7.0.15 - Thanks to Mark Smithfield for suggesting bufexplorer needed to handle
|
||||||
|
the ':args' command.
|
||||||
|
7.0.14 - Thanks to Randall Hansen for removing the requirement of terminal
|
||||||
|
versions to be recompiled with 'gui' support so the 'drop' command
|
||||||
|
would work. The 'drop' command is really not needed in terminal
|
||||||
|
versions.
|
||||||
|
7.0.13 - Fixed integration with WinManager.
|
||||||
|
Thanks to Dave Eggum for another update.
|
||||||
|
- Fix: The detailed help didn't display the mapping for toggling
|
||||||
|
the split type, even though the split type is displayed.
|
||||||
|
- Fixed incorrect description in the detailed help for toggling
|
||||||
|
relative or full paths.
|
||||||
|
- Deprecated s:ExtractBufferNbr(). Vim's str2nr() does the same
|
||||||
|
thing.
|
||||||
|
- Created a s:Set() function that sets a variable only if it hasn't
|
||||||
|
already been defined. It's useful for initializing all those
|
||||||
|
default settings.
|
||||||
|
- Removed checks for repetitive command definitions. They were
|
||||||
|
unnecessary.
|
||||||
|
- Made the help highlighting a little more fancy.
|
||||||
|
- Minor reverse compatibility issue: Changed ambiguous setting
|
||||||
|
names to be more descriptive of what they do (also makes the code
|
||||||
|
easier to follow):
|
||||||
|
Changed bufExplorerSortDirection to bufExplorerReverseSort
|
||||||
|
Changed bufExplorerSplitType to bufExplorerSplitVertical
|
||||||
|
Changed bufExplorerOpenMode to bufExplorerUseCurrentWindow
|
||||||
|
- When the BufExplorer window closes, all the file-local marks are
|
||||||
|
now deleted. This may have the benefit of cleaning up some of the
|
||||||
|
jumplist.
|
||||||
|
- Changed the name of the parameter for StartBufExplorer from
|
||||||
|
"split" to "open". The parameter is a string which specifies how
|
||||||
|
the buffer will be open, not if it is split or not.
|
||||||
|
- Deprecated DoAnyMoreBuffersExist() - it is a one line function
|
||||||
|
only used in one spot.
|
||||||
|
- Created four functions (SplitOpen(), RebuildBufferList(),
|
||||||
|
UpdateHelpStatus() and ReSortListing()) all with one purpose - to
|
||||||
|
reduce repeated code.
|
||||||
|
- Changed the name of AddHeader() to CreateHelp() to be more
|
||||||
|
descriptive of what it does. It now returns an array instead of
|
||||||
|
updating the window directly. This has the benefit of making the
|
||||||
|
code more efficient since the text the function returns is used a
|
||||||
|
little differently in the two places the function is called.
|
||||||
|
- Other minor simplifications.
|
||||||
|
7.0.12 - MAJOR Update.
|
||||||
|
This version will ONLY run with Vim version 7.0 or greater.
|
||||||
|
Dave Eggum has made some 'significant' updates to this latest
|
||||||
|
version:
|
||||||
|
- Added BufExplorerGetAltBuf() global function to be used in the
|
||||||
|
user’s rulerformat.
|
||||||
|
- Added g:bufExplorerSplitRight option.
|
||||||
|
- Added g:bufExplorerShowRelativePath option with mapping.
|
||||||
|
- Added current line highlighting.
|
||||||
|
- The split type can now be changed whether bufexplorer is opened
|
||||||
|
in split mode or not.
|
||||||
|
- Various major and minor bug fixes and speed improvements.
|
||||||
|
- Sort by extension.
|
||||||
|
Other improvements/changes:
|
||||||
|
- Changed the help key from '?' to <F1> to be more 'standard'.
|
||||||
|
- Fixed splitting of vertical bufexplorer window.
|
||||||
|
Hopefully I have not forgot something :)
|
||||||
|
7.0.11 - Fixed a couple of highlighting bugs, reported by David Eggum. He also
|
||||||
|
changed passive voice to active on a couple of warning messages.
|
||||||
|
7.0.10 - Fixed bug report by Xiangjiang Ma. If the 'ssl' option is set,
|
||||||
|
the slash character used when displaying the path was incorrect.
|
||||||
|
7.0.9 - Martin Grenfell found and eliminated an annoying bug in the
|
||||||
|
bufexplorer/winmanager integration. The bug was were an
|
||||||
|
annoying message would be displayed when a window was split or
|
||||||
|
a new file was opened in a new window. Thanks Martin!
|
||||||
|
7.0.8 - Thanks to Mike Li for catching a bug in the WinManager integration.
|
||||||
|
The bug was related to the incorrect displaying of the buffer
|
||||||
|
explorer's window title.
|
||||||
|
7.0.7 - Thanks to Jeremy Cowgar for adding a new enhancement. This
|
||||||
|
enhancement allows the user to press 'S', that is capital S, which
|
||||||
|
will open the buffer under the cursor in a newly created split
|
||||||
|
window.
|
||||||
|
7.0.6 - Thanks to Larry Zhang for finding a bug in the "split" buffer code.
|
||||||
|
If you force set g:bufExplorerSplitType='v' in your vimrc, and if you
|
||||||
|
tried to do a \bs to split the bufexplorer window, it would always
|
||||||
|
split horizontal, not vertical. He also found that I had a typeo in
|
||||||
|
that the variable g:bufExplorerSplitVertSize was all lower case in
|
||||||
|
the documentation which was incorrect.
|
||||||
|
7.0.5 - Thanks to Mun Johl for pointing out a bug that if a buffer was
|
||||||
|
modified, the '+' was not showing up correctly.
|
||||||
|
7.0.4 - Fixed a problem discovered first by Xiangjiang Ma. Well since I've
|
||||||
|
been using vim 7.0 and not 6.3, I started using a function (getftype)
|
||||||
|
that is not in 6.3. So for backward compatibility, I conditionaly use
|
||||||
|
this function now. Thus, the g:bufExplorerShowDirectories feature is
|
||||||
|
only available when using vim 7.0 and above.
|
||||||
|
7.0.3 - Thanks to Erwin Waterlander for finding a problem when the last
|
||||||
|
buffer was deleted. This issue got me to rewrite the buffer display
|
||||||
|
logic (which I've wanted to do for sometime now).
|
||||||
|
Also great thanks to Dave Eggum for coming up with idea for
|
||||||
|
g:bufExplorerShowDirectories. Read the above information about this
|
||||||
|
feature.
|
||||||
|
7.0.2 - Thanks to Thomas Arendsen Hein for finding a problem when a user
|
||||||
|
has the default help turned off and then brought up the explorer. An
|
||||||
|
E493 would be displayed.
|
||||||
|
7.0.1 - Thanks to Erwin Waterlander for finding a couple problems.
|
||||||
|
The first problem allowed a modified buffer to be deleted. Opps! The
|
||||||
|
second problem occurred when several files were opened, BufExplorer
|
||||||
|
was started, the current buffer was deleted using the 'd' option, and
|
||||||
|
then BufExplorer was exited. The deleted buffer was still visible
|
||||||
|
while it is not in the buffers list. Opps again!
|
||||||
|
7.0.0 - Thanks to Shankar R. for suggesting to add the ability to set
|
||||||
|
the fixed width (g:bufExplorerSplitVertSize) of a new window
|
||||||
|
when opening bufexplorer vertically and fixed height
|
||||||
|
(g:bufExplorerSplitHorzSize) of a new window when opening
|
||||||
|
bufexplorer horizontally. By default, the windows are normally
|
||||||
|
split to use half the existing width or height.
|
||||||
|
6.3.0 - Added keepjumps so that the jumps list would not get cluttered with
|
||||||
|
bufexplorer related stuff.
|
||||||
|
6.2.3 - Thanks to Jay Logan for finding a bug in the vertical split position
|
||||||
|
of the code. When selecting that the window was to be split
|
||||||
|
vertically by doing a '\bv', from then on, all splits, i.e. '\bs',
|
||||||
|
were split vertically, even though g:bufExplorerSplitType was not set
|
||||||
|
to 'v'.
|
||||||
|
6.2.2 - Thanks to Patrik Modesto for adding a small improvement. For some
|
||||||
|
reason his bufexplorer window was always showing up folded. He added
|
||||||
|
'setlocal nofoldenable' and it was fixed.
|
||||||
|
6.2.1 - Thanks goes out to Takashi Matsuo for added the 'fullPath' sorting
|
||||||
|
logic and option.
|
||||||
|
6.2.0 - Thanks goes out to Simon Johann-Ganter for spotting and fixing a
|
||||||
|
problem in that the last search pattern is overridden by the search
|
||||||
|
pattern for blank lines.
|
||||||
|
6.1.6 - Thanks to Artem Chuprina for finding a pesky bug that has been around
|
||||||
|
for sometime now. The <esc> key mapping was causing the buffer
|
||||||
|
explored to close prematurely when vim was run in an xterm. The <esc>
|
||||||
|
key mapping is now removed.
|
||||||
|
6.1.5 - Thanks to Khorev Sergey. Added option to show default help or not.
|
||||||
|
6.1.4 - Thanks goes out to Valery Kondakoff for suggesting the addition of
|
||||||
|
setlocal nonumber and foldcolumn=0. This allows for line numbering
|
||||||
|
and folding to be turned off temporarily while in the explorer.
|
||||||
|
6.1.3 - Added folding. Did some code cleanup. Added the ability to force the
|
||||||
|
newly split window to be temporarily vertical, which was suggested by
|
||||||
|
Thomas Glanzmann.
|
||||||
|
6.1.2 - Now pressing the <esc> key will quit, just like 'q'.
|
||||||
|
Added folds to hide winmanager configuration.
|
||||||
|
If anyone had the 'C' option in their cpoptions they would receive
|
||||||
|
a E10 error on startup of BufExplorer. cpo is now saved, updated and
|
||||||
|
restored. Thanks to Charles E Campbell, Jr.
|
||||||
|
Attempted to make sure there can only be one BufExplorer window open
|
||||||
|
at a time.
|
||||||
|
6.1.1 - Thanks to Brian D. Goodwin for adding toupper to FileNameCmp. This
|
||||||
|
way buffers sorted by name will be in the correct order regardless of
|
||||||
|
case.
|
||||||
|
6.0.16 - Thanks to Andre Pang for the original patch/idea to get bufexplorer
|
||||||
|
to work in insertmode/modeless mode (evim). Added Initialize
|
||||||
|
and Cleanup autocommands to handle commands that need to be
|
||||||
|
performed when starting or leaving bufexplorer.
|
||||||
|
6.0.15 - Srinath Avadhanulax added a patch for winmanager.vim.
|
||||||
|
6.0.14 - Fix a few more bug that I thought I already had fixed. Thanks
|
||||||
|
to Eric Bloodworth for adding 'Open Mode/Edit in Place'. Added
|
||||||
|
vertical splitting.
|
||||||
|
6.0.13 - Thanks to Charles E Campbell, Jr. for pointing out some embarrassing
|
||||||
|
typos that I had in the documentation. I guess I need to run
|
||||||
|
the spell checker more :o)
|
||||||
|
6.0.12 - Thanks to Madoka Machitani, for the tip on adding the augroup command
|
||||||
|
around the MRUList autocommands.
|
||||||
|
6.0.11 - Fixed bug report by Xiangjiang Ma. '"=' was being added to the
|
||||||
|
search history which messed up hlsearch.
|
||||||
|
6.0.10 - Added the necessary hooks so that the Srinath Avadhanula's
|
||||||
|
winmanager.vim script could more easily integrate with this script.
|
||||||
|
Tried to improve performance.
|
||||||
|
6.0.9 - Added MRU (Most Recently Used) sort ordering.
|
||||||
|
6.0.8 - Was not resetting the showcmd command correctly.
|
||||||
|
Added nifty help file.
|
||||||
|
6.0.7 - Thanks to Brett Carlane for some great enhancements. Some are added,
|
||||||
|
some are not, yet. Added highlighting of current and alternate
|
||||||
|
filenames. Added splitting of path/filename toggle. Reworked
|
||||||
|
ShowBuffers().
|
||||||
|
Changed my email address.
|
||||||
|
6.0.6 - Copyright notice added. Needed this so that it could be distributed
|
||||||
|
with Debian Linux. Fixed problem with the SortListing() function
|
||||||
|
failing when there was only one buffer to display.
|
||||||
|
6.0.5 - Fixed problems reported by David Pascoe, in that you where unable to
|
||||||
|
hit 'd' on a buffer that belonged to a files that no longer existed
|
||||||
|
and that the 'yank' buffer was being overridden by the help text when
|
||||||
|
the bufexplorer was opened.
|
||||||
|
6.0.4 - Thanks to Charles Campbell, Jr. for making this plugin more plugin
|
||||||
|
*compliant*, adding default keymappings of <Leader>be and <Leader>bs
|
||||||
|
as well as fixing the 'w:sortDirLabel not being defined' bug.
|
||||||
|
6.0.3 - Added sorting capabilities. Sort taken from explorer.vim.
|
||||||
|
6.0.2 - Can't remember.
|
||||||
|
6.0.1 - Initial release.
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
TODO *bufexplorer-todo*
|
||||||
|
|
||||||
|
- The issuing of a ':bd' command does not always remove the buffer number from
|
||||||
|
the MRU list.
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
CREDITS *bufexplorer-credits*
|
||||||
|
|
||||||
|
Author: Jeff Lanzarotta <delux256-vim at yahoo dot com>
|
||||||
|
|
||||||
|
Credit must go out to Bram Moolenaar and all the Vim developers for
|
||||||
|
making the world's best editor (IMHO). I also want to thank everyone who
|
||||||
|
helped and gave me suggestions. I wouldn't want to leave anyone out so I
|
||||||
|
won't list names.
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
vim:tw=78:noet:wrap:ts=8:ft=help:norl:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,218 @@
|
||||||
|
'NERDAllowAnyVisualDelims' NERD_commenter.txt /*'NERDAllowAnyVisualDelims'*
|
||||||
|
'NERDBlockComIgnoreEmpty' NERD_commenter.txt /*'NERDBlockComIgnoreEmpty'*
|
||||||
|
'NERDChristmasTree' NERD_tree.txt /*'NERDChristmasTree'*
|
||||||
|
'NERDCommentWholeLinesInVMode' NERD_commenter.txt /*'NERDCommentWholeLinesInVMode'*
|
||||||
|
'NERDCompactSexyComs' NERD_commenter.txt /*'NERDCompactSexyComs'*
|
||||||
|
'NERDCreateDefaultMappings' NERD_commenter.txt /*'NERDCreateDefaultMappings'*
|
||||||
|
'NERDDefaultNesting' NERD_commenter.txt /*'NERDDefaultNesting'*
|
||||||
|
'NERDLPlace' NERD_commenter.txt /*'NERDLPlace'*
|
||||||
|
'NERDMenuMode' NERD_commenter.txt /*'NERDMenuMode'*
|
||||||
|
'NERDRPlace' NERD_commenter.txt /*'NERDRPlace'*
|
||||||
|
'NERDRemoveAltComs' NERD_commenter.txt /*'NERDRemoveAltComs'*
|
||||||
|
'NERDRemoveExtraSpaces' NERD_commenter.txt /*'NERDRemoveExtraSpaces'*
|
||||||
|
'NERDSpaceDelims' NERD_commenter.txt /*'NERDSpaceDelims'*
|
||||||
|
'NERDTreeAutoCenter' NERD_tree.txt /*'NERDTreeAutoCenter'*
|
||||||
|
'NERDTreeAutoCenterThreshold' NERD_tree.txt /*'NERDTreeAutoCenterThreshold'*
|
||||||
|
'NERDTreeBookmarksFile' NERD_tree.txt /*'NERDTreeBookmarksFile'*
|
||||||
|
'NERDTreeCaseSensitiveSort' NERD_tree.txt /*'NERDTreeCaseSensitiveSort'*
|
||||||
|
'NERDTreeChDirMode' NERD_tree.txt /*'NERDTreeChDirMode'*
|
||||||
|
'NERDTreeHighlightCursorline' NERD_tree.txt /*'NERDTreeHighlightCursorline'*
|
||||||
|
'NERDTreeHijackNetrw' NERD_tree.txt /*'NERDTreeHijackNetrw'*
|
||||||
|
'NERDTreeIgnore' NERD_tree.txt /*'NERDTreeIgnore'*
|
||||||
|
'NERDTreeMouseMode' NERD_tree.txt /*'NERDTreeMouseMode'*
|
||||||
|
'NERDTreeQuitOnOpen' NERD_tree.txt /*'NERDTreeQuitOnOpen'*
|
||||||
|
'NERDTreeShowBookmarks' NERD_tree.txt /*'NERDTreeShowBookmarks'*
|
||||||
|
'NERDTreeShowFiles' NERD_tree.txt /*'NERDTreeShowFiles'*
|
||||||
|
'NERDTreeShowHidden' NERD_tree.txt /*'NERDTreeShowHidden'*
|
||||||
|
'NERDTreeShowLineNumbers' NERD_tree.txt /*'NERDTreeShowLineNumbers'*
|
||||||
|
'NERDTreeSortOrder' NERD_tree.txt /*'NERDTreeSortOrder'*
|
||||||
|
'NERDTreeStatusline' NERD_tree.txt /*'NERDTreeStatusline'*
|
||||||
|
'NERDTreeWinPos' NERD_tree.txt /*'NERDTreeWinPos'*
|
||||||
|
'NERDTreeWinSize' NERD_tree.txt /*'NERDTreeWinSize'*
|
||||||
|
'NERDUsePlaceHolders' NERD_commenter.txt /*'NERDUsePlaceHolders'*
|
||||||
|
'Tlist_Auto_Highlight_Tag' taglist.txt /*'Tlist_Auto_Highlight_Tag'*
|
||||||
|
'Tlist_Auto_Open' taglist.txt /*'Tlist_Auto_Open'*
|
||||||
|
'Tlist_Auto_Update' taglist.txt /*'Tlist_Auto_Update'*
|
||||||
|
'Tlist_Close_On_Select' taglist.txt /*'Tlist_Close_On_Select'*
|
||||||
|
'Tlist_Compact_Format' taglist.txt /*'Tlist_Compact_Format'*
|
||||||
|
'Tlist_Ctags_Cmd' taglist.txt /*'Tlist_Ctags_Cmd'*
|
||||||
|
'Tlist_Display_Prototype' taglist.txt /*'Tlist_Display_Prototype'*
|
||||||
|
'Tlist_Display_Tag_Scope' taglist.txt /*'Tlist_Display_Tag_Scope'*
|
||||||
|
'Tlist_Enable_Fold_Column' taglist.txt /*'Tlist_Enable_Fold_Column'*
|
||||||
|
'Tlist_Exit_OnlyWindow' taglist.txt /*'Tlist_Exit_OnlyWindow'*
|
||||||
|
'Tlist_File_Fold_Auto_Close' taglist.txt /*'Tlist_File_Fold_Auto_Close'*
|
||||||
|
'Tlist_GainFocus_On_ToggleOpen' taglist.txt /*'Tlist_GainFocus_On_ToggleOpen'*
|
||||||
|
'Tlist_Highlight_Tag_On_BufEnter' taglist.txt /*'Tlist_Highlight_Tag_On_BufEnter'*
|
||||||
|
'Tlist_Inc_Winwidth' taglist.txt /*'Tlist_Inc_Winwidth'*
|
||||||
|
'Tlist_Max_Submenu_Items' taglist.txt /*'Tlist_Max_Submenu_Items'*
|
||||||
|
'Tlist_Max_Tag_Length' taglist.txt /*'Tlist_Max_Tag_Length'*
|
||||||
|
'Tlist_Process_File_Always' taglist.txt /*'Tlist_Process_File_Always'*
|
||||||
|
'Tlist_Show_Menu' taglist.txt /*'Tlist_Show_Menu'*
|
||||||
|
'Tlist_Show_One_File' taglist.txt /*'Tlist_Show_One_File'*
|
||||||
|
'Tlist_Sort_Type' taglist.txt /*'Tlist_Sort_Type'*
|
||||||
|
'Tlist_Use_Horiz_Window' taglist.txt /*'Tlist_Use_Horiz_Window'*
|
||||||
|
'Tlist_Use_Right_Window' taglist.txt /*'Tlist_Use_Right_Window'*
|
||||||
|
'Tlist_Use_SingleClick' taglist.txt /*'Tlist_Use_SingleClick'*
|
||||||
|
'Tlist_WinHeight' taglist.txt /*'Tlist_WinHeight'*
|
||||||
|
'Tlist_WinWidth' taglist.txt /*'Tlist_WinWidth'*
|
||||||
|
'loaded_nerd_comments' NERD_commenter.txt /*'loaded_nerd_comments'*
|
||||||
|
'loaded_nerd_tree' NERD_tree.txt /*'loaded_nerd_tree'*
|
||||||
|
:NERDTree NERD_tree.txt /*:NERDTree*
|
||||||
|
:NERDTreeClose NERD_tree.txt /*:NERDTreeClose*
|
||||||
|
:NERDTreeFromBookmark NERD_tree.txt /*:NERDTreeFromBookmark*
|
||||||
|
:NERDTreeMirror NERD_tree.txt /*:NERDTreeMirror*
|
||||||
|
:NERDTreeToggle NERD_tree.txt /*:NERDTreeToggle*
|
||||||
|
:TlistAddFiles taglist.txt /*:TlistAddFiles*
|
||||||
|
:TlistAddFilesRecursive taglist.txt /*:TlistAddFilesRecursive*
|
||||||
|
:TlistClose taglist.txt /*:TlistClose*
|
||||||
|
:TlistDebug taglist.txt /*:TlistDebug*
|
||||||
|
:TlistHighlightTag taglist.txt /*:TlistHighlightTag*
|
||||||
|
:TlistLock taglist.txt /*:TlistLock*
|
||||||
|
:TlistMessages taglist.txt /*:TlistMessages*
|
||||||
|
:TlistOpen taglist.txt /*:TlistOpen*
|
||||||
|
:TlistSessionLoad taglist.txt /*:TlistSessionLoad*
|
||||||
|
:TlistSessionSave taglist.txt /*:TlistSessionSave*
|
||||||
|
:TlistShowPrototype taglist.txt /*:TlistShowPrototype*
|
||||||
|
:TlistShowTag taglist.txt /*:TlistShowTag*
|
||||||
|
:TlistToggle taglist.txt /*:TlistToggle*
|
||||||
|
:TlistUndebug taglist.txt /*:TlistUndebug*
|
||||||
|
:TlistUnlock taglist.txt /*:TlistUnlock*
|
||||||
|
:TlistUpdate taglist.txt /*:TlistUpdate*
|
||||||
|
NERDComAbout NERD_commenter.txt /*NERDComAbout*
|
||||||
|
NERDComAlignedComment NERD_commenter.txt /*NERDComAlignedComment*
|
||||||
|
NERDComAltDelim NERD_commenter.txt /*NERDComAltDelim*
|
||||||
|
NERDComAppendComment NERD_commenter.txt /*NERDComAppendComment*
|
||||||
|
NERDComChangelog NERD_commenter.txt /*NERDComChangelog*
|
||||||
|
NERDComComment NERD_commenter.txt /*NERDComComment*
|
||||||
|
NERDComCredits NERD_commenter.txt /*NERDComCredits*
|
||||||
|
NERDComDefaultDelims NERD_commenter.txt /*NERDComDefaultDelims*
|
||||||
|
NERDComEOLComment NERD_commenter.txt /*NERDComEOLComment*
|
||||||
|
NERDComFiletypes NERD_commenter.txt /*NERDComFiletypes*
|
||||||
|
NERDComFunctionality NERD_commenter.txt /*NERDComFunctionality*
|
||||||
|
NERDComFunctionalityDetails NERD_commenter.txt /*NERDComFunctionalityDetails*
|
||||||
|
NERDComFunctionalitySummary NERD_commenter.txt /*NERDComFunctionalitySummary*
|
||||||
|
NERDComHeuristics NERD_commenter.txt /*NERDComHeuristics*
|
||||||
|
NERDComInsertComment NERD_commenter.txt /*NERDComInsertComment*
|
||||||
|
NERDComInvertComment NERD_commenter.txt /*NERDComInvertComment*
|
||||||
|
NERDComIssues NERD_commenter.txt /*NERDComIssues*
|
||||||
|
NERDComLicense NERD_commenter.txt /*NERDComLicense*
|
||||||
|
NERDComMappings NERD_commenter.txt /*NERDComMappings*
|
||||||
|
NERDComMinimalComment NERD_commenter.txt /*NERDComMinimalComment*
|
||||||
|
NERDComNERDComment NERD_commenter.txt /*NERDComNERDComment*
|
||||||
|
NERDComNestedComment NERD_commenter.txt /*NERDComNestedComment*
|
||||||
|
NERDComNesting NERD_commenter.txt /*NERDComNesting*
|
||||||
|
NERDComOptions NERD_commenter.txt /*NERDComOptions*
|
||||||
|
NERDComOptionsDetails NERD_commenter.txt /*NERDComOptionsDetails*
|
||||||
|
NERDComOptionsSummary NERD_commenter.txt /*NERDComOptionsSummary*
|
||||||
|
NERDComSexyComment NERD_commenter.txt /*NERDComSexyComment*
|
||||||
|
NERDComSexyComments NERD_commenter.txt /*NERDComSexyComments*
|
||||||
|
NERDComToggleComment NERD_commenter.txt /*NERDComToggleComment*
|
||||||
|
NERDComUncommentLine NERD_commenter.txt /*NERDComUncommentLine*
|
||||||
|
NERDComYankComment NERD_commenter.txt /*NERDComYankComment*
|
||||||
|
NERDCommenter NERD_commenter.txt /*NERDCommenter*
|
||||||
|
NERDCommenterContents NERD_commenter.txt /*NERDCommenterContents*
|
||||||
|
NERDTree NERD_tree.txt /*NERDTree*
|
||||||
|
NERDTree-! NERD_tree.txt /*NERDTree-!*
|
||||||
|
NERDTree-? NERD_tree.txt /*NERDTree-?*
|
||||||
|
NERDTree-B NERD_tree.txt /*NERDTree-B*
|
||||||
|
NERDTree-C NERD_tree.txt /*NERDTree-C*
|
||||||
|
NERDTree-D NERD_tree.txt /*NERDTree-D*
|
||||||
|
NERDTree-F NERD_tree.txt /*NERDTree-F*
|
||||||
|
NERDTree-I NERD_tree.txt /*NERDTree-I*
|
||||||
|
NERDTree-J NERD_tree.txt /*NERDTree-J*
|
||||||
|
NERDTree-K NERD_tree.txt /*NERDTree-K*
|
||||||
|
NERDTree-O NERD_tree.txt /*NERDTree-O*
|
||||||
|
NERDTree-P NERD_tree.txt /*NERDTree-P*
|
||||||
|
NERDTree-R NERD_tree.txt /*NERDTree-R*
|
||||||
|
NERDTree-T NERD_tree.txt /*NERDTree-T*
|
||||||
|
NERDTree-U NERD_tree.txt /*NERDTree-U*
|
||||||
|
NERDTree-X NERD_tree.txt /*NERDTree-X*
|
||||||
|
NERDTree-c-j NERD_tree.txt /*NERDTree-c-j*
|
||||||
|
NERDTree-c-k NERD_tree.txt /*NERDTree-c-k*
|
||||||
|
NERDTree-contents NERD_tree.txt /*NERDTree-contents*
|
||||||
|
NERDTree-e NERD_tree.txt /*NERDTree-e*
|
||||||
|
NERDTree-f NERD_tree.txt /*NERDTree-f*
|
||||||
|
NERDTree-gi NERD_tree.txt /*NERDTree-gi*
|
||||||
|
NERDTree-go NERD_tree.txt /*NERDTree-go*
|
||||||
|
NERDTree-gs NERD_tree.txt /*NERDTree-gs*
|
||||||
|
NERDTree-i NERD_tree.txt /*NERDTree-i*
|
||||||
|
NERDTree-m NERD_tree.txt /*NERDTree-m*
|
||||||
|
NERDTree-o NERD_tree.txt /*NERDTree-o*
|
||||||
|
NERDTree-p NERD_tree.txt /*NERDTree-p*
|
||||||
|
NERDTree-q NERD_tree.txt /*NERDTree-q*
|
||||||
|
NERDTree-r NERD_tree.txt /*NERDTree-r*
|
||||||
|
NERDTree-s NERD_tree.txt /*NERDTree-s*
|
||||||
|
NERDTree-t NERD_tree.txt /*NERDTree-t*
|
||||||
|
NERDTree-u NERD_tree.txt /*NERDTree-u*
|
||||||
|
NERDTree-x NERD_tree.txt /*NERDTree-x*
|
||||||
|
NERDTreeAbout NERD_tree.txt /*NERDTreeAbout*
|
||||||
|
NERDTreeBookmarkCommands NERD_tree.txt /*NERDTreeBookmarkCommands*
|
||||||
|
NERDTreeBookmarkTable NERD_tree.txt /*NERDTreeBookmarkTable*
|
||||||
|
NERDTreeBookmarks NERD_tree.txt /*NERDTreeBookmarks*
|
||||||
|
NERDTreeChangelog NERD_tree.txt /*NERDTreeChangelog*
|
||||||
|
NERDTreeCredits NERD_tree.txt /*NERDTreeCredits*
|
||||||
|
NERDTreeFilesysMenu NERD_tree.txt /*NERDTreeFilesysMenu*
|
||||||
|
NERDTreeFunctionality NERD_tree.txt /*NERDTreeFunctionality*
|
||||||
|
NERDTreeGlobalCommands NERD_tree.txt /*NERDTreeGlobalCommands*
|
||||||
|
NERDTreeHacking NERD_tree.txt /*NERDTreeHacking*
|
||||||
|
NERDTreeInvalidBookmarks NERD_tree.txt /*NERDTreeInvalidBookmarks*
|
||||||
|
NERDTreeLicense NERD_tree.txt /*NERDTreeLicense*
|
||||||
|
NERDTreeMappings NERD_tree.txt /*NERDTreeMappings*
|
||||||
|
NERDTreeOptionDetails NERD_tree.txt /*NERDTreeOptionDetails*
|
||||||
|
NERDTreeOptionSummary NERD_tree.txt /*NERDTreeOptionSummary*
|
||||||
|
NERDTreeOptions NERD_tree.txt /*NERDTreeOptions*
|
||||||
|
NERD_commenter.txt NERD_commenter.txt /*NERD_commenter.txt*
|
||||||
|
NERD_tree.txt NERD_tree.txt /*NERD_tree.txt*
|
||||||
|
Tlist_Get_Tag_Prototype_By_Line() taglist.txt /*Tlist_Get_Tag_Prototype_By_Line()*
|
||||||
|
Tlist_Get_Tagname_By_Line() taglist.txt /*Tlist_Get_Tagname_By_Line()*
|
||||||
|
Tlist_Set_App() taglist.txt /*Tlist_Set_App()*
|
||||||
|
Tlist_Update_File_Tags() taglist.txt /*Tlist_Update_File_Tags()*
|
||||||
|
bufexplorer bufexplorer.txt /*bufexplorer*
|
||||||
|
bufexplorer-changelog bufexplorer.txt /*bufexplorer-changelog*
|
||||||
|
bufexplorer-credits bufexplorer.txt /*bufexplorer-credits*
|
||||||
|
bufexplorer-customization bufexplorer.txt /*bufexplorer-customization*
|
||||||
|
bufexplorer-installation bufexplorer.txt /*bufexplorer-installation*
|
||||||
|
bufexplorer-todo bufexplorer.txt /*bufexplorer-todo*
|
||||||
|
bufexplorer-usage bufexplorer.txt /*bufexplorer-usage*
|
||||||
|
bufexplorer.txt bufexplorer.txt /*bufexplorer.txt*
|
||||||
|
buffer-explorer bufexplorer.txt /*buffer-explorer*
|
||||||
|
g:bufExplorerDefaultHelp bufexplorer.txt /*g:bufExplorerDefaultHelp*
|
||||||
|
g:bufExplorerDetailedHelp bufexplorer.txt /*g:bufExplorerDetailedHelp*
|
||||||
|
g:bufExplorerFindActive bufexplorer.txt /*g:bufExplorerFindActive*
|
||||||
|
g:bufExplorerReverseSort bufexplorer.txt /*g:bufExplorerReverseSort*
|
||||||
|
g:bufExplorerShowDirectories bufexplorer.txt /*g:bufExplorerShowDirectories*
|
||||||
|
g:bufExplorerShowRelativePath bufexplorer.txt /*g:bufExplorerShowRelativePath*
|
||||||
|
g:bufExplorerShowUnlisted bufexplorer.txt /*g:bufExplorerShowUnlisted*
|
||||||
|
g:bufExplorerSortBy bufexplorer.txt /*g:bufExplorerSortBy*
|
||||||
|
g:bufExplorerSplitBelow bufexplorer.txt /*g:bufExplorerSplitBelow*
|
||||||
|
g:bufExplorerSplitOutPathName bufexplorer.txt /*g:bufExplorerSplitOutPathName*
|
||||||
|
g:bufExplorerSplitRight bufexplorer.txt /*g:bufExplorerSplitRight*
|
||||||
|
project project.txt /*project*
|
||||||
|
project-adding-mappings project.txt /*project-adding-mappings*
|
||||||
|
project-example project.txt /*project-example*
|
||||||
|
project-flags project.txt /*project-flags*
|
||||||
|
project-inheritance project.txt /*project-inheritance*
|
||||||
|
project-invoking project.txt /*project-invoking*
|
||||||
|
project-mappings project.txt /*project-mappings*
|
||||||
|
project-plugin project.txt /*project-plugin*
|
||||||
|
project-settings project.txt /*project-settings*
|
||||||
|
project-syntax project.txt /*project-syntax*
|
||||||
|
project-tips project.txt /*project-tips*
|
||||||
|
project.txt project.txt /*project.txt*
|
||||||
|
taglist-commands taglist.txt /*taglist-commands*
|
||||||
|
taglist-debug taglist.txt /*taglist-debug*
|
||||||
|
taglist-extend taglist.txt /*taglist-extend*
|
||||||
|
taglist-faq taglist.txt /*taglist-faq*
|
||||||
|
taglist-functions taglist.txt /*taglist-functions*
|
||||||
|
taglist-install taglist.txt /*taglist-install*
|
||||||
|
taglist-internet taglist.txt /*taglist-internet*
|
||||||
|
taglist-intro taglist.txt /*taglist-intro*
|
||||||
|
taglist-keys taglist.txt /*taglist-keys*
|
||||||
|
taglist-license taglist.txt /*taglist-license*
|
||||||
|
taglist-menu taglist.txt /*taglist-menu*
|
||||||
|
taglist-options taglist.txt /*taglist-options*
|
||||||
|
taglist-requirements taglist.txt /*taglist-requirements*
|
||||||
|
taglist-session taglist.txt /*taglist-session*
|
||||||
|
taglist-todo taglist.txt /*taglist-todo*
|
||||||
|
taglist-using taglist.txt /*taglist-using*
|
||||||
|
taglist.txt taglist.txt /*taglist.txt*
|
|
@ -0,0 +1,86 @@
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: Mako
|
||||||
|
" Maintainer: Armin Ronacher <armin.ronacher@active-4.com>
|
||||||
|
" URL: http://lucumr.pocoo.org/
|
||||||
|
" Last Change: 2008 September 12
|
||||||
|
" Version: 0.6.1
|
||||||
|
"
|
||||||
|
" Thanks to Brine Rue <brian@lolapps.com> who noticed a bug in the
|
||||||
|
" delimiter handling.
|
||||||
|
"
|
||||||
|
" Known Limitations
|
||||||
|
" the <%text> block does not have correct attributes
|
||||||
|
|
||||||
|
" For version 5.x: Clear all syntax items
|
||||||
|
" For version 6.x: Quit when a syntax file was already loaded
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("main_syntax")
|
||||||
|
let main_syntax = "html"
|
||||||
|
endif
|
||||||
|
|
||||||
|
"Source the html syntax file
|
||||||
|
ru! syntax/html.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
|
||||||
|
"Put the python syntax file in @pythonTop
|
||||||
|
syn include @pythonTop syntax/python.vim
|
||||||
|
|
||||||
|
" End keywords
|
||||||
|
syn keyword makoEnd contained endfor endwhile endif endtry enddef
|
||||||
|
|
||||||
|
" Block rules
|
||||||
|
syn region makoLine matchgroup=makoDelim start=#^\s*%# end=#$# keepend contains=@pythonTop,makoEnd
|
||||||
|
syn region makoBlock matchgroup=makoDelim start=#<%!\?# end=#%># keepend contains=@pythonTop,makoEnd
|
||||||
|
|
||||||
|
" Variables
|
||||||
|
syn region makoNested start="{" end="}" transparent display contained contains=makoNested,@pythonTop
|
||||||
|
syn region makoVariable matchgroup=makoDelim start=#\${# end=#}# contains=makoNested,@pythonTop
|
||||||
|
|
||||||
|
" Comments
|
||||||
|
syn region makoComment start="^\s*##" end="$"
|
||||||
|
syn region makoDocComment matchgroup=makoDelim start="<%doc>" end="</%doc>" keepend
|
||||||
|
|
||||||
|
" Literal Blocks
|
||||||
|
syn region makoText matchgroup=makoDelim start="<%text[^>]*>" end="</%text>"
|
||||||
|
|
||||||
|
" Attribute Sublexing
|
||||||
|
syn match makoAttributeKey containedin=makoTag contained "[a-zA-Z_][a-zA-Z0-9_]*="
|
||||||
|
syn region makoAttributeValue containedin=makoTag contained start=/"/ skip=/\\"/ end=/"/
|
||||||
|
syn region makoAttributeValue containedin=MakoTag contained start=/'/ skip=/\\'/ end=/'/
|
||||||
|
|
||||||
|
" Tags
|
||||||
|
syn region makoTag matchgroup=makoDelim start="<%\(def\|call\|page\|include\|namespace\|inherit\)\>" end="/\?>"
|
||||||
|
syn match makoDelim "</%\(def\|call\|namespace\)>"
|
||||||
|
|
||||||
|
" Newline Escapes
|
||||||
|
syn match makoEscape /\\$/
|
||||||
|
|
||||||
|
" Default highlighting links
|
||||||
|
if version >= 508 || !exists("did_mako_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_mako_syn_inits = 1
|
||||||
|
com -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
com -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
HiLink makoDocComment makoComment
|
||||||
|
HiLink makoDefEnd makoDelim
|
||||||
|
|
||||||
|
HiLink makoAttributeKey Type
|
||||||
|
HiLink makoAttributeValue String
|
||||||
|
HiLink makoText Normal
|
||||||
|
HiLink makoDelim Preproc
|
||||||
|
HiLink makoEnd Keyword
|
||||||
|
HiLink makoComment Comment
|
||||||
|
HiLink makoEscape Special
|
||||||
|
|
||||||
|
delc HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "eruby"
|
|
@ -0,0 +1,446 @@
|
||||||
|
" -*- vim -*-
|
||||||
|
" FILE: python.vim
|
||||||
|
" LAST MODIFICATION: 2008-05-17 6:29pm
|
||||||
|
" (C) Copyright 2001-2005 Mikael Berthe <bmikael@lists.lilotux.net>
|
||||||
|
" Maintained by Jon Franklin <jvfranklin@gmail.com>
|
||||||
|
" Version: 1.12
|
||||||
|
|
||||||
|
" USAGE:
|
||||||
|
"
|
||||||
|
" Save this file to $VIMFILES/ftplugin/python.vim. You can have multiple
|
||||||
|
" python ftplugins by creating $VIMFILES/ftplugin/python and saving your
|
||||||
|
" ftplugins in that directory. If saving this to the global ftplugin
|
||||||
|
" directory, this is the recommended method, since vim ships with an
|
||||||
|
" ftplugin/python.vim file already.
|
||||||
|
" You can set the global variable "g:py_select_leading_comments" to 0
|
||||||
|
" if you don't want to select comments preceding a declaration (these
|
||||||
|
" are usually the description of the function/class).
|
||||||
|
" You can set the global variable "g:py_select_trailing_comments" to 0
|
||||||
|
" if you don't want to select comments at the end of a function/class.
|
||||||
|
" If these variables are not defined, both leading and trailing comments
|
||||||
|
" are selected.
|
||||||
|
" Example: (in your .vimrc) "let g:py_select_leading_comments = 0"
|
||||||
|
" You may want to take a look at the 'shiftwidth' option for the
|
||||||
|
" shift commands...
|
||||||
|
"
|
||||||
|
" REQUIREMENTS:
|
||||||
|
" vim (>= 7)
|
||||||
|
"
|
||||||
|
" Shortcuts:
|
||||||
|
" ]t -- Jump to beginning of block
|
||||||
|
" ]e -- Jump to end of block
|
||||||
|
" ]v -- Select (Visual Line Mode) block
|
||||||
|
" ]< -- Shift block to left
|
||||||
|
" ]> -- Shift block to right
|
||||||
|
" ]# -- Comment selection
|
||||||
|
" ]u -- Uncomment selection
|
||||||
|
" ]c -- Select current/previous class
|
||||||
|
" ]d -- Select current/previous function
|
||||||
|
" ]<up> -- Jump to previous line with the same/lower indentation
|
||||||
|
" ]<down> -- Jump to next line with the same/lower indentation
|
||||||
|
|
||||||
|
" Only do this when not done yet for this buffer
|
||||||
|
if exists("b:loaded_py_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:loaded_py_ftplugin = 1
|
||||||
|
|
||||||
|
map ]t :PBoB<CR>
|
||||||
|
vmap ]t :<C-U>PBOB<CR>m'gv``
|
||||||
|
map ]e :PEoB<CR>
|
||||||
|
vmap ]e :<C-U>PEoB<CR>m'gv``
|
||||||
|
|
||||||
|
map ]v ]tV]e
|
||||||
|
map ]< ]tV]e<
|
||||||
|
vmap ]< <
|
||||||
|
map ]> ]tV]e>
|
||||||
|
vmap ]> >
|
||||||
|
|
||||||
|
map ]# :call PythonCommentSelection()<CR>
|
||||||
|
vmap ]# :call PythonCommentSelection()<CR>
|
||||||
|
map ]u :call PythonUncommentSelection()<CR>
|
||||||
|
vmap ]u :call PythonUncommentSelection()<CR>
|
||||||
|
|
||||||
|
map ]c :call PythonSelectObject("class")<CR>
|
||||||
|
map ]d :call PythonSelectObject("function")<CR>
|
||||||
|
|
||||||
|
map ]<up> :call PythonNextLine(-1)<CR>
|
||||||
|
map ]<down> :call PythonNextLine(1)<CR>
|
||||||
|
" You may prefer use <s-up> and <s-down>... :-)
|
||||||
|
|
||||||
|
" jump to previous class
|
||||||
|
map ]J :call PythonDec("class", -1)<CR>
|
||||||
|
vmap ]J :call PythonDec("class", -1)<CR>
|
||||||
|
|
||||||
|
" jump to next class
|
||||||
|
map ]j :call PythonDec("class", 1)<CR>
|
||||||
|
vmap ]j :call PythonDec("class", 1)<CR>
|
||||||
|
|
||||||
|
" jump to previous function
|
||||||
|
map ]F :call PythonDec("function", -1)<CR>
|
||||||
|
vmap ]F :call PythonDec("function", -1)<CR>
|
||||||
|
|
||||||
|
" jump to next function
|
||||||
|
map ]f :call PythonDec("function", 1)<CR>
|
||||||
|
vmap ]f :call PythonDec("function", 1)<CR>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
" Menu entries
|
||||||
|
nmenu <silent> &Python.Update\ IM-Python\ Menu
|
||||||
|
\:call UpdateMenu()<CR>
|
||||||
|
nmenu &Python.-Sep1- :
|
||||||
|
nmenu <silent> &Python.Beginning\ of\ Block<Tab>[t
|
||||||
|
\]t
|
||||||
|
nmenu <silent> &Python.End\ of\ Block<Tab>]e
|
||||||
|
\]e
|
||||||
|
nmenu &Python.-Sep2- :
|
||||||
|
nmenu <silent> &Python.Shift\ Block\ Left<Tab>]<
|
||||||
|
\]<
|
||||||
|
vmenu <silent> &Python.Shift\ Block\ Left<Tab>]<
|
||||||
|
\]<
|
||||||
|
nmenu <silent> &Python.Shift\ Block\ Right<Tab>]>
|
||||||
|
\]>
|
||||||
|
vmenu <silent> &Python.Shift\ Block\ Right<Tab>]>
|
||||||
|
\]>
|
||||||
|
nmenu &Python.-Sep3- :
|
||||||
|
vmenu <silent> &Python.Comment\ Selection<Tab>]#
|
||||||
|
\]#
|
||||||
|
nmenu <silent> &Python.Comment\ Selection<Tab>]#
|
||||||
|
\]#
|
||||||
|
vmenu <silent> &Python.Uncomment\ Selection<Tab>]u
|
||||||
|
\]u
|
||||||
|
nmenu <silent> &Python.Uncomment\ Selection<Tab>]u
|
||||||
|
\]u
|
||||||
|
nmenu &Python.-Sep4- :
|
||||||
|
nmenu <silent> &Python.Previous\ Class<Tab>]J
|
||||||
|
\]J
|
||||||
|
nmenu <silent> &Python.Next\ Class<Tab>]j
|
||||||
|
\]j
|
||||||
|
nmenu <silent> &Python.Previous\ Function<Tab>]F
|
||||||
|
\]F
|
||||||
|
nmenu <silent> &Python.Next\ Function<Tab>]f
|
||||||
|
\]f
|
||||||
|
nmenu &Python.-Sep5- :
|
||||||
|
nmenu <silent> &Python.Select\ Block<Tab>]v
|
||||||
|
\]v
|
||||||
|
nmenu <silent> &Python.Select\ Function<Tab>]d
|
||||||
|
\]d
|
||||||
|
nmenu <silent> &Python.Select\ Class<Tab>]c
|
||||||
|
\]c
|
||||||
|
nmenu &Python.-Sep6- :
|
||||||
|
nmenu <silent> &Python.Previous\ Line\ wrt\ indent<Tab>]<up>
|
||||||
|
\]<up>
|
||||||
|
nmenu <silent> &Python.Next\ Line\ wrt\ indent<Tab>]<down>
|
||||||
|
\]<down>
|
||||||
|
|
||||||
|
:com! PBoB execute "normal ".PythonBoB(line('.'), -1, 1)."G"
|
||||||
|
:com! PEoB execute "normal ".PythonBoB(line('.'), 1, 1)."G"
|
||||||
|
:com! UpdateMenu call UpdateMenu()
|
||||||
|
|
||||||
|
|
||||||
|
" Go to a block boundary (-1: previous, 1: next)
|
||||||
|
" If force_sel_comments is true, 'g:py_select_trailing_comments' is ignored
|
||||||
|
function! PythonBoB(line, direction, force_sel_comments)
|
||||||
|
let ln = a:line
|
||||||
|
let ind = indent(ln)
|
||||||
|
let mark = ln
|
||||||
|
let indent_valid = strlen(getline(ln))
|
||||||
|
let ln = ln + a:direction
|
||||||
|
if (a:direction == 1) && (!a:force_sel_comments) &&
|
||||||
|
\ exists("g:py_select_trailing_comments") &&
|
||||||
|
\ (!g:py_select_trailing_comments)
|
||||||
|
let sel_comments = 0
|
||||||
|
else
|
||||||
|
let sel_comments = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
while((ln >= 1) && (ln <= line('$')))
|
||||||
|
if (sel_comments) || (match(getline(ln), "^\\s*#") == -1)
|
||||||
|
if (!indent_valid)
|
||||||
|
let indent_valid = strlen(getline(ln))
|
||||||
|
let ind = indent(ln)
|
||||||
|
let mark = ln
|
||||||
|
else
|
||||||
|
if (strlen(getline(ln)))
|
||||||
|
if (indent(ln) < ind)
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let mark = ln
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let ln = ln + a:direction
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return mark
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Go to previous (-1) or next (1) class/function definition
|
||||||
|
function! PythonDec(obj, direction)
|
||||||
|
if (a:obj == "class")
|
||||||
|
let objregexp = "^\\s*class\\s\\+[a-zA-Z0-9_]\\+"
|
||||||
|
\ . "\\s*\\((\\([a-zA-Z0-9_,. \\t\\n]\\)*)\\)\\=\\s*:"
|
||||||
|
else
|
||||||
|
let objregexp = "^\\s*def\\s\\+[a-zA-Z0-9_]\\+\\s*(\\_[^:#]*)\\s*:"
|
||||||
|
endif
|
||||||
|
let flag = "W"
|
||||||
|
if (a:direction == -1)
|
||||||
|
let flag = flag."b"
|
||||||
|
endif
|
||||||
|
let res = search(objregexp, flag)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Comment out selected lines
|
||||||
|
" commentString is inserted in non-empty lines, and should be aligned with
|
||||||
|
" the block
|
||||||
|
function! PythonCommentSelection() range
|
||||||
|
let commentString = "#"
|
||||||
|
let cl = a:firstline
|
||||||
|
let ind = 1000 " I hope nobody use so long lines! :)
|
||||||
|
|
||||||
|
" Look for smallest indent
|
||||||
|
while (cl <= a:lastline)
|
||||||
|
if strlen(getline(cl))
|
||||||
|
let cind = indent(cl)
|
||||||
|
let ind = ((ind < cind) ? ind : cind)
|
||||||
|
endif
|
||||||
|
let cl = cl + 1
|
||||||
|
endwhile
|
||||||
|
if (ind == 1000)
|
||||||
|
let ind = 1
|
||||||
|
else
|
||||||
|
let ind = ind + 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let cl = a:firstline
|
||||||
|
execute ":".cl
|
||||||
|
" Insert commentString in each non-empty line, in column ind
|
||||||
|
while (cl <= a:lastline)
|
||||||
|
if strlen(getline(cl))
|
||||||
|
execute "normal ".ind."|i".commentString
|
||||||
|
endif
|
||||||
|
execute "normal \<Down>"
|
||||||
|
let cl = cl + 1
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Uncomment selected lines
|
||||||
|
function! PythonUncommentSelection() range
|
||||||
|
" commentString could be different than the one from CommentSelection()
|
||||||
|
" For example, this could be "# \\="
|
||||||
|
let commentString = "#"
|
||||||
|
let cl = a:firstline
|
||||||
|
while (cl <= a:lastline)
|
||||||
|
let ul = substitute(getline(cl),
|
||||||
|
\"\\(\\s*\\)".commentString."\\(.*\\)$", "\\1\\2", "")
|
||||||
|
call setline(cl, ul)
|
||||||
|
let cl = cl + 1
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Select an object ("class"/"function")
|
||||||
|
function! PythonSelectObject(obj)
|
||||||
|
" Go to the object declaration
|
||||||
|
normal $
|
||||||
|
call PythonDec(a:obj, -1)
|
||||||
|
let beg = line('.')
|
||||||
|
|
||||||
|
if !exists("g:py_select_leading_comments") || (g:py_select_leading_comments)
|
||||||
|
let decind = indent(beg)
|
||||||
|
let cl = beg
|
||||||
|
while (cl>1)
|
||||||
|
let cl = cl - 1
|
||||||
|
if (indent(cl) == decind) && (getline(cl)[decind] == "#")
|
||||||
|
let beg = cl
|
||||||
|
else
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
endif
|
||||||
|
|
||||||
|
if (a:obj == "class")
|
||||||
|
let eod = "\\(^\\s*class\\s\\+[a-zA-Z0-9_]\\+\\s*"
|
||||||
|
\ . "\\((\\([a-zA-Z0-9_,. \\t\\n]\\)*)\\)\\=\\s*\\)\\@<=:"
|
||||||
|
else
|
||||||
|
let eod = "\\(^\\s*def\\s\\+[a-zA-Z0-9_]\\+\\s*(\\_[^:#]*)\\s*\\)\\@<=:"
|
||||||
|
endif
|
||||||
|
" Look for the end of the declaration (not always the same line!)
|
||||||
|
call search(eod, "")
|
||||||
|
|
||||||
|
" Is it a one-line definition?
|
||||||
|
if match(getline('.'), "^\\s*\\(#.*\\)\\=$", col('.')) == -1
|
||||||
|
let cl = line('.')
|
||||||
|
execute ":".beg
|
||||||
|
execute "normal V".cl."G"
|
||||||
|
else
|
||||||
|
" Select the whole block
|
||||||
|
execute "normal \<Down>"
|
||||||
|
let cl = line('.')
|
||||||
|
execute ":".beg
|
||||||
|
execute "normal V".PythonBoB(cl, 1, 0)."G"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Jump to the next line with the same (or lower) indentation
|
||||||
|
" Useful for moving between "if" and "else", for example.
|
||||||
|
function! PythonNextLine(direction)
|
||||||
|
let ln = line('.')
|
||||||
|
let ind = indent(ln)
|
||||||
|
let indent_valid = strlen(getline(ln))
|
||||||
|
let ln = ln + a:direction
|
||||||
|
|
||||||
|
while((ln >= 1) && (ln <= line('$')))
|
||||||
|
if (!indent_valid) && strlen(getline(ln))
|
||||||
|
break
|
||||||
|
else
|
||||||
|
if (strlen(getline(ln)))
|
||||||
|
if (indent(ln) <= ind)
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let ln = ln + a:direction
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
execute "normal ".ln."G"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! UpdateMenu()
|
||||||
|
" delete menu if it already exists, then rebuild it.
|
||||||
|
" this is necessary in case you've got multiple buffers open
|
||||||
|
" a future enhancement to this would be to make the menu aware of
|
||||||
|
" all buffers currently open, and group classes and functions by buffer
|
||||||
|
if exists("g:menuran")
|
||||||
|
aunmenu IM-Python
|
||||||
|
endif
|
||||||
|
let restore_fe = &foldenable
|
||||||
|
set nofoldenable
|
||||||
|
" preserve disposition of window and cursor
|
||||||
|
let cline=line('.')
|
||||||
|
let ccol=col('.') - 1
|
||||||
|
norm H
|
||||||
|
let hline=line('.')
|
||||||
|
" create the menu
|
||||||
|
call MenuBuilder()
|
||||||
|
" restore disposition of window and cursor
|
||||||
|
exe "norm ".hline."Gzt"
|
||||||
|
let dnscroll=cline-hline
|
||||||
|
exe "norm ".dnscroll."j".ccol."l"
|
||||||
|
let &foldenable = restore_fe
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! MenuBuilder()
|
||||||
|
norm gg0
|
||||||
|
let currentclass = -1
|
||||||
|
let classlist = []
|
||||||
|
let parentclass = ""
|
||||||
|
while line(".") < line("$")
|
||||||
|
" search for a class or function
|
||||||
|
if match ( getline("."), '^\s*class\s\+[_a-zA-Z].*:\|^\s*def\s\+[_a-zA-Z].*:' ) != -1
|
||||||
|
norm ^
|
||||||
|
let linenum = line('.')
|
||||||
|
let indentcol = col('.')
|
||||||
|
norm "nye
|
||||||
|
let classordef=@n
|
||||||
|
norm w"nywge
|
||||||
|
let objname=@n
|
||||||
|
let parentclass = FindParentClass(classlist, indentcol)
|
||||||
|
if classordef == "class"
|
||||||
|
call AddClass(objname, linenum, parentclass)
|
||||||
|
else " this is a function
|
||||||
|
call AddFunction(objname, linenum, parentclass)
|
||||||
|
endif
|
||||||
|
" We actually created a menu, so lets set the global variable
|
||||||
|
let g:menuran=1
|
||||||
|
call RebuildClassList(classlist, [objname, indentcol], classordef)
|
||||||
|
endif " line matched
|
||||||
|
norm j
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" classlist contains the list of nested classes we are in.
|
||||||
|
" in most cases it will be empty or contain a single class
|
||||||
|
" but where a class is nested within another, it will contain 2 or more
|
||||||
|
" this function adds or removes classes from the list based on indentation
|
||||||
|
function! RebuildClassList(classlist, newclass, classordef)
|
||||||
|
let i = len(a:classlist) - 1
|
||||||
|
while i > -1
|
||||||
|
if a:newclass[1] <= a:classlist[i][1]
|
||||||
|
call remove(a:classlist, i)
|
||||||
|
endif
|
||||||
|
let i = i - 1
|
||||||
|
endwhile
|
||||||
|
if a:classordef == "class"
|
||||||
|
call add(a:classlist, a:newclass)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" we found a class or function, determine its parent class based on
|
||||||
|
" indentation and what's contained in classlist
|
||||||
|
function! FindParentClass(classlist, indentcol)
|
||||||
|
let i = 0
|
||||||
|
let parentclass = ""
|
||||||
|
while i < len(a:classlist)
|
||||||
|
if a:indentcol <= a:classlist[i][1]
|
||||||
|
break
|
||||||
|
else
|
||||||
|
if len(parentclass) == 0
|
||||||
|
let parentclass = a:classlist[i][0]
|
||||||
|
else
|
||||||
|
let parentclass = parentclass.'\.'.a:classlist[i][0]
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let i = i + 1
|
||||||
|
endwhile
|
||||||
|
return parentclass
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" add a class to the menu
|
||||||
|
function! AddClass(classname, lineno, parentclass)
|
||||||
|
if len(a:parentclass) > 0
|
||||||
|
let classstring = a:parentclass.'\.'.a:classname
|
||||||
|
else
|
||||||
|
let classstring = a:classname
|
||||||
|
endif
|
||||||
|
exe 'menu IM-Python.classes.'.classstring.' :call <SID>JumpToAndUnfold('.a:lineno.')<CR>'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" add a function to the menu, grouped by member class
|
||||||
|
function! AddFunction(functionname, lineno, parentclass)
|
||||||
|
if len(a:parentclass) > 0
|
||||||
|
let funcstring = a:parentclass.'.'.a:functionname
|
||||||
|
else
|
||||||
|
let funcstring = a:functionname
|
||||||
|
endif
|
||||||
|
exe 'menu IM-Python.functions.'.funcstring.' :call <SID>JumpToAndUnfold('.a:lineno.')<CR>'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:JumpToAndUnfold(line)
|
||||||
|
" Go to the right line
|
||||||
|
execute 'normal '.a:line.'gg'
|
||||||
|
" Check to see if we are in a fold
|
||||||
|
let lvl = foldlevel(a:line)
|
||||||
|
if lvl != 0
|
||||||
|
" and if so, then expand the fold out, other wise, ignore this part.
|
||||||
|
execute 'normal 15zo'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"" This one will work only on vim 6.2 because of the try/catch expressions.
|
||||||
|
" function! s:JumpToAndUnfoldWithExceptions(line)
|
||||||
|
" try
|
||||||
|
" execute 'normal '.a:line.'gg15zo'
|
||||||
|
" catch /^Vim\((\a\+)\)\=:E490:/
|
||||||
|
" " Do nothing, just consume the error
|
||||||
|
" endtry
|
||||||
|
"endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" vim:set et sts=2 sw=2:
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
" Vim folding file
|
||||||
|
" Language: Python
|
||||||
|
" Author: Jorrit Wiersma (foldexpr), Max Ischenko (foldtext), Robert
|
||||||
|
" Ames (line counts)
|
||||||
|
" Last Change: 2005 Jul 14
|
||||||
|
" Version: 2.3
|
||||||
|
" Bug fix: Drexler Christopher, Tom Schumm, Geoff Gerrietts
|
||||||
|
|
||||||
|
|
||||||
|
setlocal foldmethod=expr
|
||||||
|
setlocal foldexpr=GetPythonFold(v:lnum)
|
||||||
|
setlocal foldtext=PythonFoldText()
|
||||||
|
|
||||||
|
|
||||||
|
function! PythonFoldText()
|
||||||
|
let line = getline(v:foldstart)
|
||||||
|
let nnum = nextnonblank(v:foldstart + 1)
|
||||||
|
let nextline = getline(nnum)
|
||||||
|
if nextline =~ '^\s\+"""$'
|
||||||
|
let line = line . getline(nnum + 1)
|
||||||
|
elseif nextline =~ '^\s\+"""'
|
||||||
|
let line = line . ' ' . matchstr(nextline, '"""\zs.\{-}\ze\("""\)\?$')
|
||||||
|
elseif nextline =~ '^\s\+"[^"]\+"$'
|
||||||
|
let line = line . ' ' . matchstr(nextline, '"\zs.*\ze"')
|
||||||
|
elseif nextline =~ '^\s\+pass\s*$'
|
||||||
|
let line = line . ' pass'
|
||||||
|
endif
|
||||||
|
let size = 1 + v:foldend - v:foldstart
|
||||||
|
if size < 10
|
||||||
|
let size = " " . size
|
||||||
|
endif
|
||||||
|
if size < 100
|
||||||
|
let size = " " . size
|
||||||
|
endif
|
||||||
|
if size < 1000
|
||||||
|
let size = " " . size
|
||||||
|
endif
|
||||||
|
return size . " lines: " . line
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! GetPythonFold(lnum)
|
||||||
|
" Determine folding level in Python source
|
||||||
|
"
|
||||||
|
let line = getline(a:lnum)
|
||||||
|
let ind = indent(a:lnum)
|
||||||
|
|
||||||
|
" Ignore blank lines
|
||||||
|
if line =~ '^\s*$'
|
||||||
|
return "="
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Ignore triple quoted strings
|
||||||
|
if line =~ "(\"\"\"|''')"
|
||||||
|
return "="
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Ignore continuation lines
|
||||||
|
if line =~ '\\$'
|
||||||
|
return '='
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Support markers
|
||||||
|
if line =~ '{{{'
|
||||||
|
return "a1"
|
||||||
|
elseif line =~ '}}}'
|
||||||
|
return "s1"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Classes and functions get their own folds
|
||||||
|
if line =~ '^\s*\(class\|def\)\s'
|
||||||
|
return ">" . (ind / &sw + 1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let pnum = prevnonblank(a:lnum - 1)
|
||||||
|
|
||||||
|
if pnum == 0
|
||||||
|
" Hit start of file
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If the previous line has foldlevel zero, and we haven't increased
|
||||||
|
" it, we should have foldlevel zero also
|
||||||
|
if foldlevel(pnum) == 0
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" The end of a fold is determined through a difference in indentation
|
||||||
|
" between this line and the next.
|
||||||
|
" So first look for next line
|
||||||
|
let nnum = nextnonblank(a:lnum + 1)
|
||||||
|
if nnum == 0
|
||||||
|
return "="
|
||||||
|
endif
|
||||||
|
|
||||||
|
" First I check for some common cases where this algorithm would
|
||||||
|
" otherwise fail. (This is all a hack)
|
||||||
|
let nline = getline(nnum)
|
||||||
|
if nline =~ '^\s*\(except\|else\|elif\)'
|
||||||
|
return "="
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Python programmers love their readable code, so they're usually
|
||||||
|
" going to have blank lines at the ends of functions or classes
|
||||||
|
" If the next line isn't blank, we probably don't need to end a fold
|
||||||
|
if nnum == a:lnum + 1
|
||||||
|
return "="
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If next line has less indentation we end a fold.
|
||||||
|
" This ends folds that aren't there a lot of the time, and this sometimes
|
||||||
|
" confuses vim. Luckily only rarely.
|
||||||
|
let nind = indent(nnum)
|
||||||
|
if nind < ind
|
||||||
|
return "<" . (nind / &sw + 1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If none of the above apply, keep the indentation
|
||||||
|
return "="
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
|
@ -0,0 +1,196 @@
|
||||||
|
" Python indent file
|
||||||
|
" Language: Python
|
||||||
|
" Maintainer: Eric Mc Sween <em@tomcom.de>
|
||||||
|
" Original Author: David Bustos <bustos@caltech.edu>
|
||||||
|
" Last Change: 2004 Jun 07
|
||||||
|
|
||||||
|
" Only load this indent file when no other was loaded.
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal expandtab
|
||||||
|
setlocal nolisp
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal indentexpr=GetPythonIndent(v:lnum)
|
||||||
|
setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except
|
||||||
|
|
||||||
|
let s:maxoff = 50
|
||||||
|
|
||||||
|
" Find backwards the closest open parenthesis/bracket/brace.
|
||||||
|
function! s:SearchParensPair()
|
||||||
|
let line = line('.')
|
||||||
|
let col = col('.')
|
||||||
|
|
||||||
|
" Skip strings and comments and don't look too far
|
||||||
|
let skip = "line('.') < " . (line - s:maxoff) . " ? dummy :" .
|
||||||
|
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? ' .
|
||||||
|
\ '"string\\|comment"'
|
||||||
|
|
||||||
|
" Search for parentheses
|
||||||
|
call cursor(line, col)
|
||||||
|
let parlnum = searchpair('(', '', ')', 'bW', skip)
|
||||||
|
let parcol = col('.')
|
||||||
|
|
||||||
|
" Search for brackets
|
||||||
|
call cursor(line, col)
|
||||||
|
let par2lnum = searchpair('\[', '', '\]', 'bW', skip)
|
||||||
|
let par2col = col('.')
|
||||||
|
|
||||||
|
" Search for braces
|
||||||
|
call cursor(line, col)
|
||||||
|
let par3lnum = searchpair('{', '', '}', 'bW', skip)
|
||||||
|
let par3col = col('.')
|
||||||
|
|
||||||
|
" Get the closest match
|
||||||
|
if par2lnum > parlnum || (par2lnum == parlnum && par2col > parcol)
|
||||||
|
let parlnum = par2lnum
|
||||||
|
let parcol = par2col
|
||||||
|
endif
|
||||||
|
if par3lnum > parlnum || (par3lnum == parlnum && par3col > parcol)
|
||||||
|
let parlnum = par3lnum
|
||||||
|
let parcol = par3col
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Put the cursor on the match
|
||||||
|
if parlnum > 0
|
||||||
|
call cursor(parlnum, parcol)
|
||||||
|
endif
|
||||||
|
return parlnum
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Find the start of a multi-line statement
|
||||||
|
function! s:StatementStart(lnum)
|
||||||
|
let lnum = a:lnum
|
||||||
|
while 1
|
||||||
|
if getline(lnum - 1) =~ '\\$'
|
||||||
|
let lnum = lnum - 1
|
||||||
|
else
|
||||||
|
call cursor(lnum, 1)
|
||||||
|
let maybe_lnum = s:SearchParensPair()
|
||||||
|
if maybe_lnum < 1
|
||||||
|
return lnum
|
||||||
|
else
|
||||||
|
let lnum = maybe_lnum
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Find the block starter that matches the current line
|
||||||
|
function! s:BlockStarter(lnum, block_start_re)
|
||||||
|
let lnum = a:lnum
|
||||||
|
let maxindent = 10000 " whatever
|
||||||
|
while lnum > 1
|
||||||
|
let lnum = prevnonblank(lnum - 1)
|
||||||
|
if indent(lnum) < maxindent
|
||||||
|
if getline(lnum) =~ a:block_start_re
|
||||||
|
return lnum
|
||||||
|
else
|
||||||
|
let maxindent = indent(lnum)
|
||||||
|
" It's not worth going further if we reached the top level
|
||||||
|
if maxindent == 0
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
return -1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! GetPythonIndent(lnum)
|
||||||
|
|
||||||
|
" First line has indent 0
|
||||||
|
if a:lnum == 1
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If we can find an open parenthesis/bracket/brace, line up with it.
|
||||||
|
call cursor(a:lnum, 1)
|
||||||
|
let parlnum = s:SearchParensPair()
|
||||||
|
if parlnum > 0
|
||||||
|
let parcol = col('.')
|
||||||
|
let closing_paren = match(getline(a:lnum), '^\s*[])}]') != -1
|
||||||
|
if match(getline(parlnum), '[([{]\s*$', parcol - 1) != -1
|
||||||
|
if closing_paren
|
||||||
|
return indent(parlnum)
|
||||||
|
else
|
||||||
|
return indent(parlnum) + &shiftwidth
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if closing_paren
|
||||||
|
return parcol - 1
|
||||||
|
else
|
||||||
|
return parcol
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Examine this line
|
||||||
|
let thisline = getline(a:lnum)
|
||||||
|
let thisindent = indent(a:lnum)
|
||||||
|
|
||||||
|
" If the line starts with 'elif' or 'else', line up with 'if' or 'elif'
|
||||||
|
if thisline =~ '^\s*\(elif\|else\)\>'
|
||||||
|
let bslnum = s:BlockStarter(a:lnum, '^\s*\(if\|elif\)\>')
|
||||||
|
if bslnum > 0
|
||||||
|
return indent(bslnum)
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If the line starts with 'except' or 'finally', line up with 'try'
|
||||||
|
" or 'except'
|
||||||
|
if thisline =~ '^\s*\(except\|finally\)\>'
|
||||||
|
let bslnum = s:BlockStarter(a:lnum, '^\s*\(try\|except\)\>')
|
||||||
|
if bslnum > 0
|
||||||
|
return indent(bslnum)
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Examine previous line
|
||||||
|
let plnum = a:lnum - 1
|
||||||
|
let pline = getline(plnum)
|
||||||
|
let sslnum = s:StatementStart(plnum)
|
||||||
|
|
||||||
|
" If the previous line is blank, keep the same indentation
|
||||||
|
if pline =~ '^\s*$'
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If this line is explicitly joined, try to find an indentation that looks
|
||||||
|
" good.
|
||||||
|
if pline =~ '\\$'
|
||||||
|
let compound_statement = '^\s*\(if\|while\|for\s.*\sin\|except\)\s*'
|
||||||
|
let maybe_indent = matchend(getline(sslnum), compound_statement)
|
||||||
|
if maybe_indent != -1
|
||||||
|
return maybe_indent
|
||||||
|
else
|
||||||
|
return indent(sslnum) + &sw * 2
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If the previous line ended with a colon, indent relative to
|
||||||
|
" statement start.
|
||||||
|
if pline =~ ':\s*$'
|
||||||
|
return indent(sslnum) + &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If the previous line was a stop-execution statement or a pass
|
||||||
|
if getline(sslnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>'
|
||||||
|
" See if the user has already dedented
|
||||||
|
if indent(a:lnum) > indent(sslnum) - &sw
|
||||||
|
" If not, recommend one dedent
|
||||||
|
return indent(sslnum) - &sw
|
||||||
|
endif
|
||||||
|
" Otherwise, trust the user
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" In all other cases, line up with the start of the previous statement.
|
||||||
|
return indent(sslnum)
|
||||||
|
endfunction
|
|
@ -1,33 +0,0 @@
|
||||||
" Converts a file to PDF and display it (only on OS X)
|
|
||||||
function! ToPDF()
|
|
||||||
"define PS file name
|
|
||||||
let psname= "/tmp/" . expand("%:t:r") . ".ps"
|
|
||||||
"save colorscheme name
|
|
||||||
let g:colorname=g:colors_name
|
|
||||||
execute "write"
|
|
||||||
execute "colorscheme default"
|
|
||||||
execute "hardcopy > " . l:psname
|
|
||||||
execute "silent !launch -w " . l:psname
|
|
||||||
execute "silent !rm " . l:psname
|
|
||||||
execute "colorscheme" g:colorname
|
|
||||||
redraw!
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Set up menu for the function
|
|
||||||
an 10.520 &File.-SEP3- <Nop>
|
|
||||||
an 10.530 &File.&ToPDF :call ToPDF()<CR>
|
|
||||||
vunmenu &File.&ToPDF
|
|
||||||
vnoremenu &File.&ToPDF :call ToPDF()<CR>
|
|
||||||
|
|
||||||
" Zoom in/out of gvim
|
|
||||||
function! Zoom()
|
|
||||||
if has("gui_running")
|
|
||||||
if &guifont =~ 'Monaco:h12'
|
|
||||||
set guifont=Monaco:h9
|
|
||||||
set lines=70
|
|
||||||
else
|
|
||||||
set guifont=Monaco:h12
|
|
||||||
set lines=50
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfunction
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,869 @@
|
||||||
|
"=============================================================================
|
||||||
|
" Copyright: Copyright (C) 2001-2008 Jeff Lanzarotta
|
||||||
|
" Permission is hereby granted to use and distribute this code,
|
||||||
|
" with or without modifications, provided that this copyright
|
||||||
|
" notice is copied with it. Like anything else that's free,
|
||||||
|
" bufexplorer.vim is provided *as is* and comes with no
|
||||||
|
" warranty of any kind, either expressed or implied. In no
|
||||||
|
" event will the copyright holder be liable for any damages
|
||||||
|
" resulting from the use of this software.
|
||||||
|
" Name Of File: bufexplorer.vim
|
||||||
|
" Description: Buffer Explorer Vim Plugin
|
||||||
|
" Maintainer: Jeff Lanzarotta (delux256-vim at yahoo dot com)
|
||||||
|
" Last Changed: Wednesday, 19 Nov 2008
|
||||||
|
" Version: See g:bufexplorer_version for version number.
|
||||||
|
" Usage: This file should reside in the plugin directory and be
|
||||||
|
" automatically sourced.
|
||||||
|
"
|
||||||
|
" You may use the default keymappings of
|
||||||
|
"
|
||||||
|
" <Leader>be - Opens BufExplorer
|
||||||
|
" <Leader>bs - Opens horizontally split window BufExplorer
|
||||||
|
" <Leader>bv - Opens vertically split window BufExplorer
|
||||||
|
"
|
||||||
|
" Or you can use
|
||||||
|
"
|
||||||
|
" ":BufExplorer" - Opens BufExplorer
|
||||||
|
" ":HSBufExplorer" - Opens horizontally window BufExplorer
|
||||||
|
" ":VSBufExplorer" - Opens vertically split window BufExplorer
|
||||||
|
"
|
||||||
|
" For more help see supplied documentation.
|
||||||
|
" History: See supplied documentation.
|
||||||
|
"=============================================================================
|
||||||
|
|
||||||
|
" Exit quickly if already running or when 'compatible' is set. {{{1
|
||||||
|
if exists("g:bufexplorer_version") || &cp
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
"1}}}
|
||||||
|
|
||||||
|
" Version number
|
||||||
|
let g:bufexplorer_version = "7.2.2"
|
||||||
|
|
||||||
|
" Check for Vim version 700 or greater {{{1
|
||||||
|
if v:version < 700
|
||||||
|
echo "Sorry, bufexplorer ".g:bufexplorer_version."\nONLY runs with Vim 7.0 and greater."
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Public Interface {{{1
|
||||||
|
nmap <silent> <unique> <Leader>be :BufExplorer<CR>
|
||||||
|
nmap <silent> <unique> <Leader>bs :HSBufExplorer<CR>
|
||||||
|
nmap <silent> <unique> <Leader>bv :VSBufExplorer<CR>
|
||||||
|
|
||||||
|
" Create commands {{{1
|
||||||
|
command BufExplorer :call StartBufExplorer(has ("gui") ? "drop" : "hide edit")
|
||||||
|
command HSBufExplorer :call HorizontalSplitBufExplorer()
|
||||||
|
command VSBufExplorer :call VerticalSplitBufExplorer()
|
||||||
|
|
||||||
|
" Set {{{1
|
||||||
|
function s:Set(var, default)
|
||||||
|
if !exists(a:var)
|
||||||
|
if type(a:default)
|
||||||
|
exec "let" a:var "=" string(a:default)
|
||||||
|
else
|
||||||
|
exec "let" a:var "=" a:default
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Default values {{{1
|
||||||
|
call s:Set("g:bufExplorerDefaultHelp", 1) " Show default help?
|
||||||
|
call s:Set("g:bufExplorerDetailedHelp", 0) " Show detailed help?
|
||||||
|
call s:Set("g:bufExplorerFindActive", 1) " When selecting an active buffer, take you to the window where it is active?
|
||||||
|
call s:Set("g:bufExplorerReverseSort", 0) " sort reverse?
|
||||||
|
call s:Set("g:bufExplorerShowDirectories", 1) " (Dir's are added by commands like ':e .')
|
||||||
|
call s:Set("g:bufExplorerShowRelativePath", 0) " Show listings with relative or absolute paths?
|
||||||
|
call s:Set("g:bufExplorerShowUnlisted", 0) " Show unlisted buffers?
|
||||||
|
call s:Set("g:bufExplorerSortBy", "mru") " Sorting methods are in s:sort_by:
|
||||||
|
call s:Set("g:bufExplorerSplitOutPathName", 1) " Split out path and file name?
|
||||||
|
call s:Set("g:bufExplorerSplitRight", &splitright) " Should vertical splits be on the right or left of current window?
|
||||||
|
call s:Set("g:bufExplorerSplitBelow", &splitbelow) " Should horizontal splits be below or above current window?
|
||||||
|
|
||||||
|
" Global variables {{{1
|
||||||
|
let s:MRUList = []
|
||||||
|
let s:running = 0
|
||||||
|
let s:sort_by = ["number", "name", "fullpath", "mru", "extension"]
|
||||||
|
let s:tabSpace = []
|
||||||
|
let s:types = {"fullname": ':p', "path": ':p:h', "relativename": ':~:.', "relativepath": ':~:.:h', "shortname": ':t'}
|
||||||
|
let s:originBuffer = 0
|
||||||
|
let s:splitMode = "sp"
|
||||||
|
|
||||||
|
" Setup the autocommands that handle the MRUList and other stuff. {{{1
|
||||||
|
autocmd VimEnter * call s:Setup()
|
||||||
|
|
||||||
|
" Setup {{{1
|
||||||
|
function s:Setup()
|
||||||
|
" Build initial MRUList.
|
||||||
|
let s:MRUList = range(1, bufnr('$'))
|
||||||
|
let s:tabSpace = []
|
||||||
|
" Now that the MRUList is created, add the other autocmds.
|
||||||
|
autocmd BufEnter,BufNew * call s:ActivateBuffer()
|
||||||
|
autocmd BufWipeOut * call s:DeactivateBuffer(1)
|
||||||
|
autocmd BufDelete * call s:DeactivateBuffer(0)
|
||||||
|
|
||||||
|
autocmd BufWinEnter \[BufExplorer\] call s:Initialize()
|
||||||
|
autocmd BufWinLeave \[BufExplorer\] call s:Cleanup()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" ActivateBuffer {{{1
|
||||||
|
function s:ActivateBuffer()
|
||||||
|
let b = bufnr("%")
|
||||||
|
let l = get(s:tabSpace, tabpagenr(), [])
|
||||||
|
|
||||||
|
if empty(l) || index(l, b) == -1
|
||||||
|
call add(l, b)
|
||||||
|
let s:tabSpace[tabpagenr()] = l
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:MRUPush(b)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" DeactivateBuffer {{{1
|
||||||
|
function s:DeactivateBuffer(remove)
|
||||||
|
"echom "afile:" expand("<afile>")
|
||||||
|
"echom "bufnr, afile:" bufnr(expand("<afile>"))
|
||||||
|
"echom "buffers:" string(tabpagebuflist())
|
||||||
|
"echom "MRU before:" string(s:MRUList)
|
||||||
|
|
||||||
|
let _bufnr = bufnr(expand("<afile>"))
|
||||||
|
let _buftype = getbufvar(_bufnr, "&buftype")
|
||||||
|
|
||||||
|
if empty(_buftype) || _buftype == "nofile" || !buflisted(_bufnr) || empty(bufname(_bufnr)) || fnamemodify(bufname(_bufnr), ":t") == "[BufExplorer]"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if a:remove
|
||||||
|
call s:MRUPop(bufnr(expand("<afile>")))
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" MRUPop {{{1
|
||||||
|
function s:MRUPop(buf)
|
||||||
|
call filter(s:MRUList, 'v:val != '.a:buf)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" MRUPush {{{1
|
||||||
|
function s:MRUPush(buf)
|
||||||
|
" Skip temporary buffer with buftype set. Don't add the BufExplorer window to the
|
||||||
|
" list.
|
||||||
|
if !empty(getbufvar(a:buf, "&buftype")) ||
|
||||||
|
\ !buflisted(a:buf) || empty(bufname(a:buf)) ||
|
||||||
|
\ fnamemodify(bufname(a:buf), ":t") == "[BufExplorer]"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
" Remove the buffer number from the list if it already exists.
|
||||||
|
call s:MRUPop(a:buf)
|
||||||
|
" Add the buffer number to the head of the list.
|
||||||
|
call insert(s:MRUList,a:buf)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Initialize {{{1
|
||||||
|
function s:Initialize()
|
||||||
|
let s:_insertmode = &insertmode
|
||||||
|
set noinsertmode
|
||||||
|
|
||||||
|
let s:_showcmd = &showcmd
|
||||||
|
set noshowcmd
|
||||||
|
|
||||||
|
let s:_cpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
let s:_report = &report
|
||||||
|
let &report = 10000
|
||||||
|
|
||||||
|
let s:_list = &list
|
||||||
|
set nolist
|
||||||
|
|
||||||
|
setlocal nonumber
|
||||||
|
setlocal foldcolumn=0
|
||||||
|
setlocal nofoldenable
|
||||||
|
setlocal cursorline
|
||||||
|
setlocal nospell
|
||||||
|
|
||||||
|
set nobuflisted
|
||||||
|
|
||||||
|
let s:running = 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Cleanup {{{1
|
||||||
|
function s:Cleanup()
|
||||||
|
let &insertmode = s:_insertmode
|
||||||
|
let &showcmd = s:_showcmd
|
||||||
|
let &cpo = s:_cpo
|
||||||
|
let &report = s:_report
|
||||||
|
let &list = s:_list
|
||||||
|
let s:running = 0
|
||||||
|
let s:splitMode = ""
|
||||||
|
|
||||||
|
delmarks!
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" HorizontalSplitBufExplorer {{{1
|
||||||
|
function HorizontalSplitBufExplorer()
|
||||||
|
let s:splitMode = "sp"
|
||||||
|
exec "BufExplorer"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" VerticalSplitBufExplorer {{{1
|
||||||
|
function VerticalSplitBufExplorer()
|
||||||
|
let s:splitMode = "vsp"
|
||||||
|
exec "BufExplorer"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" StartBufExplorer {{{1
|
||||||
|
function StartBufExplorer(open)
|
||||||
|
let name = '[BufExplorer]'
|
||||||
|
|
||||||
|
if !has("win32")
|
||||||
|
" On non-Windows boxes, escape the name so that is shows up correctly.
|
||||||
|
let name = escape(name, "[]")
|
||||||
|
endif
|
||||||
|
" Make sure there is only one explorer open at a time.
|
||||||
|
if s:running == 1
|
||||||
|
" Go to the open buffer.
|
||||||
|
if has("gui")
|
||||||
|
exec "drop" name
|
||||||
|
endif
|
||||||
|
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:originBuffer = bufnr("%")
|
||||||
|
silent let s:raw_buffer_listing = s:GetBufferInfo()
|
||||||
|
|
||||||
|
let copy = copy(s:raw_buffer_listing)
|
||||||
|
|
||||||
|
if (g:bufExplorerShowUnlisted == 0)
|
||||||
|
call filter(copy, 'v:val.attributes !~ "u"')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if (!empty(copy))
|
||||||
|
call filter(copy, 'v:val.shortname !~ "\\\[No Name\\\]"')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if len(copy) <= 1
|
||||||
|
echo "\r"
|
||||||
|
call s:Warning("Sorry, there are no more buffers to explore")
|
||||||
|
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
" We may have to split the current window.
|
||||||
|
if (s:splitMode != "")
|
||||||
|
" Save off the original settings.
|
||||||
|
let [_splitbelow, _splitright] = [&splitbelow, &splitright]
|
||||||
|
" Set the setting to ours.
|
||||||
|
let [&splitbelow, &splitright] = [g:bufExplorerSplitBelow, g:bufExplorerSplitRight]
|
||||||
|
" Do it.
|
||||||
|
exe s:splitMode
|
||||||
|
" Restore the original settings.
|
||||||
|
let [&splitbelow, &splitright] = [_splitbelow, _splitright]
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("b:displayMode") || b:displayMode != "winmanager"
|
||||||
|
" Do not use keepalt when opening bufexplorer to allow the buffer that we are
|
||||||
|
" leaving to become the new alternate buffer
|
||||||
|
exec "silent keepjumps ".a:open." ".name
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:DisplayBufferList()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" DisplayBufferList {{{1
|
||||||
|
function s:DisplayBufferList()
|
||||||
|
setlocal bufhidden=delete
|
||||||
|
setlocal buftype=nofile
|
||||||
|
setlocal modifiable
|
||||||
|
setlocal noswapfile
|
||||||
|
setlocal nowrap
|
||||||
|
|
||||||
|
call s:SetupSyntax()
|
||||||
|
call s:MapKeys()
|
||||||
|
call setline(1, s:CreateHelp())
|
||||||
|
call s:BuildBufferList()
|
||||||
|
call cursor(s:firstBufferLine, 1)
|
||||||
|
|
||||||
|
if !g:bufExplorerResize
|
||||||
|
normal! zz
|
||||||
|
endif
|
||||||
|
|
||||||
|
setlocal nomodifiable
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" MapKeys {{{1
|
||||||
|
function s:MapKeys()
|
||||||
|
if exists("b:displayMode") && b:displayMode == "winmanager"
|
||||||
|
nnoremap <buffer> <silent> <tab> :call <SID>SelectBuffer("tab")<cr>
|
||||||
|
endif
|
||||||
|
|
||||||
|
nnoremap <buffer> <silent> <F1> :call <SID>ToggleHelp()<cr>
|
||||||
|
nnoremap <buffer> <silent> <2-leftmouse> :call <SID>SelectBuffer()<cr>
|
||||||
|
nnoremap <buffer> <silent> <cr> :call <SID>SelectBuffer()<cr>
|
||||||
|
nnoremap <buffer> <silent> t :call <SID>SelectBuffer("tab")<cr>
|
||||||
|
nnoremap <buffer> <silent> <s-cr> :call <SID>SelectBuffer("tab")<cr>
|
||||||
|
nnoremap <buffer> <silent> d :call <SID>RemoveBuffer("wipe")<cr>
|
||||||
|
nnoremap <buffer> <silent> D :call <SID>RemoveBuffer("delete")<cr>
|
||||||
|
nnoremap <buffer> <silent> m :call <SID>MRUListShow()<cr>
|
||||||
|
nnoremap <buffer> <silent> p :call <SID>ToggleSplitOutPathName()<cr>
|
||||||
|
nnoremap <buffer> <silent> q :call <SID>Close()<cr>
|
||||||
|
nnoremap <buffer> <silent> r :call <SID>SortReverse()<cr>
|
||||||
|
nnoremap <buffer> <silent> R :call <SID>ToggleShowRelativePath()<cr>
|
||||||
|
nnoremap <buffer> <silent> s :call <SID>SortSelect()<cr>
|
||||||
|
nnoremap <buffer> <silent> u :call <SID>ToggleShowUnlisted()<cr>
|
||||||
|
nnoremap <buffer> <silent> f :call <SID>ToggleFindActive()<cr>
|
||||||
|
|
||||||
|
for k in ["G", "n", "N", "L", "M", "H"]
|
||||||
|
exec "nnoremap <buffer> <silent>" k ":keepjumps normal!" k."<cr>"
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" SetupSyntax {{{1
|
||||||
|
function s:SetupSyntax()
|
||||||
|
if has("syntax")
|
||||||
|
syn match bufExplorerHelp "^\".*" contains=bufExplorerSortBy,bufExplorerMapping,bufExplorerTitle,bufExplorerSortType,bufExplorerToggleSplit,bufExplorerToggleOpen
|
||||||
|
syn match bufExplorerOpenIn "Open in \w\+ window" contained
|
||||||
|
syn match bufExplorerSplit "\w\+ split" contained
|
||||||
|
syn match bufExplorerSortBy "Sorted by .*" contained contains=bufExplorerOpenIn,bufExplorerSplit
|
||||||
|
syn match bufExplorerMapping "\" \zs.\+\ze :" contained
|
||||||
|
syn match bufExplorerTitle "Buffer Explorer.*" contained
|
||||||
|
syn match bufExplorerSortType "'\w\{-}'" contained
|
||||||
|
syn match bufExplorerBufNbr /^\s*\d\+/
|
||||||
|
syn match bufExplorerToggleSplit "toggle split type" contained
|
||||||
|
syn match bufExplorerToggleOpen "toggle open mode" contained
|
||||||
|
|
||||||
|
syn match bufExplorerModBuf /^\s*\d\+.\{4}+.*/
|
||||||
|
syn match bufExplorerLockedBuf /^\s*\d\+.\{3}[\-=].*/
|
||||||
|
syn match bufExplorerHidBuf /^\s*\d\+.\{2}h.*/
|
||||||
|
syn match bufExplorerActBuf /^\s*\d\+.\{2}a.*/
|
||||||
|
syn match bufExplorerCurBuf /^\s*\d\+.%.*/
|
||||||
|
syn match bufExplorerAltBuf /^\s*\d\+.#.*/
|
||||||
|
syn match bufExplorerUnlBuf /^\s*\d\+u.*/
|
||||||
|
|
||||||
|
hi def link bufExplorerBufNbr Number
|
||||||
|
hi def link bufExplorerMapping NonText
|
||||||
|
hi def link bufExplorerHelp Special
|
||||||
|
hi def link bufExplorerOpenIn Identifier
|
||||||
|
hi def link bufExplorerSortBy String
|
||||||
|
hi def link bufExplorerSplit NonText
|
||||||
|
hi def link bufExplorerTitle NonText
|
||||||
|
hi def link bufExplorerSortType bufExplorerSortBy
|
||||||
|
hi def link bufExplorerToggleSplit bufExplorerSplit
|
||||||
|
hi def link bufExplorerToggleOpen bufExplorerOpenIn
|
||||||
|
|
||||||
|
hi def link bufExplorerActBuf Identifier
|
||||||
|
hi def link bufExplorerAltBuf String
|
||||||
|
hi def link bufExplorerCurBuf Type
|
||||||
|
hi def link bufExplorerHidBuf Constant
|
||||||
|
hi def link bufExplorerLockedBuf Special
|
||||||
|
hi def link bufExplorerModBuf Exception
|
||||||
|
hi def link bufExplorerUnlBuf Comment
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" ToggleHelp {{{1
|
||||||
|
function s:ToggleHelp()
|
||||||
|
let g:bufExplorerDetailedHelp = !g:bufExplorerDetailedHelp
|
||||||
|
|
||||||
|
setlocal modifiable
|
||||||
|
" Save position.
|
||||||
|
normal! ma
|
||||||
|
" Remove old header.
|
||||||
|
if (s:firstBufferLine > 1)
|
||||||
|
exec "keepjumps 1,".(s:firstBufferLine - 1) "d _"
|
||||||
|
endif
|
||||||
|
|
||||||
|
call append(0, s:CreateHelp())
|
||||||
|
|
||||||
|
silent! normal! g`a
|
||||||
|
delmarks a
|
||||||
|
|
||||||
|
setlocal nomodifiable
|
||||||
|
|
||||||
|
if exists("b:displayMode") && b:displayMode == "winmanager"
|
||||||
|
call WinManagerForceReSize("BufExplorer")
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" GetHelpStatus {{{1
|
||||||
|
function s:GetHelpStatus()
|
||||||
|
let ret = '" Sorted by '.((g:bufExplorerReverseSort == 1) ? "reverse " : "").g:bufExplorerSortBy
|
||||||
|
let ret .= ' | '.((g:bufExplorerFindActive == 0) ? "Don't " : "")."Locate buffer"
|
||||||
|
let ret .= ((g:bufExplorerShowUnlisted == 0) ? "" : " | Show unlisted")
|
||||||
|
let ret .= ' | '.((g:bufExplorerShowRelativePath == 0) ? "Absolute" : "Relative")
|
||||||
|
let ret .= ' '.((g:bufExplorerSplitOutPathName == 0) ? "Full" : "Split")." path"
|
||||||
|
|
||||||
|
return ret
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" CreateHelp {{{1
|
||||||
|
function s:CreateHelp()
|
||||||
|
if g:bufExplorerDefaultHelp == 0 && g:bufExplorerDetailedHelp == 0
|
||||||
|
let s:firstBufferLine = 1
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
let header = []
|
||||||
|
|
||||||
|
if g:bufExplorerDetailedHelp == 1
|
||||||
|
call add(header, '" Buffer Explorer ('.g:bufexplorer_version.')')
|
||||||
|
call add(header, '" --------------------------')
|
||||||
|
call add(header, '" <F1> : toggle this help')
|
||||||
|
call add(header, '" <enter> or Mouse-Double-Click : open buffer under cursor')
|
||||||
|
call add(header, '" <shift-enter> or t : open buffer in another tab')
|
||||||
|
call add(header, '" d : wipe buffer')
|
||||||
|
call add(header, '" D : delete buffer')
|
||||||
|
call add(header, '" p : toggle spliting of file and path name')
|
||||||
|
call add(header, '" q : quit')
|
||||||
|
call add(header, '" r : reverse sort')
|
||||||
|
call add(header, '" R : toggle showing relative or full paths')
|
||||||
|
call add(header, '" u : toggle showing unlisted buffers')
|
||||||
|
call add(header, '" s : select sort field '.string(s:sort_by).'')
|
||||||
|
call add(header, '" f : toggle find active buffer')
|
||||||
|
else
|
||||||
|
call add(header, '" Press <F1> for Help')
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(header, s:GetHelpStatus())
|
||||||
|
call add(header, '"=')
|
||||||
|
|
||||||
|
let s:firstBufferLine = len(header) + 1
|
||||||
|
|
||||||
|
return header
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" GetBufferInfo {{{1
|
||||||
|
function s:GetBufferInfo()
|
||||||
|
redir => bufoutput
|
||||||
|
buffers!
|
||||||
|
redir END
|
||||||
|
|
||||||
|
let [all, allwidths, listedwidths] = [[], {}, {}]
|
||||||
|
|
||||||
|
for n in keys(s:types)
|
||||||
|
let allwidths[n] = []
|
||||||
|
let listedwidths[n] = []
|
||||||
|
endfor
|
||||||
|
|
||||||
|
for buf in split(bufoutput, '\n')
|
||||||
|
let bits = split(buf, '"')
|
||||||
|
let b = {"attributes": bits[0], "line": substitute(bits[2], '\s*', '', '')}
|
||||||
|
|
||||||
|
for [key, val] in items(s:types)
|
||||||
|
let b[key] = fnamemodify(bits[1], val)
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if getftype(b.fullname) == "dir" && g:bufExplorerShowDirectories == 1
|
||||||
|
let b.shortname = "<DIRECTORY>"
|
||||||
|
end
|
||||||
|
|
||||||
|
call add(all, b)
|
||||||
|
|
||||||
|
for n in keys(s:types)
|
||||||
|
call add(allwidths[n], len(b[n]))
|
||||||
|
|
||||||
|
if b.attributes !~ "u"
|
||||||
|
call add(listedwidths[n], len(b[n]))
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
|
||||||
|
let [s:allpads, s:listedpads] = [{}, {}]
|
||||||
|
|
||||||
|
for n in keys(s:types)
|
||||||
|
let s:allpads[n] = repeat(' ', max(allwidths[n]))
|
||||||
|
let s:listedpads[n] = repeat(' ', max(listedwidths[n]))
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return all
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" BuildBufferList {{{1
|
||||||
|
function s:BuildBufferList()
|
||||||
|
let lines = []
|
||||||
|
" Loop through every buffer.
|
||||||
|
for buf in s:raw_buffer_listing
|
||||||
|
if (!g:bufExplorerShowUnlisted && buf.attributes =~ "u")
|
||||||
|
" Skip unlisted buffers if we are not to show them.
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let line = buf.attributes." "
|
||||||
|
|
||||||
|
if g:bufExplorerSplitOutPathName
|
||||||
|
let type = (g:bufExplorerShowRelativePath) ? "relativepath" : "path"
|
||||||
|
let path = buf[type]
|
||||||
|
let pad = (g:bufExplorerShowUnlisted) ? s:allpads.shortname : s:listedpads.shortname
|
||||||
|
let line .= buf.shortname." ".strpart(pad.path, len(buf.shortname))
|
||||||
|
else
|
||||||
|
let type = (g:bufExplorerShowRelativePath) ? "relativename" : "fullname"
|
||||||
|
let path = buf[type]
|
||||||
|
let line .= path
|
||||||
|
endif
|
||||||
|
|
||||||
|
let pads = (g:bufExplorerShowUnlisted) ? s:allpads : s:listedpads
|
||||||
|
|
||||||
|
if !empty(pads[type])
|
||||||
|
let line .= strpart(pads[type], len(path))." "
|
||||||
|
endif
|
||||||
|
|
||||||
|
let line .= buf.line
|
||||||
|
|
||||||
|
call add(lines, line)
|
||||||
|
endfor
|
||||||
|
|
||||||
|
call setline(s:firstBufferLine, lines)
|
||||||
|
|
||||||
|
call s:SortListing()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" SelectBuffer {{{1
|
||||||
|
function s:SelectBuffer(...)
|
||||||
|
" Sometimes messages are not cleared when we get here so it looks like an error has
|
||||||
|
" occurred when it really has not.
|
||||||
|
echo ""
|
||||||
|
" Are we on a line with a file name?
|
||||||
|
if line('.') < s:firstBufferLine
|
||||||
|
exec "normal! \<cr>"
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let _bufNbr = str2nr(getline('.'))
|
||||||
|
|
||||||
|
if exists("b:displayMode") && b:displayMode == "winmanager"
|
||||||
|
let bufname = expand("#"._bufNbr.":p")
|
||||||
|
|
||||||
|
if (a:0 == 1) && (a:1 == "tab")
|
||||||
|
call WinManagerFileEdit(bufname, 1)
|
||||||
|
else
|
||||||
|
call WinManagerFileEdit(bufname, 0)
|
||||||
|
endif
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if bufexists(_bufNbr)
|
||||||
|
if bufnr("#") == _bufNbr
|
||||||
|
return s:Close()
|
||||||
|
endif
|
||||||
|
|
||||||
|
if (a:0 == 1) && (a:1 == "tab")
|
||||||
|
" Restore [BufExplorer] buffer.
|
||||||
|
exec "keepjumps silent buffer!".s:originBuffer
|
||||||
|
|
||||||
|
let tabNbr = s:GetTabNbr(_bufNbr)
|
||||||
|
|
||||||
|
if tabNbr == 0
|
||||||
|
" _bufNbr is not opened in any tabs. Open a new tab with the selected buffer in it.
|
||||||
|
exec "999tab split +buffer" . _bufNbr
|
||||||
|
else
|
||||||
|
" The _bufNbr is already opened in tab(s), go to that tab.
|
||||||
|
exec tabNbr . "tabnext"
|
||||||
|
" Focus window.
|
||||||
|
exec s:GetWinNbr(tabNbr, _bufNbr) . "wincmd w"
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if bufloaded(_bufNbr) && g:bufExplorerFindActive
|
||||||
|
call s:Close()
|
||||||
|
|
||||||
|
let tabNbr = s:GetTabNbr(_bufNbr)
|
||||||
|
|
||||||
|
if tabNbr != 0
|
||||||
|
" The buffer is located in a tab. Go to that tab number.
|
||||||
|
exec tabNbr . "tabnext"
|
||||||
|
else
|
||||||
|
let bufname = expand("#"._bufNbr.":p")
|
||||||
|
exec bufname ? "drop ".escape(bufname, " ") : "buffer "._bufNbr
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
" Switch to the buffer.
|
||||||
|
exec "keepalt keepjumps silent b!" _bufNbr
|
||||||
|
endif
|
||||||
|
" Make the buffer 'listed' again.
|
||||||
|
call setbufvar(_bufNbr, "&buflisted", "1")
|
||||||
|
else
|
||||||
|
call s:Error("Sorry, that buffer no longer exists, please select another")
|
||||||
|
call s:DeleteBuffer(_bufNbr, "wipe")
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" RemoveBuffer {{{1
|
||||||
|
function s:RemoveBuffer(mode)
|
||||||
|
" Are we on a line with a file name?
|
||||||
|
if line('.') < s:firstBufferLine
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
" Do not allow this buffer to be deleted if it is the last one.
|
||||||
|
if len(s:MRUList) == 1
|
||||||
|
call s:Error("Sorry, you are not allowed to delete the last buffer")
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
" These commands are to temporarily suspend the activity of winmanager.
|
||||||
|
if exists("b:displayMode") && b:displayMode == "winmanager"
|
||||||
|
call WinManagerSuspendAUs()
|
||||||
|
end
|
||||||
|
|
||||||
|
let _bufNbr = str2nr(getline('.'))
|
||||||
|
|
||||||
|
if getbufvar(_bufNbr, '&modified') == 1
|
||||||
|
call s:Error("Sorry, no write since last change for buffer "._bufNbr.", unable to delete")
|
||||||
|
return
|
||||||
|
else
|
||||||
|
" Okay, everything is good, delete or wipe the buffer.
|
||||||
|
call s:DeleteBuffer(_bufNbr, a:mode)
|
||||||
|
endif
|
||||||
|
" Reactivate winmanager autocommand activity.
|
||||||
|
if exists("b:displayMode") && b:displayMode == "winmanager"
|
||||||
|
call WinManagerForceReSize("BufExplorer")
|
||||||
|
call WinManagerResumeAUs()
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" DeleteBuffer {{{1
|
||||||
|
function s:DeleteBuffer(buf, mode)
|
||||||
|
" This routine assumes that the buffer to be removed is on the current line.
|
||||||
|
try
|
||||||
|
if a:mode == "wipe"
|
||||||
|
exe "silent bw" a:buf
|
||||||
|
else
|
||||||
|
exe "silent bd" a:buf
|
||||||
|
end
|
||||||
|
|
||||||
|
setlocal modifiable
|
||||||
|
normal! "_dd
|
||||||
|
setlocal nomodifiable
|
||||||
|
" Delete the buffer from the raw buffer list.
|
||||||
|
call filter(s:raw_buffer_listing, 'v:val.attributes !~ " '.a:buf.' "')
|
||||||
|
catch
|
||||||
|
call s:Error(v:exception)
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Close {{{1
|
||||||
|
function s:Close()
|
||||||
|
" Get only the listed buffers.
|
||||||
|
let listed = filter(copy(s:MRUList), "buflisted(v:val)")
|
||||||
|
" If we needed to split the main window, close the split one.
|
||||||
|
if (s:splitMode != "")
|
||||||
|
exec "wincmd c"
|
||||||
|
end
|
||||||
|
|
||||||
|
for b in reverse(listed[0:1])
|
||||||
|
exec "keepjumps silent b ".b
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" ToggleSplitOutPathName {{{1
|
||||||
|
function s:ToggleSplitOutPathName()
|
||||||
|
let g:bufExplorerSplitOutPathName = !g:bufExplorerSplitOutPathName
|
||||||
|
call s:RebuildBufferList()
|
||||||
|
call s:UpdateHelpStatus()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" ToggleShowRelativePath {{{1
|
||||||
|
function s:ToggleShowRelativePath()
|
||||||
|
let g:bufExplorerShowRelativePath = !g:bufExplorerShowRelativePath
|
||||||
|
call s:RebuildBufferList()
|
||||||
|
call s:UpdateHelpStatus()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" ToggleShowUnlisted {{{1
|
||||||
|
function s:ToggleShowUnlisted()
|
||||||
|
let g:bufExplorerShowUnlisted = !g:bufExplorerShowUnlisted
|
||||||
|
let num_bufs = s:RebuildBufferList(g:bufExplorerShowUnlisted == 0)
|
||||||
|
call s:UpdateHelpStatus()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" ToggleFindActive {{{1
|
||||||
|
function s:ToggleFindActive()
|
||||||
|
let g:bufExplorerFindActive = !g:bufExplorerFindActive
|
||||||
|
call s:UpdateHelpStatus()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" RebuildBufferList {{{1
|
||||||
|
function s:RebuildBufferList(...)
|
||||||
|
setlocal modifiable
|
||||||
|
|
||||||
|
let curPos = getpos('.')
|
||||||
|
|
||||||
|
if a:0
|
||||||
|
" Clear the list first.
|
||||||
|
exec "keepjumps ".s:firstBufferLine.',$d "_'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let num_bufs = s:BuildBufferList()
|
||||||
|
|
||||||
|
call setpos('.', curPos)
|
||||||
|
|
||||||
|
setlocal nomodifiable
|
||||||
|
|
||||||
|
return num_bufs
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" UpdateHelpStatus {{{1
|
||||||
|
function s:UpdateHelpStatus()
|
||||||
|
setlocal modifiable
|
||||||
|
|
||||||
|
let text = s:GetHelpStatus()
|
||||||
|
call setline(s:firstBufferLine - 2, text)
|
||||||
|
|
||||||
|
setlocal nomodifiable
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" MRUCmp {{{1
|
||||||
|
function s:MRUCmp(line1, line2)
|
||||||
|
return index(s:MRUList, str2nr(a:line1)) - index(s:MRUList, str2nr(a:line2))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" SortReverse {{{1
|
||||||
|
function s:SortReverse()
|
||||||
|
let g:bufExplorerReverseSort = !g:bufExplorerReverseSort
|
||||||
|
|
||||||
|
call s:ReSortListing()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" SortSelect {{{1
|
||||||
|
function s:SortSelect()
|
||||||
|
let g:bufExplorerSortBy = get(s:sort_by, index(s:sort_by, g:bufExplorerSortBy) + 1, s:sort_by[0])
|
||||||
|
|
||||||
|
call s:ReSortListing()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" ReSortListing {{{1
|
||||||
|
function s:ReSortListing()
|
||||||
|
setlocal modifiable
|
||||||
|
|
||||||
|
let curPos = getpos('.')
|
||||||
|
|
||||||
|
call s:SortListing()
|
||||||
|
call s:UpdateHelpStatus()
|
||||||
|
|
||||||
|
call setpos('.', curPos)
|
||||||
|
|
||||||
|
setlocal nomodifiable
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" SortListing {{{1
|
||||||
|
function s:SortListing()
|
||||||
|
let sort = s:firstBufferLine.",$sort".((g:bufExplorerReverseSort == 1) ? "!": "")
|
||||||
|
|
||||||
|
if g:bufExplorerSortBy == "number"
|
||||||
|
" Easiest case.
|
||||||
|
exec sort 'n'
|
||||||
|
elseif g:bufExplorerSortBy == "name"
|
||||||
|
if g:bufExplorerSplitOutPathName
|
||||||
|
exec sort 'ir /\d.\{7}\zs\f\+\ze/'
|
||||||
|
else
|
||||||
|
exec sort 'ir /\zs[^\/\\]\+\ze\s*line/'
|
||||||
|
endif
|
||||||
|
elseif g:bufExplorerSortBy == "fullpath"
|
||||||
|
if g:bufExplorerSplitOutPathName
|
||||||
|
" Sort twice - first on the file name then on the path.
|
||||||
|
exec sort 'ir /\d.\{7}\zs\f\+\ze/'
|
||||||
|
endif
|
||||||
|
|
||||||
|
exec sort 'ir /\zs\f\+\ze\s\+line/'
|
||||||
|
elseif g:bufExplorerSortBy == "extension"
|
||||||
|
exec sort 'ir /\.\zs\w\+\ze\s/'
|
||||||
|
elseif g:bufExplorerSortBy == "mru"
|
||||||
|
let l = getline(s:firstBufferLine, "$")
|
||||||
|
|
||||||
|
call sort(l, "<SID>MRUCmp")
|
||||||
|
|
||||||
|
if g:bufExplorerReverseSort
|
||||||
|
call reverse(l)
|
||||||
|
endif
|
||||||
|
|
||||||
|
call setline(s:firstBufferLine, l)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" MRUListShow {{{1
|
||||||
|
function s:MRUListShow()
|
||||||
|
echomsg "MRUList=".string(s:MRUList)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Error {{{1
|
||||||
|
function s:Error(msg)
|
||||||
|
echohl ErrorMsg | echo a:msg | echohl none
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Warning {{{1
|
||||||
|
function s:Warning(msg)
|
||||||
|
echohl WarningMsg | echo a:msg | echohl none
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" GetTabNbr {{{1
|
||||||
|
function s:GetTabNbr(bufNbr)
|
||||||
|
" Searching buffer bufno, in tabs.
|
||||||
|
for i in range(tabpagenr("$"))
|
||||||
|
if index(tabpagebuflist(i + 1), a:bufNbr) != -1
|
||||||
|
return i + 1
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" GetWinNbr" {{{1
|
||||||
|
function s:GetWinNbr(tabNbr, bufNbr)
|
||||||
|
" window number in tabpage.
|
||||||
|
return index(tabpagebuflist(a:tabNbr), a:bufNbr) + 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Winmanager Integration {{{1
|
||||||
|
let g:BufExplorer_title = "\[Buf\ List\]"
|
||||||
|
call s:Set("g:bufExplorerResize", 1)
|
||||||
|
call s:Set("g:bufExplorerMaxHeight", 25) " Handles dynamic resizing of the window.
|
||||||
|
|
||||||
|
" Function to start display. Set the mode to 'winmanager' for this buffer.
|
||||||
|
" This is to figure out how this plugin was called. In a standalone fashion
|
||||||
|
" or by winmanager.
|
||||||
|
function BufExplorer_Start()
|
||||||
|
let b:displayMode = "winmanager"
|
||||||
|
call StartBufExplorer("e")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Returns whether the display is okay or not.
|
||||||
|
function BufExplorer_IsValid()
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Handles dynamic refreshing of the window.
|
||||||
|
function BufExplorer_Refresh()
|
||||||
|
let b:displayMode = "winmanager"
|
||||||
|
call StartBufExplorer("e")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function BufExplorer_ReSize()
|
||||||
|
if !g:bufExplorerResize
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
let nlines = min([line("$"), g:bufExplorerMaxHeight])
|
||||||
|
|
||||||
|
exe nlines." wincmd _"
|
||||||
|
|
||||||
|
" The following lines restore the layout so that the last file line is also
|
||||||
|
" the last window line. Sometimes, when a line is deleted, although the
|
||||||
|
" window size is exactly equal to the number of lines in the file, some of
|
||||||
|
" the lines are pushed up and we see some lagging '~'s.
|
||||||
|
let pres = getpos(".")
|
||||||
|
|
||||||
|
exe $
|
||||||
|
|
||||||
|
let _scr = &scrolloff
|
||||||
|
let &scrolloff = 0
|
||||||
|
|
||||||
|
normal! z-
|
||||||
|
|
||||||
|
let &scrolloff = _scr
|
||||||
|
|
||||||
|
call setpos(".", pres)
|
||||||
|
endfunction
|
||||||
|
"1}}}
|
||||||
|
|
||||||
|
" vim:ft=vim foldmethod=marker sw=2
|
|
@ -0,0 +1,78 @@
|
||||||
|
"pydoc.vim: pydoc integration for vim
|
||||||
|
"performs searches and can display the documentation of python modules
|
||||||
|
"Author: André Kelpe <fs111 at web dot de>
|
||||||
|
"http://www.vim.org/scripts/script.php?script_id=910
|
||||||
|
"This plugin integrates the pydoc into vim. You can view the
|
||||||
|
"documentation of a module by using :Pydoc foo.bar.baz or search
|
||||||
|
"a word (uses pydoc -k) in the documentation by typing PydocSearch
|
||||||
|
"foobar. You can also view the documentation of the word under the
|
||||||
|
"cursor by pressing <leader>pw or the WORD (see :help WORD) by pressing
|
||||||
|
"<leader>pW. "This is very useful if you want to jump to a module which was found by
|
||||||
|
"PydocSearch. To have a browser like feeling you can use u and CTRL-R to
|
||||||
|
"go back and forward, just like editing normal text.
|
||||||
|
|
||||||
|
"If you want to use the script and pydoc is not in your PATH, just put a
|
||||||
|
"line like
|
||||||
|
|
||||||
|
" let g:pydoc_cmd = \"/usr/bin/pydoc" (without the backslash!!)
|
||||||
|
|
||||||
|
"in your .vimrc
|
||||||
|
|
||||||
|
|
||||||
|
"pydoc.vim is free software, you can redistribute or modify
|
||||||
|
"it under the terms of the GNU General Public License Version 2 or any
|
||||||
|
"later Version (see http://www.gnu.org/copyleft/gpl.html for details).
|
||||||
|
|
||||||
|
"Please feel free to contact me.
|
||||||
|
|
||||||
|
|
||||||
|
set switchbuf=useopen
|
||||||
|
function! ShowPyDoc(name, type)
|
||||||
|
if !exists('g:pydoc_cmd')
|
||||||
|
let g:pydoc_cmd = 'pydoc'
|
||||||
|
endif
|
||||||
|
if bufnr("__doc__") >0
|
||||||
|
exe "sb __doc__"
|
||||||
|
else
|
||||||
|
exe 'split __doc__'
|
||||||
|
endif
|
||||||
|
setlocal noswapfile
|
||||||
|
set buftype=nofile
|
||||||
|
setlocal modifiable
|
||||||
|
normal ggdG
|
||||||
|
let s:name2 = substitute(a:name, '(.*', '', 'g' )
|
||||||
|
if a:type==1
|
||||||
|
execute "silent read ! " g:pydoc_cmd . " " . s:name2
|
||||||
|
else
|
||||||
|
execute "silent read ! ".g:pydoc_cmd. " -k " . s:name2
|
||||||
|
endif
|
||||||
|
setlocal nomodified
|
||||||
|
set filetype=man
|
||||||
|
normal 1G
|
||||||
|
if !exists('g:pydoc_highlight')
|
||||||
|
let g:pydoc_highlight = 1
|
||||||
|
endif
|
||||||
|
if g:pydoc_highlight ==1
|
||||||
|
call Highlight(s:name2)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! Highlight(name)
|
||||||
|
exe "sb __doc__"
|
||||||
|
set filetype=man
|
||||||
|
syn on
|
||||||
|
exe 'syntax keyword pydoc '.s:name2
|
||||||
|
hi pydoc gui=reverse
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"mappings
|
||||||
|
map <leader>pw :call ShowPyDoc('<C-R><C-W>', 1)<CR>
|
||||||
|
map <leader>pW :call ShowPyDoc('<C-R><C-A>', 1)<CR>
|
||||||
|
"commands
|
||||||
|
command -nargs=1 Pydoc :call ShowPyDoc('<args>', 1)
|
||||||
|
command -nargs=* PydocSearch :call ShowPyDoc('<args>', 0)
|
|
@ -1,5 +1,3 @@
|
||||||
" TEMPLATE SYSTEM FOR VIM
|
|
||||||
"
|
|
||||||
" Preserve template files
|
" Preserve template files
|
||||||
augroup newfiles
|
augroup newfiles
|
||||||
" First we load templates for the file type
|
" First we load templates for the file type
|
||||||
|
@ -18,7 +16,7 @@ augroup newfiles
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Set up python support
|
" Set up python support
|
||||||
au FileType python source ~/.vim/addon/python.vim
|
"au FileType python source ~/.vim/addon/python.vim
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,299 @@
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: Python
|
||||||
|
" Maintainer: Dmitry Vasiliev <dima@hlabs.spb.ru>
|
||||||
|
" URL: http://www.hlabs.spb.ru/vim/python.vim
|
||||||
|
" Last Change: $Date$
|
||||||
|
" Filenames: *.py
|
||||||
|
" Version: 2.5.5
|
||||||
|
" $Rev$
|
||||||
|
"
|
||||||
|
" Based on python.vim (from Vim 6.1 distribution)
|
||||||
|
" by Neil Schemenauer <nas@python.ca>
|
||||||
|
"
|
||||||
|
|
||||||
|
"
|
||||||
|
" Options:
|
||||||
|
"
|
||||||
|
" For set option do: let OPTION_NAME = 1
|
||||||
|
" For clear option do: let OPTION_NAME = 0
|
||||||
|
"
|
||||||
|
" Option names:
|
||||||
|
"
|
||||||
|
" For highlight builtin functions:
|
||||||
|
" python_highlight_builtins
|
||||||
|
"
|
||||||
|
" For highlight standard exceptions:
|
||||||
|
" python_highlight_exceptions
|
||||||
|
"
|
||||||
|
" For highlight string formatting:
|
||||||
|
" python_highlight_string_formatting
|
||||||
|
"
|
||||||
|
" For highlight indentation errors:
|
||||||
|
" python_highlight_indent_errors
|
||||||
|
"
|
||||||
|
" For highlight trailing spaces:
|
||||||
|
" python_highlight_space_errors
|
||||||
|
"
|
||||||
|
" For highlight doc-tests:
|
||||||
|
" python_highlight_doctests
|
||||||
|
"
|
||||||
|
" If you want all possible Python highlighting:
|
||||||
|
" (This option not override previously set options)
|
||||||
|
" python_highlight_all
|
||||||
|
"
|
||||||
|
" For fast machines:
|
||||||
|
" python_slow_sync
|
||||||
|
"
|
||||||
|
|
||||||
|
" For version 5.x: Clear all syntax items
|
||||||
|
" For version 6.x: Quit when a syntax file was already loaded
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let python_highlight_all=1
|
||||||
|
let python_slow_sync=1
|
||||||
|
|
||||||
|
if exists("python_highlight_all") && python_highlight_all != 0
|
||||||
|
" Not override previously set options
|
||||||
|
if !exists("python_highlight_builtins")
|
||||||
|
let python_highlight_builtins = 1
|
||||||
|
endif
|
||||||
|
if !exists("python_highlight_exceptions")
|
||||||
|
let python_highlight_exceptions = 1
|
||||||
|
endif
|
||||||
|
if !exists("python_highlight_string_formatting")
|
||||||
|
let python_highlight_string_formatting = 1
|
||||||
|
endif
|
||||||
|
if !exists("python_highlight_indent_errors")
|
||||||
|
let python_highlight_indent_errors = 1
|
||||||
|
endif
|
||||||
|
if !exists("python_highlight_space_errors")
|
||||||
|
let python_highlight_space_errors = 1
|
||||||
|
endif
|
||||||
|
if !exists("python_highlight_doctests")
|
||||||
|
let python_highlight_doctests = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Keywords
|
||||||
|
syn keyword pythonStatement break continue del
|
||||||
|
syn keyword pythonStatement exec return
|
||||||
|
syn keyword pythonStatement pass print raise
|
||||||
|
syn keyword pythonStatement global assert
|
||||||
|
syn keyword pythonStatement lambda yield
|
||||||
|
syn keyword pythonStatement with
|
||||||
|
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
|
||||||
|
syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" display contained
|
||||||
|
syn keyword pythonRepeat for while
|
||||||
|
syn keyword pythonConditional if elif else
|
||||||
|
syn keyword pythonImport import from as
|
||||||
|
syn keyword pythonException try except finally
|
||||||
|
syn keyword pythonOperator and in is not or
|
||||||
|
|
||||||
|
" Decorators (new in Python 2.4)
|
||||||
|
syn match pythonDecorator "@" display nextgroup=pythonFunction skipwhite
|
||||||
|
|
||||||
|
" Comments
|
||||||
|
syn match pythonComment "#.*$" display contains=pythonTodo
|
||||||
|
syn match pythonRun "\%^#!.*$"
|
||||||
|
syn match pythonCoding "\%^.*\(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$"
|
||||||
|
syn keyword pythonTodo TODO FIXME XXX contained
|
||||||
|
|
||||||
|
" Errors
|
||||||
|
syn match pythonError "\<\d\+\D\+\>" display
|
||||||
|
syn match pythonError "[$?]" display
|
||||||
|
syn match pythonError "[-+&|]\{2,}" display
|
||||||
|
syn match pythonError "[=]\{3,}" display
|
||||||
|
|
||||||
|
" TODO: Mixing spaces and tabs also may be used for pretty formatting multiline
|
||||||
|
" statements. For now I don't know how to work around this.
|
||||||
|
if exists("python_highlight_indent_errors") && python_highlight_indent_errors != 0
|
||||||
|
syn match pythonIndentError "^\s*\( \t\|\t \)\s*\S"me=e-1 display
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Trailing space errors
|
||||||
|
if exists("python_highlight_space_errors") && python_highlight_space_errors != 0
|
||||||
|
syn match pythonSpaceError "\s\+$" display
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Strings
|
||||||
|
syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonEscapeError
|
||||||
|
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonEscapeError
|
||||||
|
syn region pythonString start=+"""+ end=+"""+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest2,pythonSpaceError
|
||||||
|
syn region pythonString start=+'''+ end=+'''+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest,pythonSpaceError
|
||||||
|
|
||||||
|
syn match pythonEscape +\\[abfnrtv'"\\]+ display contained
|
||||||
|
syn match pythonEscape "\\\o\o\=\o\=" display contained
|
||||||
|
syn match pythonEscapeError "\\\o\{,2}[89]" display contained
|
||||||
|
syn match pythonEscape "\\x\x\{2}" display contained
|
||||||
|
syn match pythonEscapeError "\\x\x\=\X" display contained
|
||||||
|
syn match pythonEscape "\\$"
|
||||||
|
|
||||||
|
" Unicode strings
|
||||||
|
syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError
|
||||||
|
syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError
|
||||||
|
syn region pythonUniString start=+[uU]"""+ end=+"""+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,pythonDocTest2,pythonSpaceError
|
||||||
|
syn region pythonUniString start=+[uU]'''+ end=+'''+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,pythonDocTest,pythonSpaceError
|
||||||
|
|
||||||
|
syn match pythonUniEscape "\\u\x\{4}" display contained
|
||||||
|
syn match pythonUniEscapeError "\\u\x\{,3}\X" display contained
|
||||||
|
syn match pythonUniEscape "\\U\x\{8}" display contained
|
||||||
|
syn match pythonUniEscapeError "\\U\x\{,7}\X" display contained
|
||||||
|
syn match pythonUniEscape "\\N{[A-Z ]\+}" display contained
|
||||||
|
syn match pythonUniEscapeError "\\N{[^A-Z ]\+}" display contained
|
||||||
|
|
||||||
|
" Raw strings
|
||||||
|
syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape
|
||||||
|
syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape
|
||||||
|
syn region pythonRawString start=+[rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError
|
||||||
|
syn region pythonRawString start=+[rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError
|
||||||
|
|
||||||
|
syn match pythonRawEscape +\\['"]+ display transparent contained
|
||||||
|
|
||||||
|
" Unicode raw strings
|
||||||
|
syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError
|
||||||
|
syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError
|
||||||
|
syn region pythonUniRawString start=+[uU][rR]"""+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError
|
||||||
|
syn region pythonUniRawString start=+[uU][rR]'''+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError
|
||||||
|
|
||||||
|
syn match pythonUniRawEscape "\([^\\]\(\\\\\)*\)\@<=\\u\x\{4}" display contained
|
||||||
|
syn match pythonUniRawEscapeError "\([^\\]\(\\\\\)*\)\@<=\\u\x\{,3}\X" display contained
|
||||||
|
|
||||||
|
if exists("python_highlight_string_formatting") && python_highlight_string_formatting != 0
|
||||||
|
" String formatting
|
||||||
|
syn match pythonStrFormat "%\(([^)]\+)\)\=[-#0 +]*\d*\(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString
|
||||||
|
syn match pythonStrFormat "%[-#0 +]*\(\*\|\d\+\)\=\(\.\(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("python_highlight_doctests") && python_highlight_doctests != 0
|
||||||
|
" DocTests
|
||||||
|
syn region pythonDocTest start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
|
||||||
|
syn region pythonDocTest2 start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Numbers (ints, longs, floats, complex)
|
||||||
|
syn match pythonHexNumber "\<0[xX]\x\+[lL]\=\>" display
|
||||||
|
syn match pythonHexNumber "\<0[xX]\>" display
|
||||||
|
syn match pythonNumber "\<\d\+[lLjJ]\=\>" display
|
||||||
|
syn match pythonFloat "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>" display
|
||||||
|
syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
|
||||||
|
syn match pythonFloat "\<\d\+\.\d*\([eE][+-]\=\d\+\)\=[jJ]\=" display
|
||||||
|
|
||||||
|
syn match pythonOctalError "\<0\o*[89]\d*[lL]\=\>" display
|
||||||
|
syn match pythonHexError "\<0[xX]\X\+[lL]\=\>" display
|
||||||
|
|
||||||
|
if exists("python_highlight_builtins") && python_highlight_builtins != 0
|
||||||
|
" Builtin functions, types and objects
|
||||||
|
syn keyword pythonBuiltinObj True False Ellipsis None NotImplemented
|
||||||
|
|
||||||
|
syn keyword pythonBuiltinFunc __import__ abs all any apply
|
||||||
|
syn keyword pythonBuiltinFunc basestring bool buffer callable
|
||||||
|
syn keyword pythonBuiltinFunc chr classmethod cmp coerce compile complex
|
||||||
|
syn keyword pythonBuiltinFunc delattr dict dir divmod enumerate eval
|
||||||
|
syn keyword pythonBuiltinFunc execfile file filter float frozenset getattr
|
||||||
|
syn keyword pythonBuiltinfunc globals hasattr hash help hex id
|
||||||
|
syn keyword pythonBuiltinFunc input int intern isinstance
|
||||||
|
syn keyword pythonBuiltinFunc issubclass iter len list locals long map max
|
||||||
|
syn keyword pythonBuiltinFunc min object oct open ord pow property range
|
||||||
|
syn keyword pythonBuiltinFunc raw_input reduce reload repr
|
||||||
|
syn keyword pythonBuiltinFunc reversed round set setattr
|
||||||
|
syn keyword pythonBuiltinFunc slice sorted staticmethod str sum super tuple
|
||||||
|
syn keyword pythonBuiltinFunc type unichr unicode vars xrange zip
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("python_highlight_exceptions") && python_highlight_exceptions != 0
|
||||||
|
" Builtin exceptions and warnings
|
||||||
|
syn keyword pythonExClass BaseException
|
||||||
|
syn keyword pythonExClass Exception StandardError ArithmeticError
|
||||||
|
syn keyword pythonExClass LookupError EnvironmentError
|
||||||
|
|
||||||
|
syn keyword pythonExClass AssertionError AttributeError EOFError
|
||||||
|
syn keyword pythonExClass FloatingPointError GeneratorExit IOError
|
||||||
|
syn keyword pythonExClass ImportError IndexError KeyError
|
||||||
|
syn keyword pythonExClass KeyboardInterrupt MemoryError NameError
|
||||||
|
syn keyword pythonExClass NotImplementedError OSError OverflowError
|
||||||
|
syn keyword pythonExClass ReferenceError RuntimeError StopIteration
|
||||||
|
syn keyword pythonExClass SyntaxError IndentationError TabError
|
||||||
|
syn keyword pythonExClass SystemError SystemExit TypeError
|
||||||
|
syn keyword pythonExClass UnboundLocalError UnicodeError
|
||||||
|
syn keyword pythonExClass UnicodeEncodeError UnicodeDecodeError
|
||||||
|
syn keyword pythonExClass UnicodeTranslateError ValueError
|
||||||
|
syn keyword pythonExClass WindowsError ZeroDivisionError
|
||||||
|
|
||||||
|
syn keyword pythonExClass Warning UserWarning DeprecationWarning
|
||||||
|
syn keyword pythonExClass PendingDepricationWarning SyntaxWarning
|
||||||
|
syn keyword pythonExClass RuntimeWarning FutureWarning OverflowWarning
|
||||||
|
syn keyword pythonExClass ImportWarning UnicodeWarning
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("python_slow_sync") && python_slow_sync != 0
|
||||||
|
syn sync minlines=2000
|
||||||
|
else
|
||||||
|
" This is fast but code inside triple quoted strings screws it up. It
|
||||||
|
" is impossible to fix because the only way to know if you are inside a
|
||||||
|
" triple quoted string is to start from the beginning of the file.
|
||||||
|
syn sync match pythonSync grouphere NONE "):$"
|
||||||
|
syn sync maxlines=200
|
||||||
|
endif
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_python_syn_inits")
|
||||||
|
if version <= 508
|
||||||
|
let did_python_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
HiLink pythonStatement Statement
|
||||||
|
HiLink pythonImport Statement
|
||||||
|
HiLink pythonFunction Function
|
||||||
|
HiLink pythonConditional Conditional
|
||||||
|
HiLink pythonRepeat Repeat
|
||||||
|
HiLink pythonException Exception
|
||||||
|
HiLink pythonOperator Operator
|
||||||
|
|
||||||
|
HiLink pythonDecorator Define
|
||||||
|
|
||||||
|
HiLink pythonComment Comment
|
||||||
|
HiLink pythonCoding Special
|
||||||
|
HiLink pythonRun Special
|
||||||
|
HiLink pythonTodo Todo
|
||||||
|
|
||||||
|
HiLink pythonError Error
|
||||||
|
HiLink pythonIndentError Error
|
||||||
|
HiLink pythonSpaceError Error
|
||||||
|
|
||||||
|
HiLink pythonString String
|
||||||
|
HiLink pythonUniString String
|
||||||
|
HiLink pythonRawString String
|
||||||
|
HiLink pythonUniRawString String
|
||||||
|
|
||||||
|
HiLink pythonEscape Special
|
||||||
|
HiLink pythonEscapeError Error
|
||||||
|
HiLink pythonUniEscape Special
|
||||||
|
HiLink pythonUniEscapeError Error
|
||||||
|
HiLink pythonUniRawEscape Special
|
||||||
|
HiLink pythonUniRawEscapeError Error
|
||||||
|
|
||||||
|
HiLink pythonStrFormat Special
|
||||||
|
|
||||||
|
HiLink pythonDocTest Special
|
||||||
|
HiLink pythonDocTest2 Special
|
||||||
|
|
||||||
|
HiLink pythonNumber Number
|
||||||
|
HiLink pythonHexNumber Number
|
||||||
|
HiLink pythonFloat Float
|
||||||
|
HiLink pythonOctalError Error
|
||||||
|
HiLink pythonHexError Error
|
||||||
|
|
||||||
|
HiLink pythonBuiltinObj Structure
|
||||||
|
HiLink pythonBuiltinFunc Function
|
||||||
|
|
||||||
|
HiLink pythonExClass Structure
|
||||||
|
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "python"
|
Loading…
Reference in New Issue