Unified zsh startup

Removed environment
Added Mako syntax to VI
This commit is contained in:
Andrea Mistrali 2009-05-06 13:44:15 +00:00
parent f7dabac03a
commit 3e5eb6a66e
11 changed files with 326 additions and 758 deletions

View File

@ -1,46 +0,0 @@
# -*- coding: latin-1 -*-
# Copyright (c)2008 CUBE S.p.A.
#
# Author: Andrea Mistrali <andre@cubeholding.com>
# Description: Environment variables definition
#
# $Id$
LESS="-c -x2 -R -MM -PMFile\:?f%f:STDIN. Size\:?B%B:Unknown. Pos\:?pb%pb\%:Unknown. File No.\:%i/%m"
LANG=it_IT@euro
LESSCHARSET=latin1
SAVEHIST=500
HISTFILE=~/.history
HISTSIZE=10000
READNULLCMD=/usr/bin/less
PAGER=/usr/bin/less
MPAGE="-2 -f -P -bA4"
PS1="%B%m:%n:%~ %#%b "
PATH="/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/sbin:/usr/sbin:$HOME/bin:."
LOGCHECK=30
LOGD=/var/log
REPORTTIME=15
WATCH=notme
WATCHFMT="%n %a %l (%m) at %t."
PYTHONSTARTUP=~/.pythonrc.py
MIBS=all
MINICOM="-c on"
#export CVSROOT=":pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od"
#export CVSROOT=":pserver:andre@lorien:/var/lib/cvs"
CVSROOT=":pserver:cvs:/var/lib/cvs"
EDITOR="vi"
# Distcc configuration
MAKEFLAGS=CC=distcc
DISTCC_HOSTS="localhost @zeus"
PATH="/usr/local/distcc/bin:$PATH"
CONCURRENCY_LEVEL=10
MAKEFLAGS="CC=distcc"

View File

@ -1,599 +0,0 @@
"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:

View File

@ -57,6 +57,19 @@
'Tlist_WinWidth' taglist.txt /*'Tlist_WinWidth'* 'Tlist_WinWidth' taglist.txt /*'Tlist_WinWidth'*
'loaded_nerd_comments' NERD_commenter.txt /*'loaded_nerd_comments'* 'loaded_nerd_comments' NERD_commenter.txt /*'loaded_nerd_comments'*
'loaded_nerd_tree' NERD_tree.txt /*'loaded_nerd_tree'* 'loaded_nerd_tree' NERD_tree.txt /*'loaded_nerd_tree'*
:AlignCenter textformat.txt /*:AlignCenter*
:AlignJustify textformat.txt /*:AlignJustify*
:AlignLeft textformat.txt /*:AlignLeft*
:AlignRight textformat.txt /*:AlignRight*
:CVSEdit vcscommand.txt /*:CVSEdit*
:CVSEditors vcscommand.txt /*:CVSEditors*
:CVSUnedit vcscommand.txt /*:CVSUnedit*
:CVSWatch vcscommand.txt /*:CVSWatch*
:CVSWatchAdd vcscommand.txt /*:CVSWatchAdd*
:CVSWatchOff vcscommand.txt /*:CVSWatchOff*
:CVSWatchOn vcscommand.txt /*:CVSWatchOn*
:CVSWatchRemove vcscommand.txt /*:CVSWatchRemove*
:CVSWatchers vcscommand.txt /*:CVSWatchers*
:NERDTree NERD_tree.txt /*:NERDTree* :NERDTree NERD_tree.txt /*:NERDTree*
:NERDTreeClose NERD_tree.txt /*:NERDTreeClose* :NERDTreeClose NERD_tree.txt /*:NERDTreeClose*
:NERDTreeFromBookmark NERD_tree.txt /*:NERDTreeFromBookmark* :NERDTreeFromBookmark NERD_tree.txt /*:NERDTreeFromBookmark*
@ -78,6 +91,23 @@
:TlistUndebug taglist.txt /*:TlistUndebug* :TlistUndebug taglist.txt /*:TlistUndebug*
:TlistUnlock taglist.txt /*:TlistUnlock* :TlistUnlock taglist.txt /*:TlistUnlock*
:TlistUpdate taglist.txt /*:TlistUpdate* :TlistUpdate taglist.txt /*:TlistUpdate*
:VCSAdd vcscommand.txt /*:VCSAdd*
:VCSAnnotate vcscommand.txt /*:VCSAnnotate*
:VCSBlame vcscommand.txt /*:VCSBlame*
:VCSCommit vcscommand.txt /*:VCSCommit*
:VCSDelete vcscommand.txt /*:VCSDelete*
:VCSDiff vcscommand.txt /*:VCSDiff*
:VCSGotoOriginal vcscommand.txt /*:VCSGotoOriginal*
:VCSInfo vcscommand.txt /*:VCSInfo*
:VCSLock vcscommand.txt /*:VCSLock*
:VCSLog vcscommand.txt /*:VCSLog*
:VCSRemove vcscommand.txt /*:VCSRemove*
:VCSRevert vcscommand.txt /*:VCSRevert*
:VCSReview vcscommand.txt /*:VCSReview*
:VCSStatus vcscommand.txt /*:VCSStatus*
:VCSUnlock vcscommand.txt /*:VCSUnlock*
:VCSUpdate vcscommand.txt /*:VCSUpdate*
:VCSVimDiff vcscommand.txt /*:VCSVimDiff*
NERDComAbout NERD_commenter.txt /*NERDComAbout* NERDComAbout NERD_commenter.txt /*NERDComAbout*
NERDComAlignedComment NERD_commenter.txt /*NERDComAlignedComment* NERDComAlignedComment NERD_commenter.txt /*NERDComAlignedComment*
NERDComAltDelim NERD_commenter.txt /*NERDComAltDelim* NERDComAltDelim NERD_commenter.txt /*NERDComAltDelim*
@ -167,6 +197,30 @@ 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_Get_Tagname_By_Line() taglist.txt /*Tlist_Get_Tagname_By_Line()*
Tlist_Set_App() taglist.txt /*Tlist_Set_App()* Tlist_Set_App() taglist.txt /*Tlist_Set_App()*
Tlist_Update_File_Tags() taglist.txt /*Tlist_Update_File_Tags()* Tlist_Update_File_Tags() taglist.txt /*Tlist_Update_File_Tags()*
VCSCommandCVSDiffOpt vcscommand.txt /*VCSCommandCVSDiffOpt*
VCSCommandCVSExec vcscommand.txt /*VCSCommandCVSExec*
VCSCommandCommitOnWrite vcscommand.txt /*VCSCommandCommitOnWrite*
VCSCommandDeleteOnHide vcscommand.txt /*VCSCommandDeleteOnHide*
VCSCommandDiffSplit vcscommand.txt /*VCSCommandDiffSplit*
VCSCommandDisableAll vcscommand.txt /*VCSCommandDisableAll*
VCSCommandDisableExtensionMappings vcscommand.txt /*VCSCommandDisableExtensionMappings*
VCSCommandDisableMappings vcscommand.txt /*VCSCommandDisableMappings*
VCSCommandEdit vcscommand.txt /*VCSCommandEdit*
VCSCommandEnableBufferSetup vcscommand.txt /*VCSCommandEnableBufferSetup*
VCSCommandMapPrefix vcscommand.txt /*VCSCommandMapPrefix*
VCSCommandMappings vcscommand.txt /*VCSCommandMappings*
VCSCommandResultBufferNameExtension vcscommand.txt /*VCSCommandResultBufferNameExtension*
VCSCommandResultBufferNameFunction vcscommand.txt /*VCSCommandResultBufferNameFunction*
VCSCommandSVKExec vcscommand.txt /*VCSCommandSVKExec*
VCSCommandSVNDiffExt vcscommand.txt /*VCSCommandSVNDiffExt*
VCSCommandSVNDiffOpt vcscommand.txt /*VCSCommandSVNDiffOpt*
VCSCommandSVNExec vcscommand.txt /*VCSCommandSVNExec*
VCSCommandSplit vcscommand.txt /*VCSCommandSplit*
VCSCommandVCSTypeOverride vcscommand.txt /*VCSCommandVCSTypeOverride*
b:VCSCommandCommand vcscommand.txt /*b:VCSCommandCommand*
b:VCSCommandOriginalBuffer vcscommand.txt /*b:VCSCommandOriginalBuffer*
b:VCSCommandSourceFile vcscommand.txt /*b:VCSCommandSourceFile*
b:VCSCommandVCSType vcscommand.txt /*b:VCSCommandVCSType*
bufexplorer bufexplorer.txt /*bufexplorer* bufexplorer bufexplorer.txt /*bufexplorer*
bufexplorer-changelog bufexplorer.txt /*bufexplorer-changelog* bufexplorer-changelog bufexplorer.txt /*bufexplorer-changelog*
bufexplorer-credits bufexplorer.txt /*bufexplorer-credits* bufexplorer-credits bufexplorer.txt /*bufexplorer-credits*
@ -176,6 +230,7 @@ bufexplorer-todo bufexplorer.txt /*bufexplorer-todo*
bufexplorer-usage bufexplorer.txt /*bufexplorer-usage* bufexplorer-usage bufexplorer.txt /*bufexplorer-usage*
bufexplorer.txt bufexplorer.txt /*bufexplorer.txt* bufexplorer.txt bufexplorer.txt /*bufexplorer.txt*
buffer-explorer bufexplorer.txt /*buffer-explorer* buffer-explorer bufexplorer.txt /*buffer-explorer*
cvscommand-changes vcscommand.txt /*cvscommand-changes*
g:bufExplorerDefaultHelp bufexplorer.txt /*g:bufExplorerDefaultHelp* g:bufExplorerDefaultHelp bufexplorer.txt /*g:bufExplorerDefaultHelp*
g:bufExplorerDetailedHelp bufexplorer.txt /*g:bufExplorerDetailedHelp* g:bufExplorerDetailedHelp bufexplorer.txt /*g:bufExplorerDetailedHelp*
g:bufExplorerFindActive bufexplorer.txt /*g:bufExplorerFindActive* g:bufExplorerFindActive bufexplorer.txt /*g:bufExplorerFindActive*
@ -187,18 +242,6 @@ g:bufExplorerSortBy bufexplorer.txt /*g:bufExplorerSortBy*
g:bufExplorerSplitBelow bufexplorer.txt /*g:bufExplorerSplitBelow* g:bufExplorerSplitBelow bufexplorer.txt /*g:bufExplorerSplitBelow*
g:bufExplorerSplitOutPathName bufexplorer.txt /*g:bufExplorerSplitOutPathName* g:bufExplorerSplitOutPathName bufexplorer.txt /*g:bufExplorerSplitOutPathName*
g:bufExplorerSplitRight bufexplorer.txt /*g:bufExplorerSplitRight* 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-commands taglist.txt /*taglist-commands*
taglist-debug taglist.txt /*taglist-debug* taglist-debug taglist.txt /*taglist-debug*
taglist-extend taglist.txt /*taglist-extend* taglist-extend taglist.txt /*taglist-extend*
@ -216,3 +259,32 @@ taglist-session taglist.txt /*taglist-session*
taglist-todo taglist.txt /*taglist-todo* taglist-todo taglist.txt /*taglist-todo*
taglist-using taglist.txt /*taglist-using* taglist-using taglist.txt /*taglist-using*
taglist.txt taglist.txt /*taglist.txt* taglist.txt taglist.txt /*taglist.txt*
textformat-commands textformat.txt /*textformat-commands*
textformat-config textformat.txt /*textformat-config*
textformat-history textformat.txt /*textformat-history*
textformat-keymap textformat.txt /*textformat-keymap*
textformat-start textformat.txt /*textformat-start*
textformat.txt textformat.txt /*textformat.txt*
vcscommand vcscommand.txt /*vcscommand*
vcscommand-buffer-management vcscommand.txt /*vcscommand-buffer-management*
vcscommand-buffer-variables vcscommand.txt /*vcscommand-buffer-variables*
vcscommand-bugs vcscommand.txt /*vcscommand-bugs*
vcscommand-commands vcscommand.txt /*vcscommand-commands*
vcscommand-config vcscommand.txt /*vcscommand-config*
vcscommand-contents vcscommand.txt /*vcscommand-contents*
vcscommand-customize vcscommand.txt /*vcscommand-customize*
vcscommand-events vcscommand.txt /*vcscommand-events*
vcscommand-install vcscommand.txt /*vcscommand-install*
vcscommand-intro vcscommand.txt /*vcscommand-intro*
vcscommand-manual vcscommand.txt /*vcscommand-manual*
vcscommand-mappings vcscommand.txt /*vcscommand-mappings*
vcscommand-mappings-override vcscommand.txt /*vcscommand-mappings-override*
vcscommand-naming vcscommand.txt /*vcscommand-naming*
vcscommand-options vcscommand.txt /*vcscommand-options*
vcscommand-ssh vcscommand.txt /*vcscommand-ssh*
vcscommand-ssh-config vcscommand.txt /*vcscommand-ssh-config*
vcscommand-ssh-env vcscommand.txt /*vcscommand-ssh-env*
vcscommand-ssh-other vcscommand.txt /*vcscommand-ssh-other*
vcscommand-ssh-wrapper vcscommand.txt /*vcscommand-ssh-wrapper*
vcscommand-statusline vcscommand.txt /*vcscommand-statusline*
vcscommand.txt vcscommand.txt /*vcscommand.txt*

View File

@ -17,17 +17,17 @@ set guioptions-=T
set guioptions+=a set guioptions+=a
if &background == "dark" if &background == "dark"
hi normal guibg=black hi normal guibg=black
set transp=8 set transparency=4
endif endif
"colorscheme zenburn " colorscheme zenburn
"colorscheme freya " colorscheme freya
"colorscheme moria " colorscheme moria
"colorscheme morning " colorscheme morning
"colorscheme desert " colorscheme desert
"colorscheme macvim colorscheme macvim
colorscheme inkpot " colorscheme inkpot
" Emacs like indenting. Pressing Tab indents line " Emacs like indenting. Pressing Tab indents line
" set indentkeys=0{,0},0),:,0#,!^F,o,O,e,!<Tab>,!^F set indentkeys=0{,0},0),:,0#,!^F,o,O,e,!<Tab>,!^F
" set cinkeys=0{,0},0),:,0#,!^F,o,O,e,!<Tab>,!^F set cinkeys=0{,0},0),:,0#,!^F,o,O,e,!<Tab>,!^F

View File

@ -1,6 +1,6 @@
" Copyright by Andrea Mistrali <am@am.cx> " Copyright by Andrea Mistrali <am@am.cx>
" First version: Who knows? " First version: Who knows?
" Last modified: 2009-04-01T16:55:05 CEST " Last modified: 2009-04-28T17:26 CEST (+0200)
" "
" Synopsis: Templating system for vim " Synopsis: Templating system for vim
" "
@ -60,6 +60,10 @@ function! OpenFile()
let l:ext=fnamemodify(s:filename, ":e") let l:ext=fnamemodify(s:filename, ":e")
let l:skel = g:skeletons."/skeleton.".l:ext let l:skel = g:skeletons."/skeleton.".l:ext
if filereadable(fnamemodify(l:skel,":p")) if filereadable(fnamemodify(l:skel,":p"))
let s:doit=input("Perform auto insert (y/n)? ")
if s:doit == 'n' || s:doit == 'N'
return
endif
execute "0r" l:skel execute "0r" l:skel
let s:syn=input("Synopsis: ") let s:syn=input("Synopsis: ")
if line("$") > 20 if line("$") > 20

66
vim/plugin/textformat.vim Normal file
View File

@ -0,0 +1,66 @@
" Text formatter plugin for Vim text editor
"
" Version: 2.1
" Last Change: 2008-09-13
" Maintainer: Teemu Likonen <tlikonen@iki.fi>
" License: This file is placed in the public domain.
" GetLatestVimScripts: 2324 1 :AutoInstall: TextFormat
"{{{1 The beginning stuff
if &compatible || exists('g:loaded_textformat')
finish
endif
let s:save_cpo = &cpo
set cpo&vim
"}}}1
if v:version < 700
echohl ErrorMsg
echomsg 'TextFormat plugin needs Vim version 7.0 or later. Sorry.'
echohl None
finish
endif
if !exists(':AlignLeft')
command -nargs=? -range AlignLeft <line1>,<line2>call textformat#Align_Command('left',<args>)
endif
if !exists(':AlignRight')
command -nargs=? -range AlignRight <line1>,<line2>call textformat#Align_Command('right',<args>)
endif
if !exists(':AlignJustify')
command -nargs=? -range AlignJustify <line1>,<line2>call textformat#Align_Command('justify',<args>)
endif
if !exists(':AlignCenter')
command -nargs=? -range AlignCenter <line1>,<line2>call textformat#Align_Command('center',<args>)
endif
nnoremap <silent> <Plug>Quick_Align_Paragraph_Left :call textformat#Quick_Align_Left()<CR>
nnoremap <silent> <Plug>Quick_Align_Paragraph_Right :call textformat#Quick_Align_Right()<CR>
nnoremap <silent> <Plug>Quick_Align_Paragraph_Justify :call textformat#Quick_Align_Justify()<CR>
nnoremap <silent> <Plug>Quick_Align_Paragraph_Center :call textformat#Quick_Align_Center()<CR>
vnoremap <silent> <Plug>Align_Range_Left :call textformat#Visual_Align_Left()<CR>
vnoremap <silent> <Plug>Align_Range_Right :call textformat#Visual_Align_Right()<CR>
vnoremap <silent> <Plug>Align_Range_Justify :call textformat#Visual_Align_Justify()<CR>
vnoremap <silent> <Plug>Align_Range_Center :call textformat#Visual_Align_Center()<CR>
function! s:Add_Mapping(mode, lhs, rhs)
if maparg(a:lhs, a:mode) == '' && !hasmapto(a:rhs, a:mode)
execute a:mode.'map '.a:lhs.' '.a:rhs
endif
endfunction
call s:Add_Mapping('n', '<Leader>al', '<Plug>Quick_Align_Paragraph_Left')
call s:Add_Mapping('n', '<Leader>ar', '<Plug>Quick_Align_Paragraph_Right')
call s:Add_Mapping('n', '<Leader>aj', '<Plug>Quick_Align_Paragraph_Justify')
call s:Add_Mapping('n', '<Leader>ac', '<Plug>Quick_Align_Paragraph_Center')
call s:Add_Mapping('v', '<Leader>al', '<Plug>Align_Range_Left')
call s:Add_Mapping('v', '<Leader>ar', '<Plug>Align_Range_Right')
call s:Add_Mapping('v', '<Leader>aj', '<Plug>Align_Range_Justify')
call s:Add_Mapping('v', '<Leader>ac', '<Plug>Align_Range_Center')
delfunction s:Add_Mapping
let g:loaded_textformat = 1
let &cpo = s:save_cpo
" vim600: fdm=marker

View File

@ -3,12 +3,13 @@
Copyright by @@LONGNAME@@ <@@EMAIL@@> Copyright by @@LONGNAME@@ <@@EMAIL@@>
First version: @@crdate@@ First version: @@crdate@@
Last modified: 2009-04-03T13:01 CEST (+0200) Last modified: @@lmdate@@
Synopsis: @@DESCR@@ Synopsis: @@DESCR@@
$Id$ $Id$
*/ */
#include <stdio.h> #include <stdio.h>

View File

@ -1,14 +1,16 @@
" "
" General Setup " General Setup
" "
" $Id$
set nocompatible " Use Vim defaults (much better!) set nocompatible " Use Vim defaults (much better!)
set backspace=indent,eol,start " allow backspacing over everything set backspace=indent,eol,start " allow backspacing over everything
set textwidth=78 set textwidth=0
set backup set backup
set viminfo='20,\"50,f10 set viminfo='20,\"50,f10
set history=50 set history=50
set nohlsearch set nohlsearch
set nostartofline
"set paste "set paste
set ruler set ruler
@ -70,7 +72,7 @@ function! CleverTab()
endfunction endfunction
" map the function to Tab " map the function to Tab
" inoremap <C-\> <C-R>=CleverTab()<CR> " inoremap <C-\> <C-R>=CleverTab()<CR>
inoremap <C-\> <C-N> set completeopt=longest
" Emacs like indenting. Pressing Tab indents line " Emacs like indenting. Pressing Tab indents line
@ -123,6 +125,14 @@ nnoremap <silent> <Leader>t :Tlist<CR>
nnoremap <silent> <Leader>N :set number!<CR> nnoremap <silent> <Leader>N :set number!<CR>
nnoremap <silent> <Leader>b :HSBufExplorer<CR> nnoremap <silent> <Leader>b :HSBufExplorer<CR>
map <silent> <Leader>c <plug>NERDCommenterToggle map <silent> <Leader>c <plug>NERDCommenterToggle
inoremap <silent> <C-\> <C-N>
inoremap <silent> <C-Tab> <C-N>
" Visual mode selection
nnoremap <silent> <S-Down> V
nnoremap <silent> <S-Up> V
vnoremap <silent> <S-Down> j
vnoremap <silent> <S-Up> k
" Vim5 comes with syntaxhighlighting. If you want to enable syntaxhightlighting " Vim5 comes with syntaxhighlighting. If you want to enable syntaxhightlighting
" by default uncomment the next three lines. " by default uncomment the next three lines.

61
zshenv
View File

@ -1,61 +0,0 @@
# -*- coding: latin-1 -*-
# Copyright (c)2008 CUBE S.p.A.
#
# Author: Andrea Mistrali <andre@cubeholding.com>
# Description: Zsh Environment setup
#
# $Id$
. /etc/environment
umask 022
function cdb {
DIR=`dirname $1`
cd $DIR
unset DIR
}
function onAll {
pdsh -a $* | dshbak -c
}
alias ls='ls -F --color'
alias la='ls -A'
alias ll='ls -l'
alias lla='la -l'
alias dir='ls -l'
alias cls='/usr/bin/clear'
#alias cp='cp -v'
#alias mv='mv -v'
#alias rm='rm -v'
alias killall='killall -v'
alias skill=killall
alias dc=cd
alias les=less
alias mkdir='mkdir -p'
alias zap='rm -rf'
alias ftail='tail -f'
alias grep='grep --colour'
alias ns='host -t ns'
alias mx='host -t mx'
alias soa='host -t soa'
alias ptr='host -t ptr'
alias vi=vim
# Start autocomplete
autoload -U compinit; compinit
if [ `uname -s` = "Darwin" ]; then
# Alias for editors on OSX
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim'
alias aquamacs='open -a Aquamacs\ Emacs'
alias ldd='otool -L'
alias ls='ls -F -G'
fi

141
zshrc
View File

@ -10,12 +10,13 @@
setopt ALWAYS_TO_END setopt ALWAYS_TO_END
setopt APPEND_HISTORY setopt APPEND_HISTORY
setopt AUTO_CD setopt AUTO_CD
setopt ALL_EXPORT
setopt AUTO_MENU setopt AUTO_MENU
setopt AUTONAMEDIRS setopt AUTONAMEDIRS
setopt AUTO_PARAM_SLASH setopt AUTO_PARAM_SLASH
setopt AUTO_REMOVE_SLASH setopt AUTO_REMOVE_SLASH
setopt AUTO_RESUME setopt AUTO_RESUME
#setopt CDABLE_VARS # setopt CDABLE_VARS
setopt CORRECT setopt CORRECT
setopt FUNCTION_ARGZERO setopt FUNCTION_ARGZERO
setopt HIST_IGNORE_ALL_DUPS setopt HIST_IGNORE_ALL_DUPS
@ -32,23 +33,133 @@ setopt NOTIFY
setopt PATH_DIRS setopt PATH_DIRS
setopt SHORT_LOOPS setopt SHORT_LOOPS
compctl -g "*(-/)" + -g ".*(-/)" cd umask 022
## Vars used always
#
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/sbin:/sbin:$HOME/bin:."
SAVEHIST=500
HISTFILE=~/.history
HISTSIZE=10000
LANG="it_IT.UTF-8"
TZ='Europe/Rome'
MIBS=all
## If we are not interactive quit
[ -z "$PS1" ] && return
## Vars only for interactive sessions
LESS="-c -x2 -R -MM -PMFile\:?f%f:STDIN. Size\:?B%B:Unknown. Pos\:?pb%pb\%:Unknown. File No.\:%i/%m"
LESSCHARSET=utf-8
READNULLCMD=/usr/bin/less
PAGER=/usr/bin/less
PS1="%B%m:%n:%~ %#%b "
LOGCHECK=30
LOGD=/var/log
REPORTTIME=15
WATCH=notme
WATCHFMT="%n %a %l (%m) at %t."
PYTHONSTARTUP=~/.pythonrc.py
MINICOM="-c on"
function cdb {
cd `dirname $1`
}
alias ls='ls -F --color'
alias la='ls -A'
alias ll='ls -l'
alias lla='la -l'
alias dir='ls -l'
alias cls='/usr/bin/clear'
alias killall='killall -v'
alias dc=cd
alias les=less
alias mkdir='mkdir -p'
alias zap='rm -rf'
alias ftail='tail -f'
alias grep='grep --colour'
alias ns='host -t ns'
alias mx='host -t mx'
alias soa='host -t soa'
alias ptr='host -t ptr'
alias vi=vim
# Start autocoplete
autoload -U compinit; compinit
function cdb {
DIR=`dirname $1`
cd $DIR
unset DIR
}
alias ls='ls -F --color'
alias la='ls -A'
alias ll='ls -l'
alias lla='la -l'
alias dir='ls -l'
alias cls='/usr/bin/clear'
alias killall='killall -v'
alias skill=killall
alias dc=cd
alias les=less
alias mkdir='mkdir -p'
alias zap='rm -rf'
alias ftail='tail -f'
alias grep='grep --colour'
alias ns='host -t ns'
alias mx='host -t mx'
alias soa='host -t soa'
alias ptr='host -t ptr'
alias vi=vim
# Start autocomplete
autoload -U compinit; compinit
compctl -g "*(-/)" + -g ".*(-/)" cd
#
autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
(( count = $count + 1 ))
done
PR_NO_COLOR="%{$terminfo[sgr0]%}"
#
## make less colourful
LESS_TERMCAP_mb=$'\E[01;31m'
LESS_TERMCAP_md=$'\E[01;31m'
LESS_TERMCAP_me=$'\E[0m'
LESS_TERMCAP_se=$'\E[0m'
LESS_TERMCAP_so=$'\E[01;44;33m'
LESS_TERMCAP_ue=$'\E[0m'
LESS_TERMCAP_us=$'\E[01;32m'
# Useful under iTerm
bindkey "-e" bindkey "-e"
bindkey "\e[1~" beginning-of-line bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line bindkey "\e[4~" end-of-line
bindkey "\e[3~" delete-char bindkey "\e[3~" delete-char
#bindkey "\e[2~" overwrite-mode
#bindkey "\e[A" history-beginning-search-backward
#bindkey "\e[B" history-beginning-search-forward
bindkey "\eOA" history-search-backward bindkey "\eOA" history-search-backward
bindkey "\eOB" history-search-forward bindkey "\eOB" history-search-forward
bindkey "\e[A" history-search-backward bindkey "\e[A" history-search-backward
bindkey "\e[B" history-search-forward bindkey "\e[B" history-search-forward
##bindkey "Od" backward-word
##bindkey "Oc" forward-word
##bindkey "\eOd" backward-word
##bindkey "\eOc" forward-word
bindkey "\e[5D" backward-word bindkey "\e[5D" backward-word
bindkey "\e[5C" forward-word bindkey "\e[5C" forward-word
bindkey "" vi-backward-kill-word bindkey "" vi-backward-kill-word
@ -66,9 +177,19 @@ fi
if [ `uname -s` = "Linux" ]; then if [ `uname -s` = "Linux" ]; then
eval `dircolors` eval `dircolors`
eval `lesspipe`
fi fi
if [ `uname -s` = "Darwin" ]; then if [ `uname -s` = "Darwin" ]; then
export LSCOLORS="GxgxcxdxCxegedabagacad" export LSCOLORS="GxgxcxdxCxegedabagacad"
# Alias for editors on OSX
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim'
alias aquamacs='open -a Aquamacs\ Emacs'
alias ldd='otool -L'
alias ls='ls -F -G'
alias skill=killall
if [ -f /opt/local/etc/init.sh ]; then
source /opt/local/etc/init.sh
fi
fi fi