Updated runtime files.
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index 17a8ca3..977a94d 100644
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -1,4 +1,4 @@
-*editing.txt* For Vim version 7.3. Last change: 2011 Feb 26
+*editing.txt* For Vim version 7.3. Last change: 2012 Mar 23
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1159,8 +1159,10 @@
*:confirm* *:conf*
:conf[irm] {command} Execute {command}, and use a dialog when an
operation has to be confirmed. Can be used on the
- ":q", ":qa" and ":w" commands (the latter to over-ride
- a read-only setting).
+ |:q|, |:qa| and |:w| commands (the latter to override
+ a read-only setting), and any other command that can
+ fail in such a way, such as |:only|, |:buffer|,
+ |:bdelete|, etc.
Examples: >
:confirm w foo
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index ce4c41b..cb0dbc0 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.3. Last change: 2012 Mar 07
+*eval.txt* For Vim version 7.3. Last change: 2012 Mar 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3473,7 +3473,8 @@
matches, they are separated by <NL> characters.
If the expansion fails, the result is an empty String or List.
- A name for a non-existing file is not included.
+ A name for a non-existing file is not included. A symbolic
+ link is only included if it points to an existing file.
For most systems backticks can be used to get files names from
any external command. Example: >
@@ -5779,9 +5780,9 @@
omitted the current tab page is used.
When {arg} is invalid the number zero is returned.
To get a list of all buffers in all tabs use this: >
- tablist = []
+ let buflist = []
for i in range(tabpagenr('$'))
- call extend(tablist, tabpagebuflist(i + 1))
+ call extend(buflist, tabpagebuflist(i + 1))
endfor
< Note that a buffer may appear in more than one window.
@@ -6003,7 +6004,7 @@
would be of unlimited width. When there is a <Tab> at the
position, the returned Number will be the column at the end of
the <Tab>. For example, for a <Tab> in column 1, with 'ts'
- set to 8, it returns 8.
+ set to 8, it returns 8. |conceal| is ignored.
For the byte position use |col()|.
For the use of {expr} see |col()|.
When 'virtualedit' is used {expr} can be [lnum, col, off], where
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 23ac10a..2c79617 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 7.3. Last change: 2012 Feb 22
+*options.txt* For Vim version 7.3. Last change: 2012 Mar 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3772,9 +3772,10 @@
'highlight' 'hl' string (default (as a single string):
"8:SpecialKey,@:NonText,d:Directory,
e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,
- M:ModeMsg,n:LineNr,r:Question,
- s:StatusLine,S:StatusLineNC,c:VertSplit,
- t:Title,v:Visual,w:WarningMsg,W:WildMenu,
+ M:ModeMsg,n:LineNr,N:CursorLineNr,
+ r:Question,s:StatusLine,S:StatusLineNC,
+ c:VertSplit, t:Title,v:Visual,
+ w:WarningMsg,W:WildMenu,
f:Folded,F:FoldColumn,A:DiffAdd,
C:DiffChange,D:DiffDelete,T:DiffText,
>:SignColumn,B:SpellBad,P:SpellCap,
@@ -3800,6 +3801,7 @@
|hl-ModeMsg| M Mode (e.g., "-- INSERT --")
|hl-LineNr| n line number for ":number" and ":#" commands, and
when 'number' or 'relativenumber' option is set.
+ |hl-CursorLineNr| N like n for when 'cursorline' is set.
|hl-Question| r |hit-enter| prompt and yes/no questions
|hl-StatusLine| s status line of current window |status-line|
|hl-StatusLineNC| S status lines of not-current windows
@@ -5078,7 +5080,8 @@
number.
When a long, wrapped line doesn't start with the first character, '-'
characters are put before the number.
- See |hl-LineNr| for the highlighting used for the number.
+ See |hl-LineNr| and |hl-CursorLineNr| for the highlighting used for
+ the number.
When setting this option, 'relativenumber' is reset.
*'numberwidth'* *'nuw'*
@@ -5477,7 +5480,8 @@
number.
When a long, wrapped line doesn't start with the first character, '-'
characters are put before the number.
- See |hl-LineNr| for the highlighting used for the number.
+ See |hl-LineNr| and |hl-CursorLineNr| for the highlighting used for
+ the number.
When setting this option, 'number' is reset.
*'remap'* *'noremap'*
@@ -6563,6 +6567,9 @@
evaluated and the result is used as the option value. Example: >
:set statusline=%!MyStatusLine()
< The result can contain %{} items that will be evaluated too.
+ Note that the "%!" expression is evaluated in the context of the
+ current window and buffer, while %{} items are evaluated in the
+ context of the window that the statusline belongs to.
When there is error while evaluating the option then it will be made
empty to avoid further errors. Otherwise screen updating would loop.
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index eec13c0..9a97321 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -1,4 +1,4 @@
-*repeat.txt* For Vim version 7.3. Last change: 2011 Jan 06
+*repeat.txt* For Vim version 7.3. Last change: 2012 Mar 23
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -109,7 +109,7 @@
it was the result of a mapping) {Vi: no recording}
*@*
-@{0-9a-z".=*} Execute the contents of register {0-9a-z".=*} [count]
+@{0-9a-z".=*+} Execute the contents of register {0-9a-z".=*+} [count]
times. Note that register '%' (name of the current
file) and '#' (name of the alternate file) cannot be
used.
@@ -123,8 +123,8 @@
*@@* *E748*
@@ Repeat the previous @{0-9a-z":*} [count] times.
-:[addr]*{0-9a-z".=} *:@* *:star*
-:[addr]@{0-9a-z".=*} Execute the contents of register {0-9a-z".=*} as an Ex
+:[addr]*{0-9a-z".=+} *:@* *:star*
+:[addr]@{0-9a-z".=*+} Execute the contents of register {0-9a-z".=*+} as an Ex
command. First set cursor at line [addr] (default is
current line). When the last line in the register does
not have a <CR> it will be added automatically when
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index e390e4c..84dc78b 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -1,4 +1,4 @@
-*starting.txt* For Vim version 7.3. Last change: 2011 Jul 22
+*starting.txt* For Vim version 7.3. Last change: 2012 Mar 16
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -248,7 +248,8 @@
{not in Vi}
*-g*
--g Start Vim in GUI mode. See |gui|. {not in Vi}
+-g Start Vim in GUI mode. See |gui|. For the opposite see |-v|.
+ {not in Vi}
*-v*
-v Start Ex in Vi mode. Only makes a difference when the
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index e480968..4bd181a 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -1,4 +1,4 @@
-*syntax.txt* For Vim version 7.3. Last change: 2012 Feb 11
+*syntax.txt* For Vim version 7.3. Last change: 2012 Mar 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -199,7 +199,8 @@
If you don't like a distributed syntax file, or you have downloaded a new
version, follow the same steps as for |mysyntaxfile| above. Just make sure
that you write the syntax file in a directory that is early in 'runtimepath'.
-Vim will only load the first syntax file found.
+Vim will only load the first syntax file found, assuming that it sets
+b:current_syntax.
NAMING CONVENTIONS *group-name* *{group-name}* *E669* *W18*
@@ -754,7 +755,8 @@
c_ansi_typedefs ... but do standard ANSI types
c_ansi_constants ... but do standard ANSI constants
c_no_utf don't highlight \u and \U in strings
-c_syntax_for_h use C syntax for *.h files, instead of C++
+c_syntax_for_h for *.h files use C syntax instead of C++ and use objc
+ syntax instead of objcpp
c_no_if0 don't highlight "#if 0" blocks as comments
c_no_cformat don't highlight %-formats in strings
c_no_c99 don't highlight C99 standard items
@@ -4421,6 +4423,8 @@
*hl-LineNr*
LineNr Line number for ":number" and ":#" commands, and when 'number'
or 'relativenumber' option is set.
+ *hl-CursorLineNr*
+CursorLineNr Like LineNr when 'cursorline' is set for the cursor line.
*hl-MatchParen*
MatchParen The character under the cursor or just before it, if it
is a paired bracket, and its match. |pi_paren.txt|
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 4b8ff6e..0ddf7cc 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 7.3. Last change: 2012 Mar 07
+*todo.txt* For Vim version 7.3. Last change: 2012 Mar 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -34,6 +34,8 @@
*known-bugs*
-------------------- Known bugs and current work -----------------------
+Go through list of maintainers that didn't respond. (Thilo Six, Mar 19)
+
Go through more coverity reports.
Discussion about canonicalization of Hebrew. (Ron Aaron, 2011 April 10)
@@ -63,11 +65,8 @@
the window to move unnecessarily. (William E. Skeith III, 2012 Jan 12)
Patch: 2012 Jan 13 Needs more work (2012 Feb 2)
-Patch to highlight cursor line number. (Howard Buchholz (lhb), 2011 Oct 18)
-
URXVT:
- will get stuck if byte sequence does not containe expected semicolon.
-- Patch for urxvt mouse support after shell command. (Issue 31)
- Use urxvt mouse support also in xterm. Explanations:
http://www.midnight-commander.org/ticket/2662
@@ -79,15 +78,6 @@
dialog, there is no dialog to ask whether the existing file should be
overwritten. (Felipe G. Nievinski, 2011 Dec 22)
-Patch for improved ":qa" behavior. (Hirohito Higashi, 2012 Feb 18)
-
-Recognize objcpp. (Austin Ziegler, 2012 Feb 15)
-
-7 Setting an option always sets "w_set_curswant", while this is only
- required for a few options. Only do it for those options to avoid the
- side effect.
-Patch by Kana Natsuno, 2011 Nov 12.
-
Using Ctrl-] in a mapping does not expand abbreviations. Patch by Christian
Brabandt, 2012 Mar 2.
@@ -99,8 +89,6 @@
(Lech Lorens, 2011 Nov 27)
Isn't this already possible? Update 2012 Feb 15.
-Patch for using objcpp file type for headers files. Issue 44.
-
Docs fix for v:register. (Ingo Karkat, 2011 Sep 26, 27)
v:register doesn't work exactly as expected. (David Fishburn, 2011 Sep 20)
@@ -123,6 +111,9 @@
Patch to add completion for :history command. (Dominique Pelle, 2012 Feb 26)
+Patch for 'backupcopy' default behavior for symlinks on Windows. (David Pope,
+2012 Mar 21)
+
Use a count before "v" and "V" to select that many characters or lines?
(Kikyous)
@@ -195,6 +186,9 @@
Win32: Cannot cd into a directory that starts with a space. (Andy Wokula, 2012
Jan 19)
+Win32: default for 'backupcopy' is wrong for a symbolic link. (mklink one
+two). (Benjamin Fritz, 2012 Mar 15)
+
Need to escape $HOME on Windows? (ZyX, 2011 Jul 21)
"2" in 'formatopions' not working in comments. (Christian Corneliussen, 2011
@@ -511,6 +505,8 @@
Test 51 fails when language set to German. (Marco, 2011 Jan 9)
Dominique can't reproduc it.
+'ambiwidth' should be global-local.
+
":function f(x) keepjumps" creates a function where every command is executed
like it has ":keepjumps" before it.
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 0e85688..77f7d1c 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1,4 +1,4 @@
-*usr_41.txt* For Vim version 7.3. Last change: 2011 Dec 15
+*usr_41.txt* For Vim version 7.3. Last change: 2012 Mar 16
VIM USER MANUAL - by Bram Moolenaar
@@ -1710,6 +1710,7 @@
12 set cpo&vim
..
42 let &cpo = s:save_cpo
+ 43 unlet s:save_cpo
We first store the old value of 'cpoptions' in the s:save_cpo variable. At
the end of the plugin this value is restored.
@@ -1956,6 +1957,7 @@
40 endif
41
42 let &cpo = s:save_cpo
+ 43 unlet s:save_cpo
Line 33 wasn't explained yet. It applies the new correction to the word under
the cursor. The |:normal| command is used to use the new abbreviation. Note
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index b9773b7..83d07bc 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2012 Feb 24
+" Last Change: 2012 Mar 28
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -367,7 +367,11 @@
func! s:FTheader()
if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1
- setf objc
+ if exists("g:c_syntax_for_h")
+ setf objc
+ else
+ setf objcpp
+ endif
elseif exists("g:c_syntax_for_h")
setf c
elseif exists("g:ch_syntax_for_h")
diff --git a/runtime/ftplugin/falcon.vim b/runtime/ftplugin/falcon.vim
index 776db80..2e1e7fa 100644
--- a/runtime/ftplugin/falcon.vim
+++ b/runtime/ftplugin/falcon.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Falcon
" Author: Steven Oliver <oliver.steven@gmail.com>
-" Copyright: Copyright (c) 2009, 2010, 2011 Steven Oliver
+" Copyright: Copyright (c) 2009, 2010, 2011, 2012 Steven Oliver
" License: You may redistribute this under the same terms as Vim itself
" --------------------------------------------------------------------------
" GetLatestVimScripts: 2762 1 :AutoInstall: falcon.vim
@@ -40,6 +40,10 @@
\ "All Files (*.*)\t*.*\n"
endif
+let b:undo_ftplugin = "setlocal tabstop< shiftwidth< expandtab< fileencoding<"
+ \ . " suffixesadd< comments<"
+ \ . "| unlet! b:browsefiler"
+
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/kwt.vim b/runtime/ftplugin/kwt.vim
index 6d4b8fd..05b40d4 100644
--- a/runtime/ftplugin/kwt.vim
+++ b/runtime/ftplugin/kwt.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Kimwitu++
" Maintainer: Michael Piefel <entwurf@piefel.de>
-" Last Change: 10 December 2011
+" Last Change: 10 March 2012
" Behaves almost like C++
runtime! ftplugin/cpp.vim ftplugin/cpp_*.vim ftplugin/cpp/*.vim
@@ -20,5 +20,13 @@
" Set the errorformat for the Kimwitu++ compiler
set efm+=kc%.%#:\ error\ at\ %f:%l:\ %m
+if exists("b:undo_ftplugin")
+ let b:undo_ftplugin = b:undo_ftplugin . " | setlocal efm<"
+ \ . "| unlet! b:browsefiler"
+else
+ let b:undo_ftplugin = "setlocal efm<"
+ \ . "| unlet! b:browsefiler"
+endif
+
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim
index de8a047..5feb152 100644
--- a/runtime/ftplugin/vim.vim
+++ b/runtime/ftplugin/vim.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Vim
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2009 Jan 22
+" Last Change: 2012 Mar 21
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -21,6 +21,10 @@
" and insert the comment leader when hitting <CR> or using "o".
setlocal fo-=t fo+=croql
+" To make syntax highlighting of 'vimVar's work correctly we need the colon to
+" be part of keywords. This needs to be done prior to the 'isk+=#' below.
+setlocal isk+=:
+
" To allow tag lookup via CTRL-] for autoload functions, '#' must be a
" keyword character. E.g., for netrw#Nread().
setlocal isk+=#
diff --git a/runtime/indent/dtd.vim b/runtime/indent/dtd.vim
index 4350dfb..88c0c51 100644
--- a/runtime/indent/dtd.vim
+++ b/runtime/indent/dtd.vim
@@ -322,3 +322,4 @@
endfunction
let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/indent/tex.vim b/runtime/indent/tex.vim
index dcfbccd..8e2a5da 100644
--- a/runtime/indent/tex.vim
+++ b/runtime/indent/tex.vim
@@ -1,33 +1,54 @@
" Vim indent file
" Language: LaTeX
-" Maintainer: Zhou YiChao <broken.zhou@gmail.com>
+" Maintainer: Zhou YiChao <broken.zhou AT gmail.com>
" Created: Sat, 16 Feb 2002 16:50:19 +0100
-" Last Change: 2011 Dec 24
-" Last Update: 25th Sep 2002, by LH :
+" Last Change: 2012 Mar 18 19:19:50
+" Version: 0.7
+" Please email me if you found something we can do. Bug report and
+" feature request is welcome.
+
+" Last Update: {{{
+" 25th Sep 2002, by LH :
" (*) better support for the option
" (*) use some regex instead of several '||'.
" Oct 9th, 2003, by JT:
" (*) don't change indentation of lines starting with '%'
-" 2005/06/15, Moshe Kaminsky <kaminsky@math.huji.ac.il>
+" 2005/06/15, Moshe Kaminsky <kaminsky AT math.huji.ac.il>
" (*) New variables:
" g:tex_items, g:tex_itemize_env, g:tex_noindent_env
-" 2011/3/6, by Zhou YiChao <broken.zhou@gmail.com>
+" 2011/3/6, by Zhou YiChao <broken.zhou AT gmail.com>
" (*) Don't change indentation of lines starting with '%'
" I don't see any code with '%' and it doesn't work properly
" so I add some code.
" (*) New features: Add smartindent-like indent for "{}" and "[]".
" (*) New variables: g:tex_indent_brace
-" 2011/9/25, by Zhou Yichao <broken.zhou@gmail.com>
+" 2011/9/25, by Zhou Yichao <broken.zhou AT gmail.com>
" (*) Bug fix: smartindent-like indent for "[]"
" (*) New features: Align with "&".
-" (*) New variable: g:tex_indent_and
-" 2011/10/23 by Zhou Yichao <broken.zhou@gmail.com>
+" (*) New variable: g:tex_indent_and.
+" 2011/10/23 by Zhou Yichao <broken.zhou AT gmail.com>
" (*) Bug fix: improve the smartindent-like indent for "{}" and
" "[]".
-"
-" Version: 0.62
+" 2012/02/27 by Zhou Yichao <broken.zhou AT gmail.com>
+" (*) Bug fix: support default folding marker.
+" (*) Indent with "&" is not very handy. Make it not enable by
+" default.
+" 2012/03/06 by Zhou Yichao <broken.zhou AT gmail.com>
+" (*) Modify "&" behavior and make it default again. Now "&"
+" won't align when there are more then one "&" in the previous
+" line.
+" (*) Add indent "\left(" and "\right)"
+" (*) Trust user when in "verbatim" and "lstlisting"
+" 2012/03/11 by Zhou Yichao <broken.zhou AT gmail.com>
+" (*) Modify "&" so that only indent when current line start with
+" "&".
+" 2012/03/12 by Zhou Yichao <broken.zhou AT gmail.com>
+" (*) Modify indentkeys.
+" 2012/03/18 by Zhou Yichao <broken.zhou AT gmail.com>
+" (*) Add &cpo
+" }}}
-" Options: {{{
+" Document: {{{
"
" To set the following options (ok, currently it's just one), add a line like
" let g:tex_indent_items = 1
@@ -37,42 +58,42 @@
"
" If this variable is unset or non-zero, it will use smartindent-like style
" for "{}" and "[]"
-"
+"
" * g:tex_indent_items
"
" If this variable is set, item-environments are indented like Emacs does
" it, i.e., continuation lines are indented with a shiftwidth.
-"
+"
" NOTE: I've already set the variable below; delete the corresponding line
" if you don't like this behaviour.
"
" Per default, it is unset.
-"
+"
" set unset
" ----------------------------------------------------------------
-" \begin{itemize} \begin{itemize}
+" \begin{itemize} \begin{itemize}
" \item blablabla \item blablabla
-" bla bla bla bla bla bla
+" bla bla bla bla bla bla
" \item blablabla \item blablabla
-" bla bla bla bla bla bla
-" \end{itemize} \end{itemize}
+" bla bla bla bla bla bla
+" \end{itemize} \end{itemize}
"
"
" * g:tex_items
"
-" A list of tokens to be considered as commands for the beginning of an item
-" command. The tokens should be separated with '\|'. The initial '\' should
+" A list of tokens to be considered as commands for the beginning of an item
+" command. The tokens should be separated with '\|'. The initial '\' should
" be escaped. The default is '\\bibitem\|\\item'.
"
" * g:tex_itemize_env
-"
-" A list of environment names, separated with '\|', where the items (item
-" commands matching g:tex_items) may appear. The default is
+"
+" A list of environment names, separated with '\|', where the items (item
+" commands matching g:tex_items) may appear. The default is
" 'itemize\|description\|enumerate\|thebibliography'.
"
" * g:tex_noindent_env
"
-" A list of environment names. separated with '\|', where no indentation is
+" A list of environment names. separated with '\|', where no indentation is
" required. The default is 'document\|verbatim'.
"
" * g:tex_indent_and
@@ -82,14 +103,24 @@
" Note that this feature need to search back some line, so vim may become
" a little slow.
"
-" }}}
+" }}}
+
+" Only define the function once
+if exists("*GetTeXIndent")
+ finish
+endif
if exists("b:did_indent")
finish
endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" Define global variable {{{
+
let b:did_indent = 1
-" Delete the next line to avoid the special indention of items
if !exists("g:tex_indent_items")
let g:tex_indent_items = 1
endif
@@ -104,31 +135,30 @@
let g:tex_itemize_env = 'itemize\|description\|enumerate\|thebibliography'
endif
if !exists('g:tex_items')
- let g:tex_items = '\\bibitem\|\\item'
+ let g:tex_items = '\\bibitem\|\\item'
endif
else
let g:tex_items = ''
endif
-if !exists("g:tex_noindent_env")
- let g:tex_noindent_env = 'document\|verbatim\|lstlisting'
+if !exists("g:tex_indent_paretheses")
+ let g:tex_indent_paretheses = 1
endif
+if !exists("g:tex_noindent_env")
+ let g:tex_noindent_env = 'document\|verbatim\|lstlisting'
+endif "}}}
+
+" VIM Setting " {{{
setlocal autoindent
setlocal nosmartindent
setlocal indentexpr=GetTeXIndent()
-exec 'setlocal indentkeys+=},],\&' . substitute(g:tex_items, '^\|\(\\|\)', ',=', 'g')
-let g:tex_items = '^\s*' . g:tex_items
+setlocal indentkeys&
+exec 'setlocal indentkeys+=[,(,{,),},],\&' . substitute(g:tex_items, '^\|\(\\|\)', ',=', 'g')
+let g:tex_items = '^\s*' . substitute(g:tex_items, '^\(\^\\s\*\)*', '', '')
+" }}}
-
-" Only define the function once
-if exists("*GetTeXIndent") | finish
-endif
-
-let s:cpo_save = &cpo
-set cpo&vim
-
-function GetTeXIndent()
+function GetTeXIndent() " {{{
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)
@@ -139,16 +169,25 @@
" At the start of the file use zero indent.
if lnum == 0
- return 0
+ return 0
endif
- let line = getline(lnum) " last line
- let cline = getline(v:lnum) " current line
+ let line = substitute(getline(lnum), '%.*', ' ','g') " last line
+ let cline = substitute(getline(v:lnum), '%.*', ' ', 'g') " current line
+ " We are in verbatim, so do what our user what.
+ if synIDattr(synID(v:lnum, indent(v:lnum), 1), "name") == "texZone"
+ if empty(cline)
+ return indent(lnum)
+ else
+ return indent(v:lnum)
+ end
+ endif
+
" You want to align with "&"
if g:tex_indent_and
- " Align with last line if last line has a "&"
- if stridx(cline, "&") != -1 && stridx(line, "&") != -1
+ " Align only when current line start with "&"
+ if line =~ '&.*\\\\' && cline =~ '^\s*&'
return indent(v:lnum) + stridx(line, "&") - stridx(cline, "&")
endif
@@ -161,7 +200,7 @@
if lnum == 0
- return 0
+ return 0
endif
let ind = indent(lnum)
@@ -173,12 +212,10 @@
" Add a 'shiftwidth' after beginning of environments.
" Don't add it for \begin{document} and \begin{verbatim}
- ""if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim'
+ ""if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim'
" LH modification : \begin does not always start a line
" ZYC modification : \end after \begin won't cause wrong indent anymore
if line =~ '\\begin{.*}' && line !~ g:tex_noindent_env
- \ && line !~ '\\begin{.\{-}}.*\\end{.*}'
-
let ind = ind + &sw
if g:tex_indent_items
@@ -189,9 +226,8 @@
endif
endif
-
" Subtract a 'shiftwidth' when an environment ends
- if cline =~ '^\s*\\end' && cline !~ g:tex_noindent_env
+ if cline =~ '\\end{.*}' && cline !~ g:tex_noindent_env
if g:tex_indent_items
" Remove another sw for item-environments
@@ -204,23 +240,26 @@
endif
if g:tex_indent_brace
- " Add a 'shiftwidth' after a "{" or "[".
let sum1 = 0
for i in range(0, strlen(line)-1)
- if line[i] == "}" || line[i] == "]"
+ if line[i] == "}" || line[i] == "]" ||
+ \ strpart(line, i, 7) == '\right)'
let sum1 = max([0, sum1-1])
endif
- if line[i] == "{" || line[i] == "["
+ if line[i] == "{" || line[i] == "[" ||
+ \ strpart(line, i, 6) == '\left('
let sum1 += 1
endif
endfor
let sum2 = 0
for i in reverse(range(0, strlen(cline)-1))
- if cline[i] == "{" || cline[i] == "["
+ if cline[i] == "{" || cline[i] == "[" ||
+ \ strpart(cline, i, 6) == '\left('
let sum2 = max([0, sum2-1])
endif
- if cline[i] == "}" || cline[i] == "]"
+ if cline[i] == "}" || cline[i] == "]" ||
+ \ strpart(cline, i, 7) == '\right)'
let sum2 += 1
endif
endfor
@@ -228,6 +267,8 @@
let ind += (sum1 - sum2) * &sw
endif
+ if g:tex_indent_paretheses
+ endif
" Special treatment for 'item'
" ----------------------------
@@ -247,7 +288,7 @@
endif
return ind
-endfunction
+endfunction "}}}
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/macros/matchit.vim b/runtime/macros/matchit.vim
index 549c26c..03dae6a 100644
--- a/runtime/macros/matchit.vim
+++ b/runtime/macros/matchit.vim
@@ -808,5 +808,6 @@
endfun
let &cpo = s:save_cpo
+unlet s:save_cpo
" vim:sts=2:sw=2:
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
index 1497499..355e8eb 100644
--- a/runtime/syntax/sh.vim
+++ b/runtime/syntax/sh.vim
@@ -2,8 +2,8 @@
" Language: shell (sh) Korn shell (ksh) bash (sh)
" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
-" Last Change: Dec 09, 2011
-" Version: 121
+" Last Change: Mar 19, 2012
+" Version: 122
" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
" For options and settings, please use: :help ft-sh-syntax
" This file includes many ideas from ?ric Brunet (eric.brunet@ens.fr)
@@ -263,6 +263,7 @@
if exists("b:is_kornshell") || exists("b:is_bash")
syn region shCommandSub matchgroup=shCmdSubRegion start="\$(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList
+ syn region shArithmetic matchgroup=shArithRegion start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList
syn match shSkipInitWS contained "^\s\+"
elseif !exists("g:sh_no_error")
syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList