1
0
forked from aniani/vim

updated for version 7.0180

This commit is contained in:
Bram Moolenaar
2006-01-13 22:35:40 +00:00
parent 4770d09abd
commit a40ceaf88a
28 changed files with 425 additions and 82 deletions

View File

@@ -0,0 +1,216 @@
"pycomplete.vim - Omni Completion for python
" Maintainer: Aaron Griffin
" Version: 0.2
" Last Updated: 5 January 2006
"
" TODO
" * local variables *inside* class members
if !has('python')
echo "Error: Required vim compiled with +python"
finish
endif
function! pycomplete#Complete(findstart, base)
"findstart = 1 when we need to get the text length
if a:findstart
let line = getline('.')
let idx = col('.')
while idx > 0
let idx -= 1
let c = line[idx-1]
if c =~ '\w'
continue
elseif ! c =~ '\.'
idx = -1
break
else
break
endif
endwhile
return idx
"findstart = 0 when we need to return the list of completions
else
execute "python get_completions('" . a:base . "')"
return g:pycomplete_completions
endif
endfunction
function! s:DefPython()
python << PYTHONEOF
import vim
import sys
import __builtin__
LOCALDEFS = \
['LOCALDEFS', 'clean_up','eval_source_code', \
'get_completions', '__builtin__', '__builtins__', \
'dbg', '__name__', 'vim', 'sys']
#comment/uncomment one line at a time to enable/disable debugging
def dbg(msg):
pass
# print(msg)
#it seems that by this point, vim has already stripped the base
# matched in the findstart=1 section, so we will create the
# statement from scratch
def get_completions(base):
stmt = vim.eval('expand("<cWORD>")')+base
dbg("parsed statement => %s" % stmt)
eval_source_code()
try:
dbg("eval: %s" % stmt)
if len(stmt.split('.')) == 1:
all = globals().keys() + dir(__builtin__)
match = stmt
else:
rindex= stmt.rfind('.')
all = dir(eval(stmt[:rindex]))
match = stmt[rindex+1:]
completions = []
dbg("match == %s" % match)
for m in all:
#TODO: remove private (_foo) functions?
if m.find('__') != 0 and \
m.find(match) == 0 and \
m not in LOCALDEFS:
dbg("matched... %s, %s" % (m, m.find(match)))
completions.append(m)
dbg("all completions: %s" % completions)
vim.command("let g:pycomplete_completions = %s" % completions)
except:
dbg("exception: %s" % sys.exc_info()[1])
vim.command("let g:pycomplete_completions = []")
clean_up()
#yes, this is a quasi-functional python lexer
def eval_source_code():
import tokenize
import keyword
import StringIO
s = StringIO.StringIO('\n'.join(vim.current.buffer[:]) + '\n')
g = tokenize.generate_tokens(s.readline)
stmts = []
lineNo = 0
try:
for type, str, begin, end, line in g:
if begin[0] == lineNo:
continue
#junk
elif type == tokenize.INDENT or \
type == tokenize.DEDENT or \
type == tokenize.ERRORTOKEN or \
type == tokenize.ENDMARKER or \
type == tokenize.NEWLINE:
continue
#import statement
elif str == 'import':
for type, str, begin, end, line in g:
if str == ';' or type == tokenize.NEWLINE: break
dbg("found [import %s]" % str)
stmts.append("import %s" % str)
#import from statement
elif str == 'from':
type, str, begin, end, line = g.next()
mod = str
type, str, begin, end, line = g.next()
if str != "import": break
mem = ''
for type, str, begin, end, line in g:
if str == ';' or type == tokenize.NEWLINE: break
mem += (str + ',')
if len(mem) > 0:
dbg("found [from %s import %s]" % (mod, mem[:-1]))
stmts.append("from %s import %s" % (mod, mem[:-1]))
#class declaration
elif str == 'class':
type, str, begin, end, line = g.next()
classname = str
dbg("found [class %s]" % classname)
level = 0
members = []
#we don't care about the meat of the members,
# only the signatures, so we'll replace the bodies
# with 'pass' for evaluation
for type, str, begin, end, line in g:
if type == tokenize.INDENT:
level += 1
elif type == tokenize.DEDENT:
level -= 1
if level == 0: break;
elif str == 'def':
#TODO: if name begins with '_', keep private
memberstr = ''
for type, str, begin, end, line in g:
if str == ':': break
memberstr += str
dbg(" member [%s]" % memberstr)
members.append(memberstr)
#TODO parse self.blah = something lines
#elif str == "self" && next && str == "." ...blah...
classstr = 'class %s:' % classname
for m in members:
classstr += ("\n def %s:\n pass" % m)
stmts.append("%s\n" % classstr)
elif keyword.iskeyword(str) or str in globals():
dbg("keyword = %s" % str)
lineNo = begin[0]
else:
if line.find("=") == -1: continue
var = str
type, str, begin, end, line = g.next()
dbg('next = %s' % str)
if str != '=': continue
type, str, begin, end, line = g.next()
if type == tokenize.NEWLINE:
continue
elif type == tokenize.STRING or str == 'str':
stmts.append('%s = str' % var)
elif str == '[' or str == 'list':
stmts.append('%s= list' % var)
elif str == '{' or str == 'dict':
stmts.append('%s = dict' % var)
elif type == tokenize.NUMBER:
continue
elif str == 'Set':
stmts.append('%s = Set' % var)
elif str == 'open' or str == 'file':
stmts.append('%s = file' % var)
else:
inst = str
for type, str, begin, end, line in g:
if type == tokenize.NEWLINE:
break
inst += str
if len(inst) > 0:
dbg("found [%s = %s]" % (var, inst))
stmts.append('%s = %s' % (var, inst))
lineNo = begin[0]
for s in stmts:
try:
dbg("evaluating: %s\n" % s)
exec(s) in globals()
except:
pass
except:
dbg("exception: %s" % sys.exc_info()[1])
def clean_up():
for o in globals().keys():
if o not in LOCALDEFS:
try:
exec('del %s' % o) in globals()
except: pass
sys.path.extend(['.','..'])
PYTHONEOF
endfunction
call s:DefPython()
" vim: set et ts=4:

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.0aa. Last change: 2006 Jan 09
*eval.txt* For Vim version 7.0aa. Last change: 2006 Jan 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3273,6 +3273,10 @@ maparg({name}[, {mode}]) *maparg()*
translated like in the output of the ":map" command listing.
The mappings local to the current buffer are checked first,
then the global mappings.
This function can be used to map a key even when it's already
mapped, and have it do the original mapping too. Sketch: >
exe 'nnoremap <Tab> ==' . maparg('<Tab>', 'n')
mapcheck({name}[, {mode}]) *mapcheck()*
Check if there is a mapping that matches with {name} in mode

View File

@@ -1,4 +1,4 @@
*map.txt* For Vim version 7.0aa. Last change: 2006 Jan 09
*map.txt* For Vim version 7.0aa. Last change: 2006 Jan 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -191,6 +191,8 @@ already exists which is equal.
Example of what will fail: >
:map ,w /[#&!]<CR>
:map <buffer> <unique> ,w /[.,;]<CR>
If you want to map a key and then have it do what it was originally mapped to,
have a look at |maparg()|.
"<buffer>", "<silent>", "<script>" and "<unique>" can be used in any order.
They must appear right after the command, before any other arguments.
@@ -639,7 +641,7 @@ you must create mapping that first sets the 'operatorfunc' option and then
invoke the |g@| operator. After the user types the {motion} command the
specified function will be called.
*g@*
*g@* *E774* *E775*
g@{motion} Call the function set by the 'operatorfunc' option.
The '[ mark is positioned at the start of the text
moved over by {motion}, the '] mark on the last

View File

@@ -1,4 +1,4 @@
*quickfix.txt* For Vim version 7.0aa. Last change: 2006 Jan 11
*quickfix.txt* For Vim version 7.0aa. Last change: 2006 Jan 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -123,7 +123,7 @@ The following quickfix commands can be used:
A range can be specified for the lines to be used.
Otherwise all lines in the buffer are used.
*:cex* *:cexpr*
*:cex* *:cexpr* *E777*
:cex[pr][!] {expr} Create a quickfix list using the result of {expr} and
jump to the first error. If {expr} is a String, then
each new-line terminated line in the String is

View File

@@ -1,4 +1,4 @@
*spell.txt* For Vim version 7.0aa. Last change: 2006 Jan 11
*spell.txt* For Vim version 7.0aa. Last change: 2006 Jan 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -302,12 +302,12 @@ A spell file might not be available in the current 'encoding'. See
|spell-mkspell| about how to create a spell file. Converting a spell file
with "iconv" will NOT work!
*spell-sug-file*
*spell-sug-file* *E781*
If there is a file with exactly the same name as the ".spl" file but ending in
".sug", that file will be used for giving better suggestions. It isn't loaded
before suggestions are made to reduce memory use.
*E758* *E759*
*E758* *E759* *E778* *E779* *E780* *E782*
When loading a spell file Vim checks that it is properly formatted. If you
get an error the file may be truncated, modified or intended for another Vim
version.
@@ -1299,7 +1299,7 @@ You can include a space by using an underscore:
REP the_the the ~
SIMILAR CHARACTERS *spell-MAP*
SIMILAR CHARACTERS *spell-MAP* *E783*
In the affix file MAP items can be used to define letters that are very much
alike. This is mostly used for a letter with different accents. This is used

View File

@@ -1089,6 +1089,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
+multi_byte_ime various.txt /*+multi_byte_ime*
+multi_lang various.txt /*+multi_lang*
+mzscheme various.txt /*+mzscheme*
+mzscheme/dyn various.txt /*+mzscheme\/dyn*
+netbeans_intg various.txt /*+netbeans_intg*
+ole various.txt /*+ole*
+osfiletype various.txt /*+osfiletype*
@@ -1782,7 +1783,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:cabbrev map.txt /*:cabbrev*
:cabc map.txt /*:cabc*
:cabclear map.txt /*:cabclear*
:cadde quickfix.txt /*:cadde*
:cad quickfix.txt /*:cad*
:caddexpr quickfix.txt /*:caddexpr*
:caddf quickfix.txt /*:caddf*
:caddfile quickfix.txt /*:caddfile*
@@ -3791,7 +3792,16 @@ E770 spell.txt /*E770*
E771 spell.txt /*E771*
E772 spell.txt /*E772*
E773 recover.txt /*E773*
E774 map.txt /*E774*
E775 map.txt /*E775*
E777 quickfix.txt /*E777*
E778 spell.txt /*E778*
E779 spell.txt /*E779*
E78 motion.txt /*E78*
E780 spell.txt /*E780*
E781 spell.txt /*E781*
E782 spell.txt /*E782*
E783 spell.txt /*E783*
E79 message.txt /*E79*
E80 message.txt /*E80*
E800 arabic.txt /*E800*
@@ -4683,6 +4693,7 @@ design-not develop.txt /*design-not*
design-speed-size develop.txt /*design-speed-size*
desktop.vim syntax.txt /*desktop.vim*
develop-spell develop.txt /*develop-spell*
develop-spell-suggestions develop.txt /*develop-spell-suggestions*
develop.txt develop.txt /*develop.txt*
development develop.txt /*development*
dh change.txt /*dh*
@@ -5081,6 +5092,7 @@ ft-spec-plugin filetype.txt /*ft-spec-plugin*
ft-spup-syntax syntax.txt /*ft-spup-syntax*
ft-sql-syntax syntax.txt /*ft-sql-syntax*
ft-sqlinformix-syntax syntax.txt /*ft-sqlinformix-syntax*
ft-syntax-omni insert.txt /*ft-syntax-omni*
ft-tcsh-syntax syntax.txt /*ft-tcsh-syntax*
ft-termcap-syntax syntax.txt /*ft-termcap-syntax*
ft-tex-syntax syntax.txt /*ft-tex-syntax*
@@ -5860,6 +5872,7 @@ mysyntaxfile-replace syntax.txt /*mysyntaxfile-replace*
mzscheme if_mzsch.txt /*mzscheme*
mzscheme-buffer if_mzsch.txt /*mzscheme-buffer*
mzscheme-commands if_mzsch.txt /*mzscheme-commands*
mzscheme-dynamic if_mzsch.txt /*mzscheme-dynamic*
mzscheme-examples if_mzsch.txt /*mzscheme-examples*
mzscheme-sandbox if_mzsch.txt /*mzscheme-sandbox*
mzscheme-threads if_mzsch.txt /*mzscheme-threads*
@@ -6174,6 +6187,7 @@ pmbfn-option print.txt /*pmbfn-option*
popt-option print.txt /*popt-option*
popup-menu gui.txt /*popup-menu*
popup-menu-added version5.txt /*popup-menu-added*
popupmenu-completion insert.txt /*popupmenu-completion*
ports-5.2 version5.txt /*ports-5.2*
ports-6 version6.txt /*ports-6*
posix vi_diff.txt /*posix*
@@ -6482,35 +6496,73 @@ spec_chglog_release_info pi_spec.txt /*spec_chglog_release_info*
special-buffers windows.txt /*special-buffers*
speed-up tips.txt /*speed-up*
spell spell.txt /*spell*
spell-ACCENT spell.txt /*spell-ACCENT*
spell-BAD spell.txt /*spell-BAD*
spell-CHECKCOMPOUNDCASE spell.txt /*spell-CHECKCOMPOUNDCASE*
spell-CHECKCOMPOUNDDUP spell.txt /*spell-CHECKCOMPOUNDDUP*
spell-CHECKCOMPOUNDPATTERN spell.txt /*spell-CHECKCOMPOUNDPATTERN*
spell-CHECKCOMPOUNDREP spell.txt /*spell-CHECKCOMPOUNDREP*
spell-CHECKCOMPOUNDTRIPLE spell.txt /*spell-CHECKCOMPOUNDTRIPLE*
spell-CIRCUMFIX spell.txt /*spell-CIRCUMFIX*
spell-CMP spell.txt /*spell-CMP*
spell-COMMON spell.txt /*spell-COMMON*
spell-COMPLEXPREFIXES spell.txt /*spell-COMPLEXPREFIXES*
spell-COMPOUNDBEGIN spell.txt /*spell-COMPOUNDBEGIN*
spell-COMPOUNDEND spell.txt /*spell-COMPOUNDEND*
spell-COMPOUNDFLAG spell.txt /*spell-COMPOUNDFLAG*
spell-COMPOUNDFLAGS spell.txt /*spell-COMPOUNDFLAGS*
spell-COMPOUNDFORBIDFLAG spell.txt /*spell-COMPOUNDFORBIDFLAG*
spell-COMPOUNDMAX spell.txt /*spell-COMPOUNDMAX*
spell-COMPOUNDMIDDLE spell.txt /*spell-COMPOUNDMIDDLE*
spell-COMPOUNDMIN spell.txt /*spell-COMPOUNDMIN*
spell-COMPOUNDPERMITFLAG spell.txt /*spell-COMPOUNDPERMITFLAG*
spell-COMPOUNDROOT spell.txt /*spell-COMPOUNDROOT*
spell-COMPOUNDSYLLABLE spell.txt /*spell-COMPOUNDSYLLABLE*
spell-COMPOUNDSYLMAX spell.txt /*spell-COMPOUNDSYLMAX*
spell-COMPOUNDWORDMAX spell.txt /*spell-COMPOUNDWORDMAX*
spell-FLAG spell.txt /*spell-FLAG*
spell-FOL spell.txt /*spell-FOL*
spell-KEP spell.txt /*spell-KEP*
spell-FORBIDDENWORD spell.txt /*spell-FORBIDDENWORD*
spell-HOME spell.txt /*spell-HOME*
spell-KEEPCASE spell.txt /*spell-KEEPCASE*
spell-LANG spell.txt /*spell-LANG*
spell-LEMMA_PRESENT spell.txt /*spell-LEMMA_PRESENT*
spell-LOW spell.txt /*spell-LOW*
spell-MAP spell.txt /*spell-MAP*
spell-MAXNGRAMSUGS spell.txt /*spell-MAXNGRAMSUGS*
spell-NAME spell.txt /*spell-NAME*
spell-NEEDAFFIX spell.txt /*spell-NEEDAFFIX*
spell-NEEDCOMPOUND spell.txt /*spell-NEEDCOMPOUND*
spell-NOBREAK spell.txt /*spell-NOBREAK*
spell-NOSPLITSUGS spell.txt /*spell-NOSPLITSUGS*
spell-NOSUGFILE spell.txt /*spell-NOSUGFILE*
spell-NOSUGGEST spell.txt /*spell-NOSUGGEST*
spell-ONLYINCOMPOUND spell.txt /*spell-ONLYINCOMPOUND*
spell-PFX spell.txt /*spell-PFX*
spell-PFXPOSTPONE spell.txt /*spell-PFXPOSTPONE*
spell-RAR spell.txt /*spell-RAR*
spell-PSEUDOROOT spell.txt /*spell-PSEUDOROOT*
spell-RARE spell.txt /*spell-RARE*
spell-REP spell.txt /*spell-REP*
spell-SAL spell.txt /*spell-SAL*
spell-SET spell.txt /*spell-SET*
spell-SFX spell.txt /*spell-SFX*
spell-SLASH spell.txt /*spell-SLASH*
spell-SOFOFROM spell.txt /*spell-SOFOFROM*
spell-SOFOTO spell.txt /*spell-SOFOTO*
spell-SUGSWITHDOTS spell.txt /*spell-SUGSWITHDOTS*
spell-SYLLABLE spell.txt /*spell-SYLLABLE*
spell-SYLLABLENUM spell.txt /*spell-SYLLABLENUM*
spell-TRY spell.txt /*spell-TRY*
spell-UPP spell.txt /*spell-UPP*
spell-VERSION spell.txt /*spell-VERSION*
spell-WORDCHARS spell.txt /*spell-WORDCHARS*
spell-aff-format spell.txt /*spell-aff-format*
spell-affix-chars spell.txt /*spell-affix-chars*
spell-affix-comment spell.txt /*spell-affix-comment*
spell-affix-flags spell.txt /*spell-affix-flags*
spell-affix-mbyte spell.txt /*spell-affix-mbyte*
spell-affix-nocomp spell.txt /*spell-affix-nocomp*
spell-affix-not-supported spell.txt /*spell-affix-not-supported*
spell-affix-rare spell.txt /*spell-affix-rare*
spell-affix-vim spell.txt /*spell-affix-vim*
spell-compound spell.txt /*spell-compound*
@@ -6524,6 +6576,7 @@ spell-mkspell spell.txt /*spell-mkspell*
spell-quickstart spell.txt /*spell-quickstart*
spell-remarks spell.txt /*spell-remarks*
spell-russian spell.txt /*spell-russian*
spell-sug-file spell.txt /*spell-sug-file*
spell-syntax spell.txt /*spell-syntax*
spell-wordlist-format spell.txt /*spell-wordlist-format*
spell-yiddish spell.txt /*spell-yiddish*

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.0aa. Last change: 2006 Jan 12
*todo.txt* For Vim version 7.0aa. Last change: 2006 Jan 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -30,18 +30,6 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
Find E999 and hand out numbers.
Compress list of word numbers: sort them, computer differences, store as utf-8
bytes.
Undo bug: Gerald Lai Jan 3.
Syntax HL: when region start has an offset that happens to be after the end of
the line then strange things happen. (Brett Stahlman Dec 31)
Add Python complete script (Aaron Griffin)
Evaluating CTRL-R = in the sandbox causes trouble (G. Sumner Hayes). Can the
rules for the commandline window be used?
@@ -64,6 +52,13 @@ ccomplete:
away. How to figure out if it's a pointer or not?
- When a typedef or struct is local to a file only use it in that file?
- Extra info for each entry to show in a tooltip kind of thing.
Should use a dictionary for each entry. Fields could be:
word the completed word
menu menu text (use word when missing)
info extra info, to be displayed in balloon (e.g., function args)
kind single letter indicating the type of word:
v = variable, f = function/method, c = composite (object,
struct pointer).
- Special mappings for when the popup menu is visible? Would allow for making
a specific selection (e.g, methods vs variables).
- Provide a function to popup the menu, so that an insert mode mapping can
@@ -440,7 +435,7 @@ Add gui_mch_browsedir() for Motif, Mac OS/X.
Add extra list of file locations. A bit like the quickfix list, but there is
one per window. Can be used with:
:ltag list of matching tags, like :tselect
Patch from Yegappan Lakshmanan, Jan 9.
Patch from Yegappan Lakshmanan, Jan 13.
Commands to use the location list:
:lnext next location
:lprevious :lNext previous location

View File

@@ -1,4 +1,4 @@
*version7.txt* For Vim version 7.0aa. Last change: 2006 Jan 09
*version7.txt* For Vim version 7.0aa. Last change: 2006 Jan 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1545,4 +1545,17 @@ the dialog then Vim would insert <M-F4> in the text. Now it's ignored.
When ":silent! {cmd}" caused the swap file dialog, which isn't displayed,
there would still be a hit-enter prompt.
Requesting the termresponse (|t_RV|) early may cause problems with "-c"
arguments that invoke an external command or even "-c quit". Postpone it
until after executing "-c" arguments.
When typing in Insert mode so that a new line is started, using CTRL-G u to
break undo and start a new change, then joining the lines with <BS> caused
undo info to be missing. Now reset the insertion start point.
Syntax HL: When a region start match has a matchgroup and an offset that
happens to be after the end of the line then it continued in the next line and
stopped at the region end match, making the region continue after that.
Now check for the column being past the end of the line in syn_add_end_off().
vim:tw=78:ts=8:ft=help:norl:

View File

@@ -0,0 +1,30 @@
" Vim filetype plugin file
" Language: matlab
" Maintainer: Jake Wasserman <jwasserman at gmail dot com>
" Last Changed: 2006 Jan 12
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo-=C
if exists("loaded_matchit")
let s:conditionalEnd = '\(([^()]*\)\@!\<end\>\([^()]*)\)\@!'
let b:match_words = '\<if\>\|\<while\>\|\<for\>\|\<switch\>:' .
\ s:conditionalEnd . ',\<if\>:\<elseif\>:\<else\>:' .
\ s:conditionalEnd
endif
setlocal suffixesadd=.m
setlocal suffixes+=.asv
let b:undo_ftplugin = "setlocal suffixesadd< suffixes< "
\ . "| unlet! b:match_words"
let &cpo = s:save_cpo

View File

@@ -14,6 +14,8 @@ setlocal suffixesadd=.py
setlocal comments-=:%
setlocal commentstring=#%s
setlocal omnifunc=pycomplete#Complete
set wildignore+=*.pyc
nnoremap <silent> <buffer> ]] :call <SID>Python_jump('/^\(class\\|def\)')<cr>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.