updated for version 7.0072

This commit is contained in:
Bram Moolenaar
2005-05-18 22:24:46 +00:00
parent a7fc0101b2
commit 34cdc3e329
18 changed files with 1291 additions and 685 deletions

View File

@ -1,4 +1,4 @@
*syntax.txt* For Vim version 7.0aa. Last change: 2005 Apr 01
*syntax.txt* For Vim version 7.0aa. Last change: 2005 May 18
VIM REFERENCE MANUAL by Bram Moolenaar
@ -1579,6 +1579,14 @@ $VIMRUNTIME/syntax/syntax.vim).
mv_finance mv_logic mv_powseries
MATHEMATICA *mma.vim* *mma-syntax* *mathematica-syntax*
Empty *.m files will automatically be presumed to be Matlab files unless you
have the following in your .vimrc: >
let filetype_m = "mma"
MOO *moo.vim* *moo-syntax*
If you use C-style comments inside expressions and find it mangles your

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.0aa. Last change: 2005 Apr 24
*todo.txt* For Vim version 7.0aa. Last change: 2005 May 18
VIM REFERENCE MANUAL by Bram Moolenaar
@ -30,33 +30,46 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
This doesn't work: "a[var1:var2]". Requires space before/after ':'. Can this
be fixed? Otherwise document it.
regmatch(): "regstack" could start with a fixed block of data for speed.
"backpos" is never freed. (Alexei Alexandrov)
Starting without any buffers, set nocp, ":b <Tab>" gives error message.
(Ciaran McCressh for Aron Griffis)
Problem with 'insertmode'. (Georg Dahn, 2005 April 9, expl. April 14)
Problem with CTRL-V pasting more than one line. (Georg Dahn, 2005 April 11)
Patch for setqflist() (Yegappan Lakshmanan, 2005 April 11)
":help \=<Tab>" doesn't find "sub-replace-\=".
In an errorfile expand "~/" to home directory. (Arnout Engelen)
Patch for 2html.vim to disable folding (Michael Schaap, 2005 April 12)
Win32: Alt-F10 no longer working? (Bill McCarthy, April 18)
Patch for if_python to make exit work better with threads. (ugo)
With "wa" in 'formatoptions', backspace at start-of-line doesn't work. It
should delete the space at the end of the previous line. (Alan Isaac)
GTK GUI: Running a script that does :vsp and :quit, causing the left scrollbar
to appear and disappear, causes resizing. (gvcolors.vim from Charles Campbell,
2005 April 25)
Problem with ":mksession" for "vim -o "+argdel *" prog1 prog2 prog3"
(Bill McCarthy, 2005 April 26)
getreg('=') returns the result of evaluating the expression. How to get the
expression itself, so that it can be restored? (David Fishburn) Perhaps use
getreg('=', 1). Also make setreg('=') work then.
Win32: With the taskbar at the top of the screen, scrolling doesn't redraw
properly. (Sergey Khorev, 2005 April 27)
Mac unicode patch (Da Woon Jung):
- selecting proportional font breaks display
- UTF-8 text causes display problems. Font replacement causes this.
When 'shortmess' is empty and 'keymap' set to accents, in Insert mode CTRL-N
may cause the hit-enter prompt. Typing 'a then doesn't result in the accented
character. (Ilya Dogolazky)
autoload:
- Add a Vim script in $VIMRUNTIME/tools that takes a file with a list of
script names and a help file and produces a script that can be sourced to
@ -74,9 +87,17 @@ Win32: Balloon text can't contain line break.
Add has("balloon_multiline")
setline() should accept a List.
smsg() uses IObuff. The checks for the result not fitting are complicated,
find another solution. Add vsnprintf() and snprintf() functions?
http://www.ijs.si/software/snprintf/
Add ":[range]sort" command. Sort on specified field, using a regexp? Remove
duplicates?
Patch to alternate fold highlighting. (Anthony Iano-Fletcher, 2005 May 12)
More levels?
Awaiting response:
- Patch for mch_FullName() also in Vim 6.3? os_mswin.c
- Win32: tearoff menu window should have a scrollbar when it's taller than
@ -90,6 +111,8 @@ PLANNED FOR VERSION 7.0:
- Add SPELLCHECKER, with support for many languages.
- Use "engspchk" from Charles Campbell for ideas.
- Is it worth trying the trie structure (see code from Olaf Seibert, 2005
May 9)
- Spell checking code todo's:
- Implement user and project word lists. Commands to add words and to
mark words as wrong.
@ -265,6 +288,9 @@ PLANNED FOR VERSION 7.0:
Adjust src/main.aap for installing manpages like in Makefile.
Also generate the .pdb file that can be used to generate a useful crash report
on MS-Windows. (George Reilly)
Add strtol() to avoid the problems with leading zero causing octal conversion.
Try new POSIX tests, made after my comments. (Geoff Clare, 2005 April 7)
@ -323,8 +349,6 @@ Updated Ruby interface. (Ryan Paul)
Awaiting updated patches:
--- awaiting updated patch ---
8 Add GTK 2.3 file dialog support. Patch by Grahame Bowland, 2004 Mar
15, but it doesn't use "initdir" or "dflt". (will update patch)
8 Add ":n" to fnamemodify(): normalize path, remove "../" when possible.
Aric Blumer has a patch for this.
He will update the patch for 6.3.
@ -2104,6 +2128,7 @@ Autocommands:
changing the buffer name.
8 Add ScriptReadCmd event: used to load remote Vim scripts, e.g.
"vim -u http://mach/path/vimrc".
7 Add TagJump event: do something after jumping to a tag.
8 Use another option than 'updatetime' for the CursorHold event. The two
things are unrelated for the user (but the implementation is more
difficult).
@ -2786,7 +2811,7 @@ Searching:
7 From xvim: Allow a newline in search patterns (also for :s, can delete
newline). Add BOW, EOW, NEWL, NLORANY, NLBUTANY, magic 'n' and 'r', etc.
[not in xvim:] Add option to switch on matches crossing ONE line boundary.
7 Add ":iselect", a combination of ":ilist" and ":tselect". (Aaron)
7 Add ":iselect", a combination of ":ilist" and ":tselect". (Aaron) (Zellner)
Also ":dselect".
@ -3334,8 +3359,6 @@ Various improvements:
changes all together instead of for each command (e.g. for the rot13
macro).
- Add command like "[I" that also shows the tree of included files.
- Add command like ":ts" that shows the output of "[I" and asks for a match
to jump to. (Zellner)
- ":set sm^L" results in ":set s", because short names of options are also
expanded. Is there a better way to do this?
- Add ":@!" command, to ":@" like what ":source!" is to ":source".

View File

@ -400,13 +400,13 @@ N *+X11* Unix only: can restore window title |X11|
:redi[r] @{a-zA-Z} Redirect messages to register {a-z}. Append to the
contents of the register if its name is given
uppercase {A-Z}. {not in Vi}
:redi[r] @{a-z}> Append messages to register {a-z}. {not in Vi}
:redi[r] @{a-z}>> Append messages to register {a-z}. {not in Vi}
:redi[r] @* Redirect messages to the clipboard. {not in Vi}
:redi[r] @*> Append messages to the clipboard. {not in Vi}
:redi[r] @*>> Append messages to the clipboard. {not in Vi}
:redi[r] @" Redirect messages to the unnamed register. {not in Vi}
:redi[r] @"> Append messages to the unnamed register. {not in Vi}
:redi[r] @">> Append messages to the unnamed register. {not in Vi}
:redi[r] => {var} Redirect messages to a variable. If the variable
doesn't exist, then it is created. If the variable

View File

@ -1,4 +1,4 @@
*version7.txt* For Vim version 7.0aa. Last change: 2005 Apr 24
*version7.txt* For Vim version 7.0aa. Last change: 2005 May 18
VIM REFERENCE MANUAL by Bram Moolenaar
@ -619,6 +619,9 @@ window.
Added the "%s" item to 'errorformat'. (Yegappan Lakshmanan)
GTK GUI: use the GTK file dialog when it's available. Mix from patches by
Grahame Bowland and Evan Webb.
==============================================================================
COMPILE TIME CHANGES *compile-changes-7*
@ -1059,4 +1062,10 @@ we find the same position again and advance one character.
When in diff mode and making a change that causes the "changed" highlighting
to disappear or reappear, it was still highlighted in another window.
When a ":next" command fails because the user selects "Abort" at the ATTENTION
prompt the argument index was advanced anyway.
When "~" is in 'iskeyword' the "gd" doesn't work, it's used for the previous
substitute pattern. Put "\V" in the pattern to avoid that.
vim:tw=78:ts=8:ft=help:norl:

View File

@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2005 Apr 13
" Last Change: 2005 May 18
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@ -822,7 +822,11 @@ fun! s:FTm()
endif
let n = n + 1
endwhile
setf matlab
if exists("g:filetype_m")
exe "setf " . g:filetype_m
else
setf matlab
endif
endfun
" Maya Extension Language
@ -1435,8 +1439,14 @@ au BufNewFile,BufRead *.il setf skill
au BufNewFile,BufRead .slrnrc setf slrnrc
au BufNewFile,BufRead *.score setf slrnsc
" Smalltalk
au BufNewFile,BufRead *.st,*.cls setf st
" Smalltalk (and TeX)
au BufNewFile,BufRead *.st setf st
au BufNewFile,BufRead *.cls
\ if getline(1) =~ '^%' |
\ setf tex |
\ else |
\ setf st |
\ endif
" Smarty templates
au BufNewFile,BufRead *.tpl setf smarty

75
runtime/indent/mma.vim Normal file
View File

@ -0,0 +1,75 @@
" Vim indent file
" Language: Mathematica
" Author: steve layland <layland@wolfram.com>
" Last Change: Sat May 10 18:56:22 CDT 2005
" Source: http://vim.sourceforge.net/scripts/script.php?script_id=1274
" http://members.wolfram.com/layland/vim/indent/mma.vim
"
" NOTE:
" Empty .m files will automatically be presumed to be Matlab files
" unless you have the following in your .vimrc:
"
" let filetype_m="mma"
"
" Credits:
" o steve hacked this out of a random indent file in the Vim 6.1
" distribution that he no longer remembers...sh.vim? Thanks!
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetMmaIndent()
setlocal indentkeys+=0[,0],0(,0)
setlocal nosi "turn off smart indent so we don't over analyze } blocks
if exists("*GetMmaIndent")
finish
endif
function GetMmaIndent()
" Hit the start of the file, use zero indent.
if v:lnum == 0
return 0
endif
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)
" use indenting as a base
let ind = indent(v:lnum)
let lnum = v:lnum
" if previous line has an unmatched bracket, or ( indent.
" doesn't do multiple parens/blocks/etc...
" also, indent only if this line if this line isn't starting a new
" block... TODO - fix this with indentkeys?
if getline(v:lnum-1) =~ '\\\@<!\%(\[[^\]]*\|([^)]*\|{[^}]*\)$' && getline(v:lnum) !~ '\s\+[\[({]'
let ind = ind+&sw
endif
" if this line had unmatched closing block,
" indent to the matching opening block
if getline(v:lnum) =~ '[^[]*]\s*$'
" move to the closing bracket
call search(']','bW')
" and find it's partner's indent
let ind = indent(searchpair('\[','',']','bWn'))
" same for ( blocks
elseif getline(v:lnum) =~ '[^(]*)$'
call search(')','bW')
let ind = indent(searchpair('(','',')','bWn'))
" and finally, close { blocks if si ain't already set
elseif getline(v:lnum) =~ '[^{]*}'
call search('}','bW')
let ind = indent(searchpair('{','','}','bWn'))
endif
return ind
endfunction

View File

@ -1,6 +1,6 @@
" Vim plugin for editing compressed files.
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2005 Mar 24
" Last Change: 2005 May 18
" Exit quickly when:
" - this plugin was already loaded
@ -48,12 +48,41 @@ fun s:check(cmd)
exe "return s:have_" . name
endfun
" Set b:gzip_comp_arg to the gzip argument to be used for compression, based on
" the flags in the compressed file.
" The only compression methods that can be detected are max speed (-1) and max
" compression (-9).
fun s:set_compression(line)
" get the Compression Method
let l:cm = char2nr(a:line[2])
" if it's 8 (DEFLATE), we can check for the compression level
if l:cm == 8
" get the eXtra FLags
let l:xfl = char2nr(a:line[8])
" max compression
if l:xfl == 2
let b:gzip_comp_arg = "-9"
" min compression
elseif l:xfl == 4
let b:gzip_comp_arg = "-1"
endif
endif
endfun
" After reading compressed file: Uncompress text in buffer with "cmd"
fun s:read(cmd)
" don't do anything if the cmd is not supported
if !s:check(a:cmd)
return
endif
" for gzip check current compression level and set b:gzip_comp_arg.
silent! unlet b:gzip_comp_arg
if a:cmd[0] == 'g'
call s:set_compression(getline(1))
endif
" make 'patchmode' empty, we don't want a copy of the written file
let pm_save = &pm
set pm=
@ -121,7 +150,11 @@ fun s:write(cmd)
let nm = resolve(expand("<afile>"))
let nmt = s:tempname(nm)
if rename(nm, nmt) == 0
call system(a:cmd . " " . nmt)
if exists("b:gzip_comp_arg")
call system(a:cmd . " " . b:gzip_comp_arg . " " . nmt)
else
call system(a:cmd . " " . nmt)
endif
call rename(nmt . "." . expand("<afile>:e"), nm)
endif
endif
@ -131,8 +164,15 @@ endfun
fun s:appre(cmd)
" don't do anything if the cmd is not supported
if s:check(a:cmd)
" Rename to a weird name to avoid the risk of overwriting another file
let nm = expand("<afile>")
" for gzip check current compression level and set b:gzip_comp_arg.
silent! unlet b:gzip_comp_arg
if a:cmd[0] == 'g'
call s:set_compression(readfile(nm, "b", 1)[0])
endif
" Rename to a weird name to avoid the risk of overwriting another file
let nmt = expand("<afile>:p:h") . "/X~=@l9q5"
let nmte = nmt . "." . expand("<afile>:e")
if rename(nm, nmte) == 0

View File

@ -1,41 +1,229 @@
" Vim syntax file
" Language: Mathematica
" Maintainer: Wolfgang Waltenberger <wwalten@ben.tuwien.ac.at>
" Last Change: Thu 26 Apr 2001 13:20:03 CEST
" Maintainer: steve layland <layland@wolfram.com>
" Last Change: Tue May 10 18:31:00 CDT 2005
" Source: http://vim.sourceforge.net/scripts/script.php?script_id=1273
" http://members.wri.com/layland/vim/syntax/mma.vim
"
" NOTE:
" Empty .m files will automatically be presumed as Matlab files
" unless you have the following in your .vimrc:
"
" let filetype_m="mma"
"
" I also recommend setting the default 'Comment' hilighting to something
" other than the color used for 'Function', since both are plentiful in
" most mathematica files, and they are often the same color (when using
" background=dark). I use
"
" hi Comment ctermfg=darkcyan
"
" darkgreen also looks good on my terminal.
"
" Credits:
" o Original Mathematica syntax version written by
" Wolfgang Waltenberger <wwalten@ben.tuwien.ac.at>
" o Some ideas like the CommentStar,CommentTitle were adapted
" from the Java vim syntax file by Claudio Fleiner. Thanks!
" o Everything else written by steve <layland@wolfram.com>
"
" TODO:
" folding
" fix nesting
" finish populating popular symbols
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
finish
endif
syn match mmaError "\*)"
syn match mmaFixme "FIXME"
syn region mmaComment start=+(\*+ end=+\*)+ skipempty contains=mmaFixme
syn match mmaMessage "\a*::\a*"
syn region mmaString start=+'+ end=+'+
syn region mmaString start=+"+ end=+"+
syn region mmaString start=+\\\"+ end=+\"+
syn region mmaString start=+\"+ end=+\"+
" Group Definitions:
syntax cluster mmaNotes contains=mmaTodo,mmaFixme
syntax cluster mmaComments contains=mmaComment,mmaFunctionComment,mmaItem,mmaFunctionTitle,mmaCommentStar
syntax cluster mmaCommentStrings contains=mmaLooseQuote,mmaCommentString,mmaUnicode
syntax cluster mmaStrings contains=@mmaCommentStrings,mmaString
syntax cluster mmaTop contains=mmaOperator,mmaGenericFunction,mmaPureFunction,mmaVariable
syn match mmaVariable "$\a*"
" Variables:
" Dollar sign variables
syntax match mmaVariable "$\a\+\d*"
" Preceding contexts
syntax match mmaVariable "`\=\a\+\d*`"
syn match mmaPattern "[A-Za-z01-9`]*_\{1,3}"
syn match mmaPattern "[A-Za-z01-9`]*_\{1,3}\(Integer\|Real\|Pattern\|Symbol\)"
syn match mmaPattern "[A-Za-z01-9`]*_\{1,3}\(Rational\|Complex\|Head\)"
syn match mmaPattern "[A-Za-z01-9`]*_\{1,3}?[A-Za-z01-9`]*"
" Numbers:
syntax match mmaNumber "\<\%(\d\+\.\=\d*\|\d*\.\=\d\+\)\>"
syntax match mmaNumber "`\d\+\>"
" prefix/infix/postfix notations
syn match mmaGenericFunction "[A-Za-z01-9`]*\s*\(\[\|@\)"he=e-1
syn match mmaGenericFunction "[A-Za-z01-9`]*\s*\(/@\|@@\)"he=e-2
syn match mmaGenericFunction "\~\s*[A-Za-z01-9`]*\s*\~"hs=s+1,he=e-1
syn match mmaGenericFunction "//\s*[A-Za-z01-9`]*"hs=s+2
syn match mmaOperator "/;"
" Predefined Constants:
" to list all predefined Symbols would be too insane...
" it's probably smarter to define a select few, and get the rest from
" context if absolutely necessary.
" TODO - populate this with other often used Symbols
syn match mmaPureFunction "#\d*"
syn match mmaPureFunction "&"
" standard fixed symbols:
syntax keyword mmaVariable True False None Automatic All Null C General
syn match mmaUnicode "\\\[[a-zA-Z01-9]*\]"
" mathematical constants:
syntax keyword mmaVariable Pi I E Infinity ComplexInfinity Indeterminate GoldenRatio EulerGamma Degree Catalan Khinchin Glaisher
" stream data / atomic heads:
syntax keyword mmaVariable Byte Character Expression Number Real String Word EndOfFile Integer Symbol
" sets:
syntax keyword mmaVariable Integers Complexes Reals Booleans Rationals
" character classes:
syntax keyword mmaPattern DigitCharacter LetterCharacter WhitespaceCharacter WordCharacter EndOfString StartOfString EndOfLine StartOfLine WordBoundary
" SelectionMove directions/units:
syntax keyword mmaVariable Next Previous After Before Character Word Expression TextLine CellContents Cell CellGroup EvaluationCell ButtonCell GeneratedCell Notebook
syntax keyword mmaVariable CellTags CellStyle CellLabel
" TableForm positions:
syntax keyword mmaVariable Above Below Left Right
" colors:
syntax keyword mmaVariable Black Blue Brown Cyan Gray Green Magenta Orange Pink Purple Red White Yellow
" function attributes
syntax keyword mmaVariable Protected Listable OneIdentity Orderless Flat Constant NumericFunction Locked ReadProtected HoldFirst HoldRest HoldAll HoldAllComplete SequenceHold NHoldFirst NHoldRest NHoldAll Temporary Stub
" Strings:
" "string"
" 'string' is not accepted (until literal strings are supported!)
syntax region mmaString start=+\\\@<!"+ skip=+\\\@<!\\\%(\\\\\)*"+ end=+"+
syntax region mmaCommentString oneline start=+\\\@<!"+ skip=+\\\@<!\\\%(\\\\\)*"+ end=+"+ contained
" Function Usage Messages:
" "SymbolName::item"
syntax match mmaMessage "$\=\a\+\d*::\a\+\d*"
" Pure Functions:
syntax match mmaPureFunction "#\%(#\|\d\+\)\="
syntax match mmaPureFunction "&"
" Named Functions:
" Since everything is pretty much a function, get this straight
" from context
syntax match mmaGenericFunction "[A-Za-z0-9`]\+\s*\%([@[]\|/:\|/\=/@\)\@=" contains=mmaOperator
syntax match mmaGenericFunction "\~\s*[^~]\+\s*\~"hs=s+1,he=e-1 contains=mmaOperator,mmaBoring
syntax match mmaGenericFunction "//\s*[A-Za-z0-9`]\+"hs=s+2 contains=mmaOperator
" Comment Keywords:
syntax keyword mmaTodo TODO NOTE HEY contained
syntax match mmaTodo "X\{3,}" contained
syntax keyword mmaFixme FIX[ME] FIXTHIS BROKEN contained
" yay pirates...
syntax match mmaFixme "\%(Y\=A\+R\+G\+\|GRR\+\|CR\+A\+P\+\)\%(!\+\)\=" contained
syntax match mmaemPHAsis "\(_\+\)[ a-zA-Z0-9]\+\1" contained
" Comment Sections:
" this:
" :that:
syntax match mmaItem "\%(^[( |*\t]*\)\@<=\%(:\+\|\a\)[a-zA-Z0-9 ]\+:" contained contains=@mmaNotes
" Actual Mathematica Comments:
" (* *)
" allow nesting (* (* *) *) even though the frontend
" won't always like it.
syntax region mmaComment start=+(\*+ end=+\*)+ skipempty contains=@mmaNotes,mmaItem,@mmaCommentStrings,mmaemPHAsis,mmaComment
" Function Comments:
" just like a normal comment except the first sentance is Special ala Java
" (** *)
" TODO - fix this for nesting, or not...
syntax region mmaFunctionComment start="(\*\*\+" end="\*\+)" contains=@mmaNotes,mmaItem,mmaFunctionTitle,@mmaCommentStrings,mmaemPHAsis,mmaComment
syntax region mmaFunctionTitle contained matchgroup=mmaFunctionComment start="\%((\*\*[ *]*\)" matchgroup=mmaFunctionTitle keepend end=".[.!-]\=\s*$" end="[.!-][ \t\r<&]"me=e-1 end="\%(\*\+)\)\@=" contained contains=@mmaNotes,mmaItem,mmaCommentStar
" catch remaining (**********)'s
syntax match mmaComment "(\*\*\+)"
" catch preceding *
syntax match mmaCommentStar "^\s*\*\+" contained
" Patterns:
" Each pattern marker below can be Blank[] (_), BlankSequence[] (__)
" or BlankNullSequence[] (___). Most examples below can also be
" combined, for example Pattern tests with Default values.
"
" _Head Anonymous patterns
" name_Head
" name:(_Head|_Head2) Named patterns
"
" _Head : val
" name:_Head:val Default values
"
" _Head?testQ,
" _Head?(test[#]&) Pattern tests
"
" name_Head/;test[name] Conditionals
"
" _Head:. Predefined Default
"
" .. ... Pattern Repeat
syntax match mmaPatternError "\%(_\{4,}\|)\s*&\s*)\@!\)" contained
"pattern name:
syntax match mmaPattern "[A-Za-z0-9`]\+\s*:\+[=>]\@!" contains=mmaOperator
"pattern default:
syntax match mmaPattern ": *[^ ,]\+[\], ]\@=" contains=@mmaCommentStrings,@mmaTop,mmaOperator
"pattern head/test:
syntax match mmaPattern "[A-Za-z0-9`]*_\+\%(\a\+\)\=\%(?([^)]\+)\|?[^\]},]\+\)\=" contains=@mmaTop,@mmaCommentStrings,mmaPatternError
" Operators:
" /: ^= ^:= UpValue
" /; Conditional
" := = DownValue
" == === ||
" != =!= && Logic
" >= <= < >
" += -= *=
" /= ++ -- Math
" ^*
" -> :> Rules
" @@ @@@ Apply
" /@ //@ Map
" /. //. Replace
" // @ Function application
" <> ~~ String/Pattern join
" ~ infix operator
" . : Pattern operators
syntax match mmaOperator "\%(@\{1,3}\|//[.@]\=\)"
syntax match mmaOperator "\%(/[;:@.]\=\|\^\=:\==\)"
syntax match mmaOperator "\%([-:=]\=>\|<=\=\)"
"syntax match mmaOperator "\%(++\=\|--\=\|[/+-*]=\|[^*]\)"
syntax match mmaOperator "[*+=^.:?-]"
syntax match mmaOperator "\%(\~\~\=\)"
syntax match mmaOperator "\%(=\{2,3}\|=\=!=\|||\=\|&&\|!\)" contains=ALLBUT,mmaPureFunction
" Special Characters:
" \[Name] named character
" \ooo octal
" \.xx 2 digit hex
" \:xxxx 4 digit hex (multibyte unicode)
syntax match mmaUnicode "\\\[\w\+\d*\]"
syntax match mmaUnicode "\\\%(\x\{3}\|\.\x\{2}\|:\x\{4}\)"
" Syntax Errors:
syntax match mmaError "\*)" containedin=ALLBUT,@mmaComments,@mmaStrings
syntax match mmaError "\%([&:|+*/?~-]\{3,}\|[.=]\{4,}\|_\@<=\.\{2,}\|`\{2,}\)" containedin=ALLBUT,@mmaComments,@mmaStrings
" Punctuation:
" things that shouldn't really be highlighted, or highlighted
" in they're own group if you _really_ want. :)
" ( ) { }
" TODO - use Delimiter group?
syntax match mmaBoring "[(){}]" contained
" Function Arguments:
" anything between brackets []
" TODO - make good folds for this.
"syntax region mmaArgument start="\[" end="]" containedin=ALLBUT,@mmaComments,@mmaCommentStrings transparent fold
"syntax sync fromstart
"set foldmethod=syntax
"set foldminlines=10
if version >= 508 || !exists("did_mma_syn_inits")
if version < 508
@ -45,17 +233,33 @@ if version >= 508 || !exists("did_mma_syn_inits")
command -nargs=+ HiLink hi def link <args>
endif
HiLink mmaOperator Operator
HiLink mmaVariable Identifier
HiLink mmaString String
HiLink mmaUnicode String
HiLink mmaMessage Identifier
HiLink mmaPattern Identifier
HiLink mmaGenericFunction Function
HiLink mmaError Error
HiLink mmaFixme Error
HiLink mmaComment Comment
HiLink mmaPureFunction Operator
" NOTE - the following links are not guaranteed to
" look good under all colorschemes. You might need to
" :so $VIMRUNTIME/syntax/hitest.vim and tweak these to
" look good in yours
HiLink mmaComment Comment
HiLink mmaCommentStar Comment
HiLink mmaFunctionComment Comment
HiLink mmaLooseQuote Comment
HiLink mmaGenericFunction Function
HiLink mmaOperator Operator
HiLink mmaPatternOp Operator
HiLink mmaPureFunction Operator
HiLink mmaVariable Identifier
HiLink mmaString String
HiLink mmaCommentString String
HiLink mmaUnicode String
HiLink mmaMessage Type
HiLink mmaNumber Type
HiLink mmaPattern Type
HiLink mmaError Error
HiLink mmaFixme Error
HiLink mmaPatternError Error
HiLink mmaTodo Todo
HiLink mmaemPHAsis Special
HiLink mmaFunctionTitle Special
HiLink mmaItem Preproc
delcommand HiLink
endif

View File

@ -580,8 +580,12 @@ static pos_T *var2fpos __ARGS((typval_T *varp, int lnum));
static int get_env_len __ARGS((char_u **arg));
static int get_id_len __ARGS((char_u **arg));
static int get_name_len __ARGS((char_u **arg, char_u **alias, int evaluate, int verbose));
static char_u *find_name_end __ARGS((char_u *arg, char_u **expr_start, char_u **expr_end, int incl_br));
static char_u *find_name_end __ARGS((char_u *arg, char_u **expr_start, char_u **expr_end, int flags));
#define FNE_INCL_BR 1 /* find_name_end(): include [] in name */
#define FNE_CHECK_START 2 /* find_name_end(): check name starts with
valid character */
static int eval_isnamec __ARGS((int c));
static int eval_isnamec1 __ARGS((int c));
static int get_var_tv __ARGS((char_u *name, int len, typval_T *rettv, int verbose));
static int handle_subscript __ARGS((char_u **arg, typval_T *rettv, int evaluate, int verbose));
static typval_T *alloc_tv __ARGS((void));
@ -650,7 +654,7 @@ static void list_vim_vars __ARGS((void));
static char_u *list_arg_vars __ARGS((exarg_T *eap, char_u *arg));
static char_u *ex_let_one __ARGS((char_u *arg, typval_T *tv, int copy, char_u *endchars, char_u *op));
static int check_changedtick __ARGS((char_u *arg));
static char_u *get_lval __ARGS((char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int quiet));
static char_u *get_lval __ARGS((char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int quiet, int fne_flags));
static void clear_lval __ARGS((lval_T *lp));
static void set_var_lval __ARGS((lval_T *lp, char_u *endp, typval_T *rettv, int copy, char_u *op));
static int tv_op __ARGS((typval_T *tv1, typval_T *tv2, char_u *op));
@ -663,6 +667,9 @@ static int do_lock_var __ARGS((lval_T *lp, char_u *name_end, int deep, int lock)
static void item_lock __ARGS((typval_T *tv, int deep, int lock));
static int tv_islocked __ARGS((typval_T *tv));
/* Character used as separated in autoload function/variable names. */
#define AUTOLOAD_CHAR '#'
/*
* Initialize the global and v: variables.
*/
@ -792,7 +799,7 @@ var_redir_start(name, append)
typval_T tv;
/* Make sure a valid variable name is specified */
if (!eval_isnamec(*name) || VIM_ISDIGIT(*name))
if (!eval_isnamec1(*name))
{
EMSG(_(e_invarg));
return FAIL;
@ -810,7 +817,8 @@ var_redir_start(name, append)
}
/* Parse the variable name (can be a dict or list entry). */
redir_endp = get_lval(redir_varname, NULL, redir_lval, FALSE, FALSE, FALSE);
redir_endp = get_lval(redir_varname, NULL, redir_lval, FALSE, FALSE, FALSE,
FNE_CHECK_START);
if (redir_endp == NULL || redir_lval->ll_name == NULL || *redir_endp != NUL)
{
if (redir_endp != NULL && *redir_endp != NUL)
@ -1551,7 +1559,7 @@ skip_var_one(arg)
{
if (vim_strchr((char_u *)"$@&", *arg) != NULL)
++arg;
return find_name_end(arg, NULL, NULL, TRUE);
return find_name_end(arg, NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
}
/*
@ -1643,7 +1651,7 @@ list_arg_vars(eap, arg)
{
if (error || eap->skip)
{
arg = find_name_end(arg, NULL, NULL, TRUE);
arg = find_name_end(arg, NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
if (!vim_iswhite(*arg) && !ends_excmd(*arg))
{
emsg_severe = TRUE;
@ -1888,11 +1896,11 @@ ex_let_one(arg, tv, copy, endchars, op)
* ":let var = expr": Set internal variable.
* ":let {expr} = expr": Idem, name made with curly braces
*/
else if ((eval_isnamec(*arg) && !VIM_ISDIGIT(*arg)) || *arg == '{')
else if (eval_isnamec1(*arg) || *arg == '{')
{
lval_T lv;
p = get_lval(arg, tv, &lv, FALSE, FALSE, FALSE);
p = get_lval(arg, tv, &lv, FALSE, FALSE, FALSE, FNE_CHECK_START);
if (p != NULL && lv.ll_name != NULL)
{
if (endchars != NULL && vim_strchr(endchars, *skipwhite(p)) == NULL)
@ -1942,13 +1950,14 @@ check_changedtick(arg)
* Returns NULL for a parsing error. Still need to free items in "lp"!
*/
static char_u *
get_lval(name, rettv, lp, unlet, skip, quiet)
get_lval(name, rettv, lp, unlet, skip, quiet, fne_flags)
char_u *name;
typval_T *rettv;
lval_T *lp;
int unlet;
int skip;
int quiet; /* don't give error messages */
int fne_flags; /* flags for find_name_end() */
{
char_u *p;
char_u *expr_start, *expr_end;
@ -1969,11 +1978,11 @@ get_lval(name, rettv, lp, unlet, skip, quiet)
{
/* When skipping just find the end of the name. */
lp->ll_name = name;
return find_name_end(name, NULL, NULL, TRUE);
return find_name_end(name, NULL, NULL, FNE_INCL_BR | fne_flags);
}
/* Find the end of the name. */
p = find_name_end(name, &expr_start, &expr_end, FALSE);
p = find_name_end(name, &expr_start, &expr_end, fne_flags);
if (expr_start != NULL)
{
/* Don't expand the name when we already know there is an error. */
@ -2842,7 +2851,8 @@ ex_unletlock(eap, argstart, deep)
do
{
/* Parse the name and find the end. */
name_end = get_lval(arg, NULL, &lv, TRUE, eap->skip || error, FALSE);
name_end = get_lval(arg, NULL, &lv, TRUE, eap->skip || error, FALSE,
FNE_CHECK_START);
if (lv.ll_name == NULL)
error = TRUE; /* error but continue parsing */
if (name_end == NULL || (!vim_iswhite(*name_end)
@ -10178,7 +10188,8 @@ f_islocked(argvars, rettv)
dictitem_T *di;
rettv->vval.v_number = -1;
end = get_lval(get_tv_string(&argvars[0]), NULL, &lv, FALSE, FALSE, FALSE);
end = get_lval(get_tv_string(&argvars[0]), NULL, &lv, FALSE, FALSE, FALSE,
FNE_CHECK_START);
if (end != NULL && lv.ll_name != NULL)
{
if (*end != NUL)
@ -13967,7 +13978,8 @@ get_name_len(arg, alias, evaluate, verbose)
/*
* Find the end of the name; check for {} construction.
*/
p = find_name_end(*arg, &expr_start, &expr_end, FALSE);
p = find_name_end(*arg, &expr_start, &expr_end,
len > 0 ? 0 : FNE_CHECK_START);
if (expr_start != NULL)
{
char_u *temp_string;
@ -14002,15 +14014,16 @@ get_name_len(arg, alias, evaluate, verbose)
* Find the end of a variable or function name, taking care of magic braces.
* If "expr_start" is not NULL then "expr_start" and "expr_end" are set to the
* start and end of the first magic braces item.
* "flags" can have FNE_INCL_BR and FNE_CHECK_START.
* Return a pointer to just after the name. Equal to "arg" if there is no
* valid name.
*/
static char_u *
find_name_end(arg, expr_start, expr_end, incl_br)
find_name_end(arg, expr_start, expr_end, flags)
char_u *arg;
char_u **expr_start;
char_u **expr_end;
int incl_br; /* Include [] indexes and .name */
int flags;
{
int mb_nest = 0;
int br_nest = 0;
@ -14022,10 +14035,14 @@ find_name_end(arg, expr_start, expr_end, incl_br)
*expr_end = NULL;
}
/* Quick check for valid starting character. */
if ((flags & FNE_CHECK_START) && !eval_isnamec1(*arg) && *arg != '{')
return arg;
for (p = arg; *p != NUL
&& (eval_isnamec(*p)
|| *p == '{'
|| (incl_br && (*p == '[' || *p == '.'))
|| ((flags & FNE_INCL_BR) && (*p == '[' || *p == '.'))
|| mb_nest != 0
|| br_nest != 0); ++p)
{
@ -14108,7 +14125,7 @@ make_expanded_name(in_start, expr_start, expr_end, in_end)
if (retval != NULL)
{
temp_result = find_name_end(retval, &expr_start, &expr_end, FALSE);
temp_result = find_name_end(retval, &expr_start, &expr_end, 0);
if (expr_start != NULL)
{
/* Further expansion! */
@ -14130,7 +14147,18 @@ make_expanded_name(in_start, expr_start, expr_end, in_end)
eval_isnamec(c)
int c;
{
return (ASCII_ISALNUM(c) || c == '_' || c == ':');
return (ASCII_ISALNUM(c) || c == '_' || c == ':' || c == AUTOLOAD_CHAR);
}
/*
* Return TRUE if character "c" can be used as the first character in a
* variable or function name (excluding '{' and '}').
*/
static int
eval_isnamec1(c)
int c;
{
return (ASCII_ISALPHA(c) || c == '_');
}
/*
@ -14729,8 +14757,8 @@ find_var_ht(name, varname)
{
if (name[1] != ':')
{
/* The name must not start with a colon. */
if (name[0] == ':')
/* The name must not start with a colon or #. */
if (name[0] == ':' || name[0] == AUTOLOAD_CHAR)
return NULL;
*varname = name;
@ -14745,8 +14773,10 @@ find_var_ht(name, varname)
*varname = name + 2;
if (*name == 'g') /* global variable */
return &globvarht;
/* There must be no ':' in the rest of the name, unless g: is used */
if (vim_strchr(name + 2, ':') != NULL)
/* There must be no ':' or '#' in the rest of the name, unless g: is used
*/
if (vim_strchr(name + 2, ':') != NULL
|| vim_strchr(name + 2, AUTOLOAD_CHAR) != NULL)
return NULL;
if (*name == 'b') /* buffer variable */
return &curbuf->b_vars.dv_hashtab;
@ -15886,7 +15916,7 @@ ex_function(eap)
if (fp == NULL)
{
if (fudi.fd_dict == NULL && vim_strchr(name, ':') != NULL)
if (fudi.fd_dict == NULL && vim_strchr(name, AUTOLOAD_CHAR) != NULL)
{
int slen, plen;
char_u *scriptname;
@ -16018,7 +16048,8 @@ trans_function_name(pp, skip, flags, fdp)
if (lead > 2)
start += lead;
end = get_lval(start, NULL, &lv, FALSE, skip, flags & TFN_QUIET);
end = get_lval(start, NULL, &lv, FALSE, skip, flags & TFN_QUIET,
lead > 2 ? 0 : FNE_CHECK_START);
if (end == start)
{
if (!skip)
@ -16038,7 +16069,7 @@ trans_function_name(pp, skip, flags, fdp)
EMSG2(_(e_invarg2), start);
}
else
*pp = find_name_end(start, NULL, NULL, TRUE);
*pp = find_name_end(start, NULL, NULL, FNE_INCL_BR);
goto theend;
}
@ -16236,13 +16267,14 @@ function_exists(name)
/*
* Return TRUE if "name" looks like a builtin function name: starts with a
* lower case letter and doesn't contain a ':'.
* lower case letter and doesn't contain a ':' or AUTOLOAD_CHAR.
*/
static int
builtin_function(name)
char_u *name;
{
return ASCII_ISLOWER(name[0]) && vim_strchr(name, ':') == NULL;
return ASCII_ISLOWER(name[0]) && vim_strchr(name, ':') == NULL
&& vim_strchr(name, AUTOLOAD_CHAR) == NULL;
}
#if defined(FEAT_PROFILE) || defined(PROTO)
@ -16440,7 +16472,7 @@ script_autoload(name)
int ret = FALSE;
/* If there is no colon after name[1] there is no package name. */
p = vim_strchr(name, ':');
p = vim_strchr(name, AUTOLOAD_CHAR);
if (p == NULL || p <= name + 2)
return FALSE;
@ -16464,15 +16496,15 @@ autoload_name(name)
char_u *p;
char_u *scriptname;
/* Get the script file name: replace ':' with '/', append ".vim". */
/* Get the script file name: replace '#' with '/', append ".vim". */
scriptname = alloc((unsigned)(STRLEN(name) + 14));
if (scriptname == NULL)
return FALSE;
STRCPY(scriptname, "autoload/");
STRCAT(scriptname, name);
*vim_strrchr(scriptname, ':') = NUL;
*vim_strrchr(scriptname, AUTOLOAD_CHAR) = NUL;
STRCAT(scriptname, ".vim");
while ((p = vim_strchr(scriptname, ':')) != NULL)
while ((p = vim_strchr(scriptname, AUTOLOAD_CHAR)) != NULL)
*p = '/';
return scriptname;
}
@ -16852,7 +16884,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
else
{
trunc_string(tv2string(&argvars[i], &tofree, numbuf),
buf, MSG_BUF_LEN);
buf, MSG_BUF_CLEN);
msg_puts(buf);
vim_free(tofree);
}
@ -16940,7 +16972,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
char_u *tofree;
trunc_string(tv2string(fc.rettv, &tofree, numbuf),
buf, MSG_BUF_LEN);
buf, MSG_BUF_CLEN);
smsg((char_u *)_("%s returning %s"), sn, buf);
vim_free(tofree);
}

View File

@ -6307,7 +6307,7 @@ sign_list_defined(sp)
{
char_u *p;
smsg((char_u *)"sign %s", sp->sn_name);
msg_str((char_u *)"sign %s", sp->sn_name);
if (sp->sn_icon != NULL)
{
MSG_PUTS(" icon=");

View File

@ -141,7 +141,14 @@ do_debug(cmd)
if (sourcing_name != NULL)
msg(sourcing_name);
if (sourcing_lnum != 0)
smsg((char_u *)_("line %ld: %s"), (long)sourcing_lnum, cmd);
{
char_u buf[IOSIZE];
/* Truncate the command, the whole must fit in IObuff. */
STRNCPY(buf, cmd, IOSIZE - 50);
buf[IOSIZE - 50] = NUL;
smsg((char_u *)_("line %ld: %s"), (long)sourcing_lnum, buf);
}
else
msg_str((char_u *)_("cmd: %s"), cmd);
@ -1942,6 +1949,7 @@ do_argfile(eap, argn)
{
int other;
char_u *p;
int old_arg_idx = curwin->w_arg_idx;
if (argn < 0 || argn >= ARGCOUNT)
{
@ -1995,14 +2003,16 @@ do_argfile(eap, argn)
)
arg_had_last = TRUE;
/* Edit the file; always use the last known line number. */
(void)do_ecmd(0, alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
/* Edit the file; always use the last known line number.
* When it fails (e.g. Abort for already edited file) restore the
* argument index. */
if (do_ecmd(0, alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
eap, ECMD_LAST,
(P_HID(curwin->w_buffer) ? ECMD_HIDE : 0) +
(eap->forceit ? ECMD_FORCEIT : 0));
(eap->forceit ? ECMD_FORCEIT : 0)) == FAIL)
curwin->w_arg_idx = old_arg_idx;
/* like Vi: set the mark where the cursor is in the file. */
if (eap->cmdidx != CMD_argdo)
else if (eap->cmdidx != CMD_argdo)
setmark('\'');
}
}
@ -2463,8 +2473,14 @@ do_in_runtimepath(name, all, callback, cookie)
if (buf != NULL && rtp_copy != NULL)
{
if (p_verbose > 1)
smsg((char_u *)_("Searching for \"%s\" in \"%s\""),
{
if (STRLEN(name) + STRLEN(p_rtp) > IOSIZE - 100)
MSG(_("Searching for a long name in 'runtimepath'"));
else
smsg((char_u *)_("Searching for \"%s\" in \"%s\""),
(char *)name, (char *)p_rtp);
}
/* Loop over all entries in 'runtimepath'. */
rtp = rtp_copy;
while (*rtp != NUL && (all || !did_one))

View File

@ -42,7 +42,7 @@
# ifdef EBCDIC
#define DFLT_EFM "%*[^ ] %*[^ ] %f:%l%*[ ]%m,%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory `%f',%X%*\\a[%*\\d]: Leaving directory `%f',%DMaking %*\\a in %f,%f|%l| %m"
# else
#define DFLT_EFM "%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory `%f',%X%*\\a[%*\\d]: Leaving directory `%f',%DMaking %*\\a in %f,%f|%l| %m"
#define DFLT_EFM "%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory `%f',%X%*\\a[%*\\d]: Leaving directory `%f',%D%*\\a: Entering directory `%f',%X%*\\a: Leaving directory `%f',%DMaking %*\\a in %f,%f|%l| %m"
# endif
# endif
# endif

File diff suppressed because it is too large Load Diff

View File

@ -7506,7 +7506,7 @@ get_attr_entry(table, aep)
return i + ATTR_OFF;
}
if (table->ga_len + ATTR_OFF >= 256)
if (table->ga_len + ATTR_OFF > MAX_TYPENR)
{
/*
* Running out of attribute entries! remove all attributes, and

View File

@ -4,7 +4,7 @@
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
#
# Last change: 2005 Jan 19
# Last change: 2005 May 18
#
# This has been tested on VMS 6.2 to 7.2 on DEC Alpha and VAX.
# Edit the lines in the Configuration section below to select.
@ -57,7 +57,8 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test33.out test34.out test35.out test36.out test37.out \
test38.out test39.out test40.out test41.out test42.out \
test43.out test44.out test45.out test46.out \
test48.out test51.out test53.out test54.out test55.out
test48.out test51.out test53.out test54.out test55.out \
test56.out
.IFDEF WANT_GUI
SCRIPT_GUI = test16.out

View File

@ -14,7 +14,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test38.out test39.out test40.out test41.out test42.out \
test43.out test44.out test45.out test46.out test47.out \
test48.out test49.out test51.out test52.out test53.out \
test54.out test55.out
test54.out test55.out test56.out
SCRIPTS_GUI = test16.out

21
src/testdir/test56.in Normal file
View File

@ -0,0 +1,21 @@
Test for script-local function. vim: set ft=vim :
STARTTEST
:so small.vim
:"
:set nocp
:/^start:/+1,/^end:/-1w! Xtest.vim
:source Xtest.vim
_x
:$-1,$wq! test.out
ENDTEST
start:
fun <SID>DoLast()
call append(line('$'), "last line")
endfun
fun s:DoNothing()
call append(line('$'), "nothing line")
endfun
nnoremap <buffer> _x :call <SID>DoNothing()<bar>call <SID>DoLast()<cr>
end:

2
src/testdir/test56.ok Normal file
View File

@ -0,0 +1,2 @@
nothing line
last line