Mercurial > vim
annotate runtime/indent/context.vim @ 17433:ca8e754bdd53
Update runtime files
commit https://github.com/vim/vim/commit/85850f3a5ef9f5a9d22e908ef263de8faa265a95
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jul 19 22:05:51 2019 +0200
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 19 Jul 2019 22:15:08 +0200 |
parents | 07d2b5a3b7cc |
children | f00c56ee8118 |
rev | line source |
---|---|
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " ConTeXt indent file |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 " Language: ConTeXt typesetting engine |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 " Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 " Last Change: 2016 Oct 15 |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 if exists("b:did_indent") |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 finish |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 endif |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 if !get(b:, 'context_metapost', get(g:, 'context_metapost', 1)) |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 finish |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 endif |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 " Load MetaPost indentation script |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 runtime! indent/mp.vim |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 let s:keepcpo= &cpo |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 set cpo&vim |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 setlocal indentexpr=GetConTeXtIndent() |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 let b:undo_indent = "setl indentexpr<" |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 function! GetConTeXtIndent() |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 " Use MetaPost rules inside MetaPost graphic environments |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 if len(synstack(v:lnum, 1)) > 0 && |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 \ synIDattr(synstack(v:lnum, 1)[0], "name") ==# 'contextMPGraphic' |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 return GetMetaPostIndent() |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 endif |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 return -1 |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 endfunc |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 let &cpo = s:keepcpo |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 unlet s:keepcpo |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 " vim:sw=2 |