annotate runtime/indent/tex.vim @ 12976:1a4d7b63c490

Added tag v8.0.1363 for changeset e311187347c151f04af9cd3a39641bfd1b5e105d
author Christian Brabandt <cb@256bit.org>
date Sat, 02 Dec 2017 15:15:06 +0100
parents 63b0b7b79b25
children a62eeee5f116
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim indent file
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2 " Language: LaTeX
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
3 " Maintainer: Yichao Zhou <broken.zhou AT gmail.com>
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
4 " Created: Sat, 16 Feb 2002 16:50:19 +0100
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
5 " Version: 0.9.4
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
6 " Please email me if you found something I can do. Comments, bug report and
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
7 " feature request are welcome.
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
8
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
9 " Last Update: {{{
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
10 " 25th Sep 2002, by LH :
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 " (*) better support for the option
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 " (*) use some regex instead of several '||'.
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 " Oct 9th, 2003, by JT:
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 " (*) don't change indentation of lines starting with '%'
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
15 " 2005/06/15, Moshe Kaminsky <kaminsky AT math.huji.ac.il>
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 " (*) New variables:
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17 " g:tex_items, g:tex_itemize_env, g:tex_noindent_env
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
18 " 2011/3/6, by Yichao Zhou <broken.zhou AT gmail.com>
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 " (*) Don't change indentation of lines starting with '%'
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 " I don't see any code with '%' and it doesn't work properly
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 " so I add some code.
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 " (*) New features: Add smartindent-like indent for "{}" and "[]".
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 " (*) New variables: g:tex_indent_brace
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
24 " 2011/9/25, by Yichao Zhou <broken.zhou AT gmail.com>
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25 " (*) Bug fix: smartindent-like indent for "[]"
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 " (*) New features: Align with "&".
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
27 " (*) New variable: g:tex_indent_and.
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
28 " 2011/10/23 by Yichao Zhou <broken.zhou AT gmail.com>
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 " (*) Bug fix: improve the smartindent-like indent for "{}" and
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 " "[]".
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
31 " 2012/02/27 by Yichao Zhou <broken.zhou AT gmail.com>
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
32 " (*) Bug fix: support default folding marker.
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
33 " (*) Indent with "&" is not very handy. Make it not enable by
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
34 " default.
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
35 " 2012/03/06 by Yichao Zhou <broken.zhou AT gmail.com>
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
36 " (*) Modify "&" behavior and make it default again. Now "&"
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
37 " won't align when there are more then one "&" in the previous
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
38 " line.
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
39 " (*) Add indent "\left(" and "\right)"
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
40 " (*) Trust user when in "verbatim" and "lstlisting"
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
41 " 2012/03/11 by Yichao Zhou <broken.zhou AT gmail.com>
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
42 " (*) Modify "&" so that only indent when current line start with
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
43 " "&".
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
44 " 2012/03/12 by Yichao Zhou <broken.zhou AT gmail.com>
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
45 " (*) Modify indentkeys.
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
46 " 2012/03/18 by Yichao Zhou <broken.zhou AT gmail.com>
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
47 " (*) Add &cpo
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
48 " 2013/05/02 by Yichao Zhou <broken.zhou AT gmail.com>
4437
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3445
diff changeset
49 " (*) Fix problem about GetTeXIndent checker. Thank Albert Netymk
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3445
diff changeset
50 " for reporting this.
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
51 " 2014/06/23 by Yichao Zhou <broken.zhou AT gmail.com>
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
52 " (*) Remove the feature g:tex_indent_and because it is buggy.
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
53 " (*) If there is not any obvious indentation hints, we do not
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
54 " alert our user's current indentation.
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
55 " (*) g:tex_indent_brace now only works if the open brace is the
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
56 " last character of that line.
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
57 " 2014/08/03 by Yichao Zhou <broken.zhou AT gmail.com>
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
58 " (*) Indent current line if last line has larger indentation
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
59 " 2016/11/08 by Yichao Zhou <broken.zhou AT gmail.com>
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
60 " (*) Fix problems for \[ and \]. Thanks Bruno for reporting.
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
61 " 2017/04/30 by Yichao Zhou <broken.zhou AT gmail.com>
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
62 " (*) Fix a bug between g:tex_noindent_env and g:tex_indent_items
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
63 " Now g:tex_noindent_env='document\|verbatim\|itemize' (Emacs
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
64 " style) is supported. Thanks Miles Wheeler for reporting.
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
65 "
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
66 " }}}
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
67
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
68 " Document: {{{
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
69 "
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
70 " To set the following options (ok, currently it's just one), add a line like
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
71 " let g:tex_indent_items = 1
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
72 " to your ~/.vimrc.
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
73 "
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
74 " * g:tex_indent_brace
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75 "
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
76 " If this variable is unset or non-zero, it will use smartindent-like style
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
77 " for "{}" and "[]". Now this only works if the open brace is the last
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
78 " character of that line.
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
79 "
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
80 " % Example 1
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
81 " \usetikzlibrary{
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
82 " external
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
83 " }
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
84 "
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
85 " % Example 2
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
86 " \tikzexternalize[
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
87 " prefix=tikz]
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
88 "
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
89 " * g:tex_indent_items
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
90 "
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
91 " If this variable is set, item-environments are indented like Emacs does
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
92 " it, i.e., continuation lines are indented with a shiftwidth.
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
93 "
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
94 " NOTE: I've already set the variable below; delete the corresponding line
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
95 " if you don't like this behaviour.
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
96 "
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
97 " Per default, it is unset.
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
98 "
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
99 " set unset
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
100 " ----------------------------------------------------------------
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
101 " \begin{itemize} \begin{itemize}
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
102 " \item blablabla \item blablabla
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
103 " bla bla bla bla bla bla
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
104 " \item blablabla \item blablabla
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
105 " bla bla bla bla bla bla
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
106 " \end{itemize} \end{itemize}
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
107 "
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
108 "
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
109 " * g:tex_items
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
110 "
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
111 " A list of tokens to be considered as commands for the beginning of an item
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
112 " command. The tokens should be separated with '\|'. The initial '\' should
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
113 " be escaped. The default is '\\bibitem\|\\item'.
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
114 "
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
115 " * g:tex_itemize_env
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
116 "
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
117 " A list of environment names, separated with '\|', where the items (item
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
118 " commands matching g:tex_items) may appear. The default is
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
119 " 'itemize\|description\|enumerate\|thebibliography'.
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
120 "
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
121 " * g:tex_noindent_env
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
122 "
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
123 " A list of environment names. separated with '\|', where no indentation is
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
124 " required. The default is 'document\|verbatim'.
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
125 " }}}
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
126
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
127 " Only define the function once
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
128 if exists("b:did_indent")
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
129 finish
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
130 endif
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
131
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
132 let s:cpo_save = &cpo
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
133 set cpo&vim
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
134
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
135 " Define global variable {{{
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
136
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
137 let b:did_indent = 1
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
138
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
139 if !exists("g:tex_indent_items")
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
140 let g:tex_indent_items = 1
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
141 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
142 if !exists("g:tex_indent_brace")
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
143 let g:tex_indent_brace = 1
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
144 endif
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
145 if !exists("g:tex_max_scan_line")
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
146 let g:tex_max_scan_line = 60
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
147 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
148 if g:tex_indent_items
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
149 if !exists("g:tex_itemize_env")
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
150 let g:tex_itemize_env = 'itemize\|description\|enumerate\|thebibliography'
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
151 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
152 if !exists('g:tex_items')
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
153 let g:tex_items = '\\bibitem\|\\item'
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
154 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
155 else
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
156 let g:tex_items = ''
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
157 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
158
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
159 if !exists("g:tex_noindent_env")
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
160 let g:tex_noindent_env = 'document\|verbatim\|lstlisting'
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
161 endif "}}}
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
162
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
163 " VIM Setting " {{{
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
164 setlocal autoindent
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
165 setlocal nosmartindent
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
166 setlocal indentexpr=GetTeXIndent()
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
167 setlocal indentkeys&
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
168 exec 'setlocal indentkeys+=[,(,{,),},],\&' . substitute(g:tex_items, '^\|\(\\|\)', ',=', 'g')
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
169 let g:tex_items = '^\s*' . substitute(g:tex_items, '^\(\^\\s\*\)*', '', '')
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
170 " }}}
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
171
4437
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3445
diff changeset
172 function! GetTeXIndent() " {{{
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
173 " Find a non-blank line above the current line.
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
174 let lnum = prevnonblank(v:lnum - 1)
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
175 let cnum = v:lnum
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
176
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
177 " Comment line is not what we need.
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
178 while lnum != 0 && getline(lnum) =~ '^\s*%'
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
179 let lnum = prevnonblank(lnum - 1)
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
180 endwhile
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
181
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
182 " At the start of the file use zero indent.
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
183 if lnum == 0
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
184 return 0
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
185 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
186
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
187 let line = substitute(getline(lnum), '\s*%.*', '','g') " last line
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
188 let cline = substitute(getline(v:lnum), '\s*%.*', '', 'g') " current line
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
189
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
190 " We are in verbatim, so do what our user what.
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
191 if synIDattr(synID(v:lnum, indent(v:lnum), 1), "name") == "texZone"
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
192 if empty(cline)
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
193 return indent(lnum)
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
194 else
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
195 return indent(v:lnum)
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
196 end
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
197 endif
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
198
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
199 if lnum == 0
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
200 return 0
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
201 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
202
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
203 let ind = indent(lnum)
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
204 let stay = 1
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
205
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
206 " New code for comment: retain the indent of current line
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
207 if cline =~ '^\s*%'
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
208 return indent(v:lnum)
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
209 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
210
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
211 " Add a 'shiftwidth' after beginning of environments.
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
212 " Don't add it for \begin{document} and \begin{verbatim}
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
213 " if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim'
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
214 " LH modification : \begin does not always start a line
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
215 " ZYC modification : \end after \begin won't cause wrong indent anymore
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
216 if line =~ '\\begin{.*}'
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
217 if line !~ g:tex_noindent_env
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11442
diff changeset
218 let ind = ind + shiftwidth()
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
219 let stay = 0
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
220 endif
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
221
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
222 if g:tex_indent_items
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
223 " Add another sw for item-environments
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
224 if line =~ g:tex_itemize_env
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11442
diff changeset
225 let ind = ind + shiftwidth()
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
226 let stay = 0
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
227 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
228 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
229 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
230
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
231 if cline =~ '\\end{.*}'
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
232 let retn = s:GetEndIndentation(v:lnum)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
233 if retn != -1
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
234 return retn
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
235 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
236 end
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
237 " Subtract a 'shiftwidth' when an environment ends
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
238 if cline =~ '\\end{.*}'
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
239 \ && cline !~ g:tex_noindent_env
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
240 \ && cline !~ '\\begin{.*}.*\\end{.*}'
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
241 if g:tex_indent_items
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
242 " Remove another sw for item-environments
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
243 if cline =~ g:tex_itemize_env
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11442
diff changeset
244 let ind = ind - shiftwidth()
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
245 let stay = 0
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
246 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
247 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
248
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11442
diff changeset
249 let ind = ind - shiftwidth()
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
250 let stay = 0
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
251 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
252
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
253 if g:tex_indent_brace
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
254 if line =~ '[[{]$'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11442
diff changeset
255 let ind += shiftwidth()
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
256 let stay = 0
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
257 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
258
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
259 if cline =~ '^\s*\\\?[\]}]' && s:CheckPairedIsLastCharacter(v:lnum, indent(v:lnum))
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11442
diff changeset
260 let ind -= shiftwidth()
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
261 let stay = 0
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
262 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
263
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
264 if line !~ '^\s*\\\?[\]}]'
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
265 for i in range(indent(lnum)+1, strlen(line)-1)
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
266 let char = line[i]
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
267 if char == ']' || char == '}'
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
268 if s:CheckPairedIsLastCharacter(lnum, i)
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11442
diff changeset
269 let ind -= shiftwidth()
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
270 let stay = 0
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
271 endif
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
272 endif
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
273 endfor
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
274 endif
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
275 endif
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
276
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
277 " Special treatment for 'item'
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
278 " ----------------------------
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
279
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
280 if g:tex_indent_items
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
281 " '\item' or '\bibitem' itself:
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
282 if cline =~ g:tex_items
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11442
diff changeset
283 let ind = ind - shiftwidth()
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
284 let stay = 0
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
285 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
286 " lines following to '\item' are intented once again:
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
287 if line =~ g:tex_items
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11442
diff changeset
288 let ind = ind + shiftwidth()
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
289 let stay = 0
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
290 endif
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
291 endif
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
292
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
293 if stay
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
294 " If there is no obvious indentation hint, we trust our user.
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
295 if empty(cline)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
296 return ind
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
297 else
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
298 return max([indent(v:lnum), s:GetLastBeginIndentation(v:lnum)])
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
299 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
300 else
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
301 return ind
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
302 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
303 endfunction "}}}
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
304
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
305 function! s:GetLastBeginIndentation(lnum) " {{{
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
306 let matchend = 1
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
307 for lnum in range(a:lnum-1, max([a:lnum - g:tex_max_scan_line, 1]), -1)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
308 let line = getline(lnum)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
309 if line =~ '\\end{.*}'
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
310 let matchend += 1
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
311 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
312 if line =~ '\\begin{.*}'
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
313 let matchend -= 1
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
314 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
315 if matchend == 0
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
316 if line =~ g:tex_noindent_env
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
317 return indent(lnum)
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
318 endif
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
319 if line =~ g:tex_itemize_env
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11442
diff changeset
320 return indent(lnum) + 2 * shiftwidth()
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
321 endif
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11442
diff changeset
322 return indent(lnum) + shiftwidth()
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
323 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
324 endfor
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
325 return -1
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
326 endfunction
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
327
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
328 function! s:GetEndIndentation(lnum) " {{{
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
329 if getline(a:lnum) =~ '\\begin{.*}.*\\end{.*}'
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
330 return -1
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
331 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
332
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
333 let min_indent = 100
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
334 let matchend = 1
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
335 for lnum in range(a:lnum-1, max([a:lnum-g:tex_max_scan_line, 1]), -1)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
336 let line = getline(lnum)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
337 if line =~ '\\end{.*}'
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
338 let matchend += 1
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
339 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
340 if line =~ '\\begin{.*}'
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
341 let matchend -= 1
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
342 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
343 if matchend == 0
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
344 return indent(lnum)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
345 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
346 if !empty(line)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
347 let min_indent = min([min_indent, indent(lnum)])
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
348 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
349 endfor
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11442
diff changeset
350 return min_indent - shiftwidth()
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
351 endfunction
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
352
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
353 " Most of the code is from matchparen.vim
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
354 function! s:CheckPairedIsLastCharacter(lnum, col) "{{{
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
355 let c_lnum = a:lnum
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
356 let c_col = a:col+1
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
357
11442
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
358 let line = getline(c_lnum)
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
359 if line[c_col-1] == '\'
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
360 let c_col = c_col + 1
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
361 endif
d183d629509e Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8392
diff changeset
362 let c = line[c_col-1]
8392
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
363
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
364 let plist = split(&matchpairs, '.\zs[:,]')
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
365 let i = index(plist, c)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
366 if i < 0
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
367 return 0
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
368 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
369
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
370 " Figure out the arguments for searchpairpos().
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
371 if i % 2 == 0
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
372 let s_flags = 'nW'
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
373 let c2 = plist[i + 1]
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
374 else
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
375 let s_flags = 'nbW'
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
376 let c2 = c
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
377 let c = plist[i - 1]
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
378 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
379 if c == '['
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
380 let c = '\['
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
381 let c2 = '\]'
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
382 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
383
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
384 " Find the match. When it was just before the cursor move it there for a
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
385 " moment.
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
386 let save_cursor = winsaveview()
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
387 call cursor(c_lnum, c_col)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
388
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
389 " When not in a string or comment ignore matches inside them.
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
390 " We match "escape" for special items, such as lispEscapeSpecial.
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
391 let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
392 \ '=~? "string\\|character\\|singlequote\\|escape\\|comment"'
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
393 execute 'if' s_skip '| let s_skip = 0 | endif'
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
394
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
395 let stopline = max([0, c_lnum - g:tex_max_scan_line])
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
396
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
397 " Limit the search time to 300 msec to avoid a hang on very long lines.
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
398 " This fails when a timeout is not supported.
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
399 try
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
400 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 100)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
401 catch /E118/
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
402 endtry
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
403
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
404 call winrestview(save_cursor)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
405
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
406 if m_lnum > 0
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
407 let line = getline(m_lnum)
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
408 return strlen(line) == m_col
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
409 endif
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
410
1bf1b88968a2 commit https://github.com/vim/vim/commit/328da0dcb7be34b594725eef6dc98d3ea6516d69
Christian Brabandt <cb@256bit.org>
parents: 4437
diff changeset
411 return 0
3445
2cfb68fa26cd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
412 endfunction "}}}
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
413
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3224
diff changeset
414 let &cpo = s:cpo_save
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3224
diff changeset
415 unlet s:cpo_save
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3224
diff changeset
416
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
417 " vim: set sw=4 textwidth=80: