diff options
28 files changed, 425 insertions, 82 deletions
diff --git a/runtime/autoload/pycomplete.vim b/runtime/autoload/pycomplete.vim new file mode 100644 index 000000000..8cd5a5f6d --- /dev/null +++ b/runtime/autoload/pycomplete.vim @@ -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: diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 4c527e1a1..dfab7c907 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -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 diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 85155b439..3f83a252d 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -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 diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 09eccb52e..f97e63407 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -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 diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index a2989d783..56365c7ae 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -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 diff --git a/runtime/doc/tags b/runtime/doc/tags index 187a06e1b..b585a8b49 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -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* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 542e6f133..8aa8299e9 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -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 diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index 560b7ffa3..36345b4f2 100644 --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -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: diff --git a/runtime/ftplugin/matlab.vim b/runtime/ftplugin/matlab.vim new file mode 100644 index 000000000..c75326677 --- /dev/null +++ b/runtime/ftplugin/matlab.vim @@ -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 + + + diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim index 4834b40ce..8e6a03f04 100644 --- a/runtime/ftplugin/python.vim +++ b/runtime/ftplugin/python.vim @@ -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> diff --git a/runtime/spell/en.ascii.spl b/runtime/spell/en.ascii.spl Binary files differindex 33cb8202a..876a75241 100644 --- a/runtime/spell/en.ascii.spl +++ b/runtime/spell/en.ascii.spl diff --git a/runtime/spell/en.ascii.sug b/runtime/spell/en.ascii.sug Binary files differindex a254ed27b..4b57555df 100644 --- a/runtime/spell/en.ascii.sug +++ b/runtime/spell/en.ascii.sug diff --git a/runtime/spell/en.latin1.spl b/runtime/spell/en.latin1.spl Binary files differindex 68cade004..23c120029 100644 --- a/runtime/spell/en.latin1.spl +++ b/runtime/spell/en.latin1.spl diff --git a/runtime/spell/en.latin1.sug b/runtime/spell/en.latin1.sug Binary files differindex 7aa6bb5fc..bb979a84d 100644 --- a/runtime/spell/en.latin1.sug +++ b/runtime/spell/en.latin1.sug diff --git a/runtime/spell/en.utf-8.spl b/runtime/spell/en.utf-8.spl Binary files differindex b0dd947eb..65b812a28 100644 --- a/runtime/spell/en.utf-8.spl +++ b/runtime/spell/en.utf-8.spl diff --git a/runtime/spell/en.utf-8.sug b/runtime/spell/en.utf-8.sug Binary files differindex 62f59e531..3e09e2b6e 100644 --- a/runtime/spell/en.utf-8.sug +++ b/runtime/spell/en.utf-8.sug diff --git a/src/Makefile b/src/Makefile index 810dd7b78..5236e9df2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -541,7 +541,7 @@ LINT_OPTIONS = -beprxzF # MEMORY LEAK DETECTION # Requires installing the ccmalloc library. -# Configuration is in the .ccmalloc file. +# Configuration is in the .ccmalloc or ~/.ccmalloc file. # Doesn't work very well, since memory linked to from global variables # (indirectly) is also marked as leaked memory. #PROFILE_CFLAGS = -DEXITFREE diff --git a/src/edit.c b/src/edit.c index c037d1f96..298ebc3c8 100644 --- a/src/edit.c +++ b/src/edit.c @@ -6527,6 +6527,10 @@ ins_ctrl_g() /* CTRL-G u: start new undoable edit */ case 'u': u_sync(); ins_need_undo = TRUE; + + /* Need to reset Insstart, esp. because a BS that joins + * aline to the previous one must save for undo. */ + Insstart = curwin->w_cursor; break; /* Unknown CTRL-G command, reserved for future expansion. */ diff --git a/src/main.c b/src/main.c index 551e980f9..fd85ea89d 100644 --- a/src/main.c +++ b/src/main.c @@ -844,6 +844,12 @@ main no_wait_return = FALSE; starting = 0; +#ifdef FEAT_TERMRESPONSE + /* Requesting the termresponse is postponed until here, so that a "-c q" + * argument doesn't make it appear in the shell Vim was started from. */ + may_req_termresponse(); +#endif + /* start in insert mode */ if (p_im) need_start_insertmode = TRUE; diff --git a/src/message.c b/src/message.c index 465b25e7e..1cea013d0 100644 --- a/src/message.c +++ b/src/message.c @@ -2188,7 +2188,6 @@ clear_sb_text() vim_free(last_msgchunk); last_msgchunk = mp; } - last_msgchunk = NULL; } /* diff --git a/src/misc1.c b/src/misc1.c index 08cd20c91..c45917401 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -3583,6 +3583,8 @@ expand_env_esc(srcp, dst, dstlen, esc, startstr) { struct passwd *pw; + /* Note: memory allocated by getpwnam() is never freed. + * Calling endpwent() apparently doesn't help. */ pw = getpwnam((char *)dst + 1); if (pw != NULL) var = (char_u *)pw->pw_dir; diff --git a/src/misc2.c b/src/misc2.c index f5b13e762..fb873fb4a 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1012,6 +1012,7 @@ free_all_mem() free_cd_dir(); set_expr_line(NULL); diff_clear(); + clear_sb_text(); /* free any scrollback text */ /* Free some global vars. */ vim_free(username); diff --git a/src/proto/term.pro b/src/proto/term.pro index f5bdfc4f9..91bb85c3c 100644 --- a/src/proto/term.pro +++ b/src/proto/term.pro @@ -33,6 +33,7 @@ void set_shellsize __ARGS((int width, int height, int mustset)); void settmode __ARGS((int tmode)); void starttermcap __ARGS((void)); void stoptermcap __ARGS((void)); +void may_req_termresponse __ARGS((void)); int swapping_screen __ARGS((void)); void setmouse __ARGS((void)); int mouse_has __ARGS((int c)); diff --git a/src/quickfix.c b/src/quickfix.c index f550f116a..35f278c2d 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -3001,7 +3001,7 @@ ex_cexpr(eap) qf_jump(0, 0, eap->forceit); /* display first error */ } else - EMSG(_("E999: String or List expected")); + EMSG(_("E777: String or List expected")); free_tv(tv); } } diff --git a/src/spell.c b/src/spell.c index a1ab89c82..9d8f2bf40 100644 --- a/src/spell.c +++ b/src/spell.c @@ -945,6 +945,10 @@ static char *e_affform = N_("E761: Format error in affix file FOL, LOW or UPP"); static char *e_affrange = N_("E762: Character in FOL, LOW or UPP is out of range"); static char *msg_compressing = N_("Compressing word tree..."); +/* Remember what "z?" replaced. */ +static char_u *repl_from = NULL; +static char_u *repl_to = NULL; + /* * Main spell-checking function. * "ptr" points to a character that could be the start of a word. @@ -1657,8 +1661,8 @@ find_word(mip, mode) } /* - * Return TRUE if "flags" is a valid sequence of compound flags and - * "word[len]" does not have too many syllables. + * Return TRUE if "flags" is a valid sequence of compound flags and "word" + * does not have too many syllables. */ static int can_compound(slang, word, flags) @@ -1884,7 +1888,7 @@ find_prefix(mip, mode) /* * Need to fold at least one more character. Do until next non-word character - * for efficiency. + * for efficiency. Include the non-word character too. * Return the length of the folded chars in bytes. */ static int @@ -1900,8 +1904,7 @@ fold_more(mip) mb_ptr_adv(mip->mi_fend); } while (*mip->mi_fend != NUL && spell_iswordp(mip->mi_fend, mip->mi_buf)); - /* Include the non-word character so that we can check for the - * word end. */ + /* Include the non-word character so that we can check for the word end. */ if (*mip->mi_fend != NUL) mb_ptr_adv(mip->mi_fend); @@ -2201,6 +2204,9 @@ spell_cat_line(buf, line, maxlen) } } +/* + * Structure used for the cookie argument of do_in_runtimepath(). + */ typedef struct spelload_S { char_u sl_lang[MAXWLEN + 1]; /* language name */ @@ -2246,7 +2252,7 @@ spell_load_lang(lang) lang, spell_enc(), lang); else if (sl.sl_slang != NULL) { - /* At least one file was loaded, now load all the additions. */ + /* At least one file was loaded, now load ALL the additions. */ STRCPY(fname_enc + STRLEN(fname_enc) - 3, "add.spl"); do_in_runtimepath(fname_enc, TRUE, spell_load_cb, &sl); } @@ -2469,7 +2475,8 @@ spell_load_cb(fname, cookie) * - To reload a spell file that was changed. "lang" is NULL and "old_lp" * points to the existing slang_T. * - Just after writing a .spl file; it's read back to produce the .sug file. - * "old_lp" is NULL and "lang" is a dummy name. Will allocate an slang_T. + * "old_lp" is NULL and "lang" is NULL. Will allocate an slang_T. + * * Returns the slang_T the spell file was loaded into. NULL for error. */ static slang_T * @@ -2686,7 +2693,7 @@ truncerr: goto someerror; /* For a new file link it in the list of spell files. */ - if (old_lp == NULL) + if (old_lp == NULL && lang != NULL) { lp->sl_next = first_lang; first_lang = lp; @@ -4358,6 +4365,11 @@ spell_free_all() } init_spell_chartab(); + + vim_free(repl_to); + repl_to = NULL; + vim_free(repl_from); + repl_from = NULL; } # endif @@ -4423,7 +4435,7 @@ spell_reload_one(fname, added_word) } /* When "zg" was used and the file wasn't loaded yet, should redo - * 'spelllang' to get it loaded. */ + * 'spelllang' to load it now. */ if (added_word && !didit) did_set_spelllang(curbuf); } @@ -7875,9 +7887,6 @@ spell_make_sugfile(spin, wfname) slang = spell_load_file(wfname, NULL, NULL, FALSE); if (slang == NULL) return; - /* don't want this language in the list */ - if (first_lang == slang) - first_lang = slang->sl_next; free_slang = TRUE; } @@ -9339,10 +9348,6 @@ spell_check_sps() return OK; } -/* Remember what "z?" replaced. */ -static char_u *repl_from = NULL; -static char_u *repl_to = NULL; - /* * "z?": Find badly spelled word under or after the cursor. * Give suggestions for the properly spelled word. @@ -9720,22 +9725,22 @@ spell_suggest_list(gap, word, maxcount, need_cap, interactive) /* Make room in "gap". */ ga_init2(gap, sizeof(char_u *), sug.su_ga.ga_len + 1); - if (ga_grow(gap, sug.su_ga.ga_len) == FAIL) - return; - - for (i = 0; i < sug.su_ga.ga_len; ++i) + if (ga_grow(gap, sug.su_ga.ga_len) == OK) { - stp = &SUG(sug.su_ga, i); + for (i = 0; i < sug.su_ga.ga_len; ++i) + { + stp = &SUG(sug.su_ga, i); - /* The suggested word may replace only part of "word", add the not - * replaced part. */ - wcopy = alloc(stp->st_wordlen + /* The suggested word may replace only part of "word", add the not + * replaced part. */ + wcopy = alloc(stp->st_wordlen + STRLEN(sug.su_badptr + stp->st_orglen) + 1); - if (wcopy == NULL) - break; - STRCPY(wcopy, stp->st_word); - STRCPY(wcopy + stp->st_wordlen, sug.su_badptr + stp->st_orglen); - ((char_u **)gap->ga_data)[gap->ga_len++] = wcopy; + if (wcopy == NULL) + break; + STRCPY(wcopy, stp->st_word); + STRCPY(wcopy + stp->st_wordlen, sug.su_badptr + stp->st_orglen); + ((char_u **)gap->ga_data)[gap->ga_len++] = wcopy; + } } spell_find_cleanup(&sug); @@ -10110,20 +10115,20 @@ suggest_load_files() buf[i] = getc(fd); /* <fileID> */ if (STRNCMP(buf, VIMSUGMAGIC, VIMSUGMAGICL) != 0) { - EMSG2(_("E999: This does not look like a .sug file: %s"), + EMSG2(_("E778: This does not look like a .sug file: %s"), slang->sl_fname); goto nextone; } c = getc(fd); /* <versionnr> */ if (c < VIMSUGVERSION) { - EMSG2(_("E999: Old .sug file, needs to be updated: %s"), + EMSG2(_("E779: Old .sug file, needs to be updated: %s"), slang->sl_fname); goto nextone; } else if (c > VIMSUGVERSION) { - EMSG2(_("E999: .sug file is for newer version of Vim: %s"), + EMSG2(_("E780: .sug file is for newer version of Vim: %s"), slang->sl_fname); goto nextone; } @@ -10135,7 +10140,7 @@ suggest_load_files() timestamp += getc(fd) << (i * 8); if (timestamp != slang->sl_sugtime) { - EMSG2(_("E999: .sug file doesn't match .spl file: %s"), + EMSG2(_("E781: .sug file doesn't match .spl file: %s"), slang->sl_fname); goto nextone; } @@ -10148,7 +10153,7 @@ suggest_load_files() FALSE, 0) != 0) { someerror: - EMSG2(_("E999: error while reading .sug file: %s"), + EMSG2(_("E782: error while reading .sug file: %s"), slang->sl_fname); slang_clear_sug(slang); goto nextone; @@ -12786,7 +12791,7 @@ set_map_str(lp, map) { /* This should have been checked when generating the .spl * file. */ - EMSG(_("E999: duplicate char in MAP entry")); + EMSG(_("E783: duplicate char in MAP entry")); vim_free(b); } } @@ -13026,7 +13031,7 @@ add_banned(su, word) suginfo_T *su; char_u *word; { - char_u *s = vim_strsave(word); + char_u *s; hash_T hash; hashitem_T *hi; @@ -14888,7 +14893,7 @@ dump_prefixes(slang, word, dumpflags, flags, startlnum) int len; int i; - /* if the word starts with a lower-case letter make the word with an + /* If the word starts with a lower-case letter make the word with an * upper-case letter in word_up[]. */ c = PTR2CHAR(word); if (SPELL_TOUPPER(c) != c) @@ -14973,7 +14978,8 @@ dump_prefixes(slang, word, dumpflags, flags, startlnum) } /* - * Move "p" to end of word. + * Move "p" to the end of word "start". + * Uses the spell-checking word characters. */ char_u * spell_to_word_end(start, buf) @@ -14989,10 +14995,10 @@ spell_to_word_end(start, buf) #if defined(FEAT_INS_EXPAND) || defined(PROTO) /* - * Find start of the word in front of the cursor. We don't check if it is - * badly spelled, with completion we can only change the word in front of the - * cursor. - * Used for Insert mode completion CTRL-X ?. + * For Insert mode completion CTRL-X s: + * Find start of the word in front of column "startcol". + * We don't check if it is badly spelled, with completion we can only change + * the word in front of the cursor. * Returns the column number of the word. */ int diff --git a/src/syntax.c b/src/syntax.c index 01a476e69..1c093a0be 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -2956,6 +2956,7 @@ syn_add_end_off(result, regmatch, spp, idx, extra) int extra; /* extra chars for offset to start */ { int col; + int len; if (spp->sp_off_flags & (1 << idx)) { @@ -2971,7 +2972,15 @@ syn_add_end_off(result, regmatch, spp, idx, extra) if (col < 0) result->col = 0; else - result->col = col; + { + /* Don't go past the end of the line. Matters for "rs=e+2" when there + * is a matchgroup. */ + len = STRLEN(ml_get_buf(syn_buf, result->lnum, FALSE)); + if (col > len) + result->col = len; + else + result->col = col; + } } /* diff --git a/src/term.c b/src/term.c index cc3c0365a..1f2753368 100644 --- a/src/term.c +++ b/src/term.c @@ -88,9 +88,6 @@ static void check_for_codes_from_term __ARGS((void)); || (defined(FEAT_MOUSE) && (!defined(UNIX) || defined(FEAT_MOUSE_XTERM))) static int get_bytes_from_buf __ARGS((char_u *, char_u *, int)); #endif -#ifdef FEAT_TERMRESPONSE -static void may_req_termresponse __ARGS((void)); -#endif static void del_termcode_idx __ARGS((int idx)); static int term_is_builtin __ARGS((char_u *name)); static int term_7to8bit __ARGS((char_u *p)); @@ -3249,11 +3246,13 @@ stoptermcap() } } -#ifdef FEAT_TERMRESPONSE +#if defined(FEAT_TERMRESPONSE) || defined(PROTO) /* * Request version string (for xterm) when needed. * Only do this after switching to raw mode, otherwise the result will be * echoed. + * Only do this after startup has finished, to avoid that the response comes + * while excuting "-c !cmd" or even after "-c quit". * Only do this after termcap mode has been started, otherwise the codes for * the cursor keys may be wrong. * Only do this when 'esckeys' is on, otherwise the response causes trouble in @@ -3262,17 +3261,18 @@ stoptermcap() * request to terminal while reading from a file). * The result is caught in check_termcode(). */ - static void + void may_req_termresponse() { if (crv_status == CRV_GET && cur_tmode == TMODE_RAW + && starting == 0 && termcap_active && p_ek -#ifdef UNIX +# ifdef UNIX && isatty(1) && isatty(read_cmd_fd) -#endif +# endif && *T_CRV != NUL) { out_str(T_CRV); diff --git a/src/version.h b/src/version.h index 447f4fa0b..7319ff93f 100644 --- a/src/version.h +++ b/src/version.h @@ -36,5 +36,5 @@ #define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_MEDIUM "7.0aa ALPHA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 12)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 12, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 13)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 13, compiled " |