changeset 4911:78c318784090

Updated runtime files.
author Bram Moolenaar <bram@vim.org>
date Sat, 15 Jun 2013 21:39:51 +0200
parents e0ff44b689e3
children d8f65e6238fa
files runtime/doc/autocmd.txt runtime/doc/if_lua.txt runtime/doc/indent.txt runtime/doc/tags runtime/doc/todo.txt runtime/indent/html.vim runtime/syntax/abap.vim runtime/syntax/objc.vim
diffstat 8 files changed, 129 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1,4 +1,4 @@
-*autocmd.txt*   For Vim version 7.3.  Last change: 2013 May 19
+*autocmd.txt*   For Vim version 7.3.  Last change: 2013 Jun 15
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -513,9 +513,9 @@ CursorHold			When the user doesn't press
 CursorHoldI			Just like CursorHold, but in Insert mode.
 
 							*CursorMoved*
-CursorMoved			After the cursor was moved in Normal mode.
-				Also when the text of the cursor line has been
-				changed, e.g., with "x", "rx" or "p".
+CursorMoved			After the cursor was moved in Normal or Visual
+				mode.  Also when the text of the cursor line
+				has been changed, e.g., with "x", "rx" or "p".
 				Not triggered when there is typeahead or when
 				an operator is pending.
 				For an example see |match-parens|.
--- a/runtime/doc/if_lua.txt
+++ b/runtime/doc/if_lua.txt
@@ -10,9 +10,10 @@ 1. Commands			|lua-commands|
 2. The vim module		|lua-vim|
 3. List userdata		|lua-list|
 4. Dict userdata		|lua-dict|
-5. Buffer userdata		|lua-buffer|
-6. Window userdata		|lua-window|
-7. The luaeval function		|lua-luaeval|
+5. Funcref userdata		|lua-funcref|
+6. Buffer userdata		|lua-buffer|
+7. Window userdata		|lua-window|
+8. The luaeval function		|lua-luaeval|
 
 {Vi does not have any of these commands}
 
@@ -110,9 +111,31 @@ input range are stored in "vim.firstline
 module also includes routines for buffer, window, and current line queries,
 Vim evaluation and command execution, and others.
 
-	vim.list()		Returns an empty list (see |List|).
-
-	vim.dict()		Returns an empty dictionary (see |Dictionary|).
+	vim.list([arg])		Returns an empty list or, if "arg" is a Lua
+				table with numeric keys 1, ..., n (a
+				"sequence"), returns a list l such that l[i] =
+				arg[i] for i = 1, ..., n (see |List|).
+				Non-numeric keys are not used to initialize
+				the list. See also |lua-eval| for conversion
+				rules. Example: >
+					:lua t = {math.pi, false, say = 'hi'}
+					:echo luaeval('vim.list(t)')
+					:" [3.141593, 0], 'say' is ignored
+<
+	vim.dict([arg])		Returns an empty dictionary or, if "arg" is a
+				Lua table, returns a dict d such that d[k] =
+				arg[k] for all string keys k in "arg" (see
+				|Dictionary|). Number keys are converted to
+				strings. Keys that are not strings are not
+				used to initialize the dictionary. See also
+				|lua-eval| for conversion rules. Example: >
+					:lua t = {math.pi, false, say = 'hi'}
+					:echo luaeval('vim.dict(t)')
+					:" {'say': 'hi'}, numeric keys ignored
+<
+	vim.funcref({name})	Returns a Funcref to function {name} (see
+				|Funcref|). It is equivalent to Vim's
+				"function".
 
 	vim.buffer([arg])	If "arg" is a number, returns buffer with
 				number "arg" in the buffer list or, if "arg"
@@ -131,9 +154,9 @@ Vim evaluation and command execution, an
 
 	vim.type({arg})		Returns the type of {arg}. It is equivalent to
 				Lua's "type" function, but returns "list",
-				"dict", "buffer", or "window" if {arg} is a
-				list, dictionary, buffer, or window,
-				respectively. Examples: >
+				"dict", "funcref", "buffer", or "window" if
+				{arg} is a list, dictionary, funcref, buffer,
+				or window, respectively. Examples: >
 					:lua l = vim.list()
 					:lua print(type(l), vim.type(l))
 					:" userdata list
@@ -229,7 +252,40 @@ Examples:
 <
 
 ==============================================================================
-5. Buffer userdata					*lua-buffer*
+5. Funcref userdata					*lua-funcref*
+
+Funcref userdata represent funcref variables in Vim. Funcrefs that were
+defined with a "dict" attribute need to be obtained as a dictionary key
+in order to have "self" properly assigned to the dictionary (see examples
+below.) A funcref "f" has the following properties:
+
+Properties
+----------
+	o "#f" is the name of the function referenced by "f"
+	o "f(...)" calls the function referenced by "f" (with arguments)
+
+Examples:
+>
+	:function I(x)
+	:  return a:x
+	:  endfunction
+	:let R = function('I')
+	:lua i1 = vim.funcref('I')
+	:lua i2 = vim.eval('R')
+	:lua print(#i1, #i2) -- both 'I'
+	:lua print(i1, i2, #i2(i1) == #i1(i2))
+	:function Mylen() dict
+	:  return len(self.data)
+	:  endfunction
+	:let mydict = {'data': [0, 1, 2, 3]}
+	:lua d = vim.eval('mydict'); d.len = vim.funcref('Mylen')
+	:echo mydict.len()
+	:lua l = d.len -- assign d as 'self'
+	:lua print(l())
+<
+
+==============================================================================
+6. Buffer userdata					*lua-buffer*
 
 Buffer userdata represent vim buffers. A buffer userdata "b" has the following
 properties and methods:
@@ -281,7 +337,7 @@ Examples:
 <
 
 ==============================================================================
-6. Window userdata					*lua-window*
+7. Window userdata					*lua-window*
 
 Window objects represent vim windows. A window userdata "w" has the following
 properties and methods:
@@ -313,7 +369,7 @@ Examples:
 <
 
 ==============================================================================
-7. The luaeval function					*lua-luaeval* *lua-eval*
+8. The luaeval function					*lua-luaeval* *lua-eval*
 
 The (dual) equivalent of "vim.eval" for passing Lua values to Vim is
 "luaeval". "luaeval" takes an expression string and an optional argument and
@@ -325,7 +381,13 @@ returns the result of the expression. It
 	    return chunk(arg) -- return typval
 	end
 <
-Note that "_A" receives the argument to "luaeval". Examples: >
+Note that "_A" receives the argument to "luaeval". Lua numbers, strings, and
+list, dict, and funcref userdata are converted to their Vim respective types,
+while Lua booleans are converted to numbers. An error is thrown if conversion
+of any of the remaining Lua types, including userdata other than lists, dicts,
+and funcrefs, is attempted.
+
+Examples: >
 
 	:echo luaeval('math.pi')
 	:lua a = vim.list():add('newlist')
--- a/runtime/doc/indent.txt
+++ b/runtime/doc/indent.txt
@@ -1,4 +1,4 @@
-*indent.txt*    For Vim version 7.3.  Last change: 2013 Jun 12
+*indent.txt*    For Vim version 7.3.  Last change: 2013 Jun 13
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -745,7 +745,7 @@ You can set the indent for the first lin
       "inc"	auto indent + one indent step
 
 Many tags increase the indent for what follows per default (see "Add Indent
-Tags" below in this script).  You can add further tags with: >
+Tags" in the script).  You can add further tags with: >
 
       :let g:html_indent_inctags = "html,body,head,tbody"
 
@@ -757,7 +757,7 @@ Default value is empty for both variable
 only defined once per Vim session.
 
 User variables are only read when the script is sourced.  To enable your
-changes during a session, without reloaind the html file, you can manually
+changes during a session, without reloading the HTML file, you can manually
 do: >
 
       :call HtmlIndent_CheckUserSettings()
@@ -765,11 +765,11 @@ do: >
 Detail:
   Calculation of indent inside "blocktags" with "alien" content:
       BLOCKTAG   INDENT EXPR	    WHEN APPLICABLE ~
-      <script> : {customizable}   if first line of block
-      	 : cindent(v:lnum)  if attributes empty or contain "java"
-      	 : -1		    else (vbscript, tcl, ...)
-      <style>  : {customizable}   if first line of block
-      	 : GetCSSIndent()   else
+      <script> : {customizable}	    if first line of block
+	       : cindent(v:lnum)    if attributes empty or contain "java"
+	       : -1		    else (vbscript, tcl, ...)
+      <style>  : {customizable}	    if first line of block
+	       : GetCSSIndent()	    else
       <!-- --> : -1
 
 
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -6674,6 +6674,7 @@ lua-buffer	if_lua.txt	/*lua-buffer*
 lua-commands	if_lua.txt	/*lua-commands*
 lua-dict	if_lua.txt	/*lua-dict*
 lua-eval	if_lua.txt	/*lua-eval*
+lua-funcref	if_lua.txt	/*lua-funcref*
 lua-list	if_lua.txt	/*lua-list*
 lua-luaeval	if_lua.txt	/*lua-luaeval*
 lua-vim	if_lua.txt	/*lua-vim*
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.3.  Last change: 2013 Jun 12
+*todo.txt*      For Vim version 7.3.  Last change: 2013 Jun 15
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -36,9 +36,6 @@ not be repeated below, unless there is e
 
 --- Python interface
 
-Test 87 fails.
-Test 86 fails on some systems.
-
 Python: ":py raw_input('prompt')" doesn't work. (Manu Hack)
 
 Win32: The Python interface only works with one version of Python, selected at
@@ -54,30 +51,6 @@ Does not work, tests fail.
 
 --- bug fixes
 
-:wviminfo does not write old history entries. (Roland Eggner, 2013 Jun 5)
-Another message Jun 6.
-
-Patch to avoid wrong error message for 1.0[0]. (Yasuhiro Matsumoto, 2013 May
-1)
-
-Patch for if_lua. (Luis Carvalho, 2012 Aug 26, update Aug 29, another Aug 30,
-then Sep 1, reminder Oct 14)
-
-Patch for if_perl.  (Ike Devolder, May 27)
-
-Patch to check if 'foldexpr' sets did_emsg. (Christian Brabandt, 2013 Mar 20)
-
-Patch for 'backupcopy' default behavior for symlinks on Windows. (David Pope,
-2012 Mar 21, update Mar 31)
-With fix for memory leak: Ken Takata, 2012 Aug 24
-Another update Sep 24.
-Also patch from Joerg Bornemann, 2013 Apr 30.
-
-Undo problem: line not removed as expected when using setline() from Insert
-mode. (Israel Chauca, 2010 May 13, more in second msg)
-Break undo when CTRL-R = changes the text?  Or save more lines?
-Patch by Christian Brabandt, 2012 Nov 16.
-
 Do allow real tags above the !_TAG entries. Undo older patch. Issue 90.
 
 Matches might be highlighted correctly. Inefficient patch by Christian
--- a/runtime/indent/html.vim
+++ b/runtime/indent/html.vim
@@ -3,8 +3,8 @@
 " File:		html.vim (Vimscript #2075)
 " Author:	Andy Wokula <anwoku@yahoo.de>
 " Last Change:	2013 Jun 12
-" Rev Days:     9
-" Version:	0.8
+" Rev Days:     13
+" Version:	0.9
 " Vim Version:	Vim7
 " Description:
 "   Improved version of the distributed html indent script, faster on a
@@ -15,7 +15,10 @@
 "	indent/css.vim (2006 Dec 20) from N. Weibull
 "
 " History:
-" 2011 Sep 09	added HTML5 tags (thx to J. Zuckerman)
+" 2012 Oct 21	(v0.9) added support for shiftwidth()
+" 2011 Sep 09	(v0.8) added HTML5 tags (thx to J. Zuckerman)
+" 2008 Apr 28	(v0.6) revised customization
+" 2008 Mar 09	(v0.5) fixed 'indk' issue (thx to C.J. Robinson)
 " }}}
 
 " Init Folklore, check user settings (2nd time ++) "{{{
@@ -36,6 +39,15 @@ if exists("*HtmlIndent")
     finish
 endif
 
+" Patch 7.3.694
+if exists('*shiftwidth')
+    let s:ShiftWidth = function('shiftwidth')
+else
+    func! s:ShiftWidth()
+	return &shiftwidth
+    endfunc
+endif
+
 let s:cpo_save = &cpo
 set cpo-=C
 "}}}
@@ -50,7 +62,7 @@ func! HtmlIndent_CheckUserSettings() "{{
 
     let indone = {"zero": 0
 		\,"auto": "indent(prevnonblank(v:lnum-1))"
-		\,"inc": "b:indent.blocktagind + &shiftwidth"}
+		\,"inc": "b:indent.blocktagind + s:ShiftWidth()"}
     if exists("g:html_indent_script1")
 	let s:js1indent = get(indone, g:html_indent_script1, indone.zero)
     endif
@@ -196,7 +208,7 @@ func! s:Blocktag(blocktag, ind) "{{{
 	endif
 	let s:newstate.blocklnr = v:lnum
 	" save allover indent for the endtag
-	let s:newstate.blocktagind = b:indent.baseindent + (s:nextrel + s:curind) * &shiftwidth
+	let s:newstate.blocktagind = b:indent.baseindent + (s:nextrel + s:curind) * s:ShiftWidth()
 	if a:ind == 3
 	    return "SCRIPT"    " all except this must be lowercase
 	    " line is to be checked again for the type attribute
@@ -277,7 +289,7 @@ func! s:FreshState(lnum) "{{{
 	" check preceding tags in the line:
 	let s:altline = tagline[: stopcol-2]
 	call s:CountITags(1)
-	let state.blocktagind = indent(stopline) + (s:curind + s:nextrel) * &shiftwidth
+	let state.blocktagind = indent(stopline) + (s:curind + s:nextrel) * s:ShiftWidth()
 	return state
     elseif stopline == state.lnum
 	" handle special case: previous line (= state.lnum) contains a
@@ -288,7 +300,7 @@ func! s:FreshState(lnum) "{{{
 	    let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bW")
 	    let s:altline = tolower(getline(bline)[: bcol-2])
 	    call s:CountITags(1)
-	    let state.baseindent = indent(bline) + (s:nextrel+s:curline) * &shiftwidth
+	    let state.baseindent = indent(bline) + (s:nextrel+s:curline) * s:ShiftWidth()
 	    return state
 	endif
     endif
@@ -303,7 +315,7 @@ func! s:FreshState(lnum) "{{{
 	" check preceding tags in the line:
 	let s:altline = tolower(getline(comline)[: comcol-2])
 	call s:CountITags(1)
-	let state.blocktagind = indent(comline) + (s:curind + s:nextrel) * &shiftwidth
+	let state.blocktagind = indent(comline) + (s:curind + s:nextrel) * s:ShiftWidth()
 	return state
     endif
 
@@ -320,18 +332,18 @@ func! s:FreshState(lnum) "{{{
 	    let s:altline = tolower(getline(comline)[: comcol-2])
 	endif
 	call s:CountITags(1)
-	let state.baseindent = indent(comline) + (s:nextrel+s:curline) * &shiftwidth
+	let state.baseindent = indent(comline) + (s:nextrel+s:curline) * s:ShiftWidth()
 	return state
 	" TODO check tags that follow "-->"
     endif
 
     " else no comments
     call s:CountITags(1)
-    let state.baseindent = indent(state.lnum) + s:nextrel * &shiftwidth
+    let state.baseindent = indent(state.lnum) + s:nextrel * s:ShiftWidth()
     " line starts with end tag
     let swendtag = match(s:altline, '^\s*</') >= 0
     if !swendtag
-	let state.baseindent += s:curind * &shiftwidth
+	let state.baseindent += s:curind * s:ShiftWidth()
     endif
     return state
 endfunc "}}}
@@ -373,10 +385,10 @@ func! s:CSSIndent() "{{{
 	" indent for first content line after comments
 	return eval(s:css1indent)
     endif
-    let ind = indent(pnum) + s:css_countbraces(pnum, 1) * &sw
+    let ind = indent(pnum) + s:css_countbraces(pnum, 1) * s:ShiftWidth()
     let pline = getline(pnum)
     if pline =~ '}\s*$'
-	let ind -= (s:css_countbraces(pnum, 0) - (pline =~ '^\s*}')) * &sw
+	let ind -= (s:css_countbraces(pnum, 0) - (pline =~ '^\s*}')) * s:ShiftWidth()
     endif
     return ind
 endfunc "}}}
@@ -421,11 +433,12 @@ endfunc "}}}
 
 func! HtmlIndent() "{{{
     let s:curline = tolower(getline(v:lnum))
+    let indentunit = s:ShiftWidth()
 
     let s:newstate = {}
     let s:newstate.lnum = v:lnum
 
-    " is the first non-blank in the line the start of a tag?
+    " does the line start with a closing tag?
     let swendtag = match(s:curline, '^\s*</') >= 0
 
     if prevnonblank(v:lnum-1) == b:indent.lnum && s:usestate
@@ -446,11 +459,11 @@ func! HtmlIndent() "{{{
 	    let s:curline = strpart(s:curline, blockend+strlen(endtag))
 	    call s:CountITags()
 	    if swendtag && b:indent.block != 5
-		let indent = b:indent.blocktagind + s:curind * &shiftwidth
-		let s:newstate.baseindent = indent + s:nextrel * &shiftwidth
+		let indent = b:indent.blocktagind + s:curind * indentunit
+		let s:newstate.baseindent = indent + s:nextrel * indentunit
 	    else
 		let indent = s:Alien{b:indent.block}()
-		let s:newstate.baseindent = b:indent.blocktagind + s:nextrel * &shiftwidth
+		let s:newstate.baseindent = b:indent.blocktagind + s:nextrel * indentunit
 	    endif
 	    call extend(b:indent, s:newstate, "force")
 	    return indent
@@ -467,11 +480,11 @@ func! HtmlIndent() "{{{
 	let s:newstate.block = b:indent.block
 	call s:CountITags()
 	if swendtag
-	    let indent = b:indent.baseindent + s:curind * &shiftwidth
-	    let s:newstate.baseindent = indent + s:nextrel * &shiftwidth
+	    let indent = b:indent.baseindent + s:curind * indentunit
+	    let s:newstate.baseindent = indent + s:nextrel * indentunit
 	else
 	    let indent = b:indent.baseindent
-	    let s:newstate.baseindent = indent + (s:curind + s:nextrel) * &shiftwidth
+	    let s:newstate.baseindent = indent + (s:curind + s:nextrel) * indentunit
 	endif
 	call extend(b:indent, s:newstate, "force")
 	return indent
--- a/runtime/syntax/abap.vim
+++ b/runtime/syntax/abap.vim
@@ -2,7 +2,7 @@
 "    Language: SAP - ABAP/R4
 "    Revision: 2.1
 "  Maintainer: Marius Piedallu van Wyk <lailoken@gmail.com>
-" Last Change: 2012 Oct 23
+" Last Change: 2013 Jun 13
 "     Comment: Thanks to EPI-USE Labs for all your assistance. :)
 
 " For version  < 6.0: Clear all syntax items
@@ -140,7 +140,7 @@ syn keyword abapStatement CHANGING EXCEP
 syn keyword abapStatement ID NUMBER FOR TITLE OUTPUT
 
 " Special ABAP specific tables:
-syn match   abapSpecialTables "\<\(sy\|\(p\|pa\)\d\d\d\d\|t\d\d\d.\|innnn\)-"me=e-1 contained
+syn match   abapSpecialTables "\<\(sy\|\(hrp\|p\|pa\)\d\d\d\d\|t\d\d\d.\|innnn\)-"me=e-1 contained
 syn match   abapStructure     "\<\w\+-[^\>]"me=e-2 contains=abapSpecialTables,abapStatement,abapComplexStatement
 syn match   abapField         "-\w\+"ms=s+1
 
--- a/runtime/syntax/objc.vim
+++ b/runtime/syntax/objc.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:     Objective-C
 " Maintainer:   Kazunobu Kuriyama <kazunobu.kuriyama@nifty.com>
-" Last Change:  2013 Jun 12
+" Last Change:  2013 Jun 13
 " Remark:       Modern Objective-C Edition
 
 """ Preparation for loading ObjC stuff
@@ -20,7 +20,7 @@ set cpo&vim
 syn keyword objcPreProcMacro __OBJC__ __OBJC2__ __clang__
 
 " Defined Types
-syn keyword objcPrincipalType id Class SEL IMP BOOL
+syn keyword objcPrincipalType id Class SEL IMP BOOL instancetype
 syn keyword objcUsefulTerm nil Nil NO YES
 
 " Preprocessor Directives
@@ -37,6 +37,7 @@ syn match objcInternalRep display /@sele
 syn match objcException display /@try\>\|@throw\>\|@catch\|@finally\>/
 syn match objcThread display /@synchronized\>/
 syn match objcPool display /@autoreleasepool\>/
+syn match objcModuleImport display /@import\>/
 
 " ObjC Constant Strings
 syn match objcSpecial display contained "%@"
@@ -84,7 +85,7 @@ syn match objcProtocolList display /<\h\
 
 " shorthand
 syn cluster objcCEntities contains=cType,cStructure,cStorageClass,cString,cCharacter,cSpecialCharacter,cNumbers,cConstant,cOperator,cComment,cCommentL,cStatement,cLabel,cConditional,cRepeat
-syn cluster objcObjCEntities contains=objcHiddenArgument,objcPrincipalType,objcString,objcUsefulTerm,objcProtocol,objcInternalRep,objcException,objcThread,objcPool,@objcTypeQualifier,objcLiteralSyntaxNumber,objcLiteralSyntaxOp,objcLiteralSyntaxChar,objcLiteralSyntaxSpecialChar,objcProtocolList,objcColon,objcFastEnumKeyword,objcType,objcClass,objcMacro,objcEnum,objcEnumValue,objcExceptionValue,objcNotificationValue,objcConstVar,objcPreProcMacro
+syn cluster objcObjCEntities contains=objcHiddenArgument,objcPrincipalType,objcString,objcUsefulTerm,objcProtocol,objcInternalRep,objcException,objcThread,objcPool,objcModuleImport,@objcTypeQualifier,objcLiteralSyntaxNumber,objcLiteralSyntaxOp,objcLiteralSyntaxChar,objcLiteralSyntaxSpecialChar,objcProtocolList,objcColon,objcFastEnumKeyword,objcType,objcClass,objcMacro,objcEnum,objcEnumValue,objcExceptionValue,objcNotificationValue,objcConstVar,objcPreProcMacro
 
 " Objective-C Message Expressions
 syn region objcMethodCall start=/\[/ end=/\]/ contains=objcMethodCall,objcBlocks,@objcObjCEntities,@objcCEntities
@@ -399,6 +400,7 @@ hi def link objcInternalRep             
 hi def link objcException                   cOperator
 hi def link objcThread                      cOperator
 hi def link objcPool                        cOperator
+hi def link objcModuleImport                cOperator
 hi def link objcSpecial                     cSpecial
 hi def link objcString                      cString
 hi def link objcHiddenArgument              cStatement