summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2012-03-28 20:51:51 +0200
committerBram Moolenaar <Bram@vim.org>2012-03-28 20:51:51 +0200
commit61d35bd0201074a70a10e9a2ea5d6a251abf1b20 (patch)
tree3eeefe627f7f1c11cba708301e65ba4c808e5a17 /runtime
parent913077c37c0ba2f70e6b06e9b46d176e8b9e7956 (diff)
Updated runtime files.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/editing.txt8
-rw-r--r--runtime/doc/eval.txt11
-rw-r--r--runtime/doc/options.txt19
-rw-r--r--runtime/doc/repeat.txt8
-rw-r--r--runtime/doc/starting.txt5
-rw-r--r--runtime/doc/syntax.txt10
-rw-r--r--runtime/doc/todo.txt26
-rw-r--r--runtime/doc/usr_41.txt4
-rw-r--r--runtime/filetype.vim8
-rw-r--r--runtime/ftplugin/falcon.vim6
-rw-r--r--runtime/ftplugin/kwt.vim10
-rw-r--r--runtime/ftplugin/vim.vim6
-rw-r--r--runtime/indent/dtd.vim1
-rw-r--r--runtime/indent/tex.vim153
-rw-r--r--runtime/macros/matchit.vim1
-rw-r--r--runtime/syntax/sh.vim5
16 files changed, 179 insertions, 102 deletions
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index 17a8ca3839..977a94dce2 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 @@ MULTIPLE WINDOWS AND BUFFERS *window-exit*
*: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 ce4c41b7ee..cb0dbc01ce 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 @@ glob({expr} [, {nosuf} [, {list}]]) *glob()*
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 @@ tabpagebuflist([{arg}]) *tabpagebuflist()*
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 @@ virtcol({expr}) *virtcol()*
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 23ac10a61f..2c79617b27 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 @@ A jump table for the options with a short description can be found at |Q_op|.
'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 @@ A jump table for the options with a short description can be found at |Q_op|.
|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 @@ A jump table for the options with a short description can be found at |Q_op|.
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 @@ A jump table for the options with a short description can be found at |Q_op|.
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 @@ A jump table for the options with a short description can be found at |Q_op|.
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 eec13c0e23..9a97321eb4 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 @@ q Stops recording. (Implementation note: The 'q' that
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 @@ q Stops recording. (Implementation note: The 'q' that
*@@* *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 e390e4c8a6..84dc78b312 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 @@ a slash. Thus "-R" means recovery and "-/R" readonly.
{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 e480968f90..4bd181aca0 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 @@ REPLACING AN EXISTING SYNTAX FILE *mysyntaxfile-replace*
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_no_ansi don't do standard ANSI types and constants
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 @@ IncSearch 'incsearch' highlighting; also used for the text replaced with
*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 4b8ff6e034..0ddf7cc704 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 @@ not be repeated below, unless there is extra information.
*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 @@ Win32: When the taskbar is at the top of the screen creating the tabbar causes
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 @@ When exiting with unsaved changes, selecting an existing file in the file
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 @@ Patch for option in 'cino' to specify more indent for continued conditions.
(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 @@ Matsumoto, 2012 Jan 30)
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 @@ Sep 17) Asked for feedback from others.
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 @@ path.
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 0e85688d06..77f7d1c350 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 @@ make the script work for most people. It is done like this: >
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 @@ Here is the resulting complete example: >
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 b9773b7148..83d07bc102 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 @@ au BufNewFile,BufRead *.h call s:FTheader()
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 776db8013a..2e1e7fafb6 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 @@ if has("gui_win32") && !exists("b:browsefilter")
\ "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 6d4b8fdbf6..05b40d4e29 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 @@ endif
" 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 de8a047982..5feb152712 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 @@ let b:undo_ftplugin = "setl fo< isk< com< tw< commentstring<"
" 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 4350dfbe2f..88c0c5129e 100644
--- a/runtime/indent/dtd.vim
+++ b/runtime/indent/dtd.vim
@@ -322,3 +322,4 @@ function GetDTDIndent()
endfunction
let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/indent/tex.vim b/runtime/indent/tex.vim
index dcfbccdbe5..8e2a5daa8c 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 @@ if g:tex_indent_items
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_indent_paretheses")
+ let g:tex_indent_paretheses = 1
+endif
+
if !exists("g:tex_noindent_env")
let g:tex_noindent_env = 'document\|verbatim\|lstlisting'
-endif
+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
-
-
-" Only define the function once
-if exists("*GetTeXIndent") | finish
-endif
-
-let s:cpo_save = &cpo
-set cpo&vim
+setlocal indentkeys&
+exec 'setlocal indentkeys+=[,(,{,),},],\&' . substitute(g:tex_items, '^\|\(\\|\)', ',=', 'g')
+let g:tex_items = '^\s*' . substitute(g:tex_items, '^\(\^\\s\*\)*', '', '')
+" }}}
-function GetTeXIndent()
+function GetTeXIndent() " {{{
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)
@@ -139,16 +169,25 @@ function GetTeXIndent()
" 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 @@ function GetTeXIndent()
if lnum == 0
- return 0
+ return 0
endif
let ind = indent(lnum)
@@ -173,12 +212,10 @@ function GetTeXIndent()
" 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 @@ function GetTeXIndent()
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 @@ function GetTeXIndent()
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 @@ function GetTeXIndent()
let ind += (sum1 - sum2) * &sw
endif
+ if g:tex_indent_paretheses
+ endif
" Special treatment for 'item'
" ----------------------------
@@ -247,7 +288,7 @@ function GetTeXIndent()
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 549c26cf31..03dae6a2f7 100644
--- a/runtime/macros/matchit.vim
+++ b/runtime/macros/matchit.vim
@@ -808,5 +808,6 @@ fun! s:ParseSkip(str)
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 1497499c59..355e8eb918 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 @@ syn match shEscape contained '\\.' contains=@shCommandSubList
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