Mercurial > vim
annotate runtime/ftplugin/context.vim @ 32975:71cbad0921c9
runtime: Remove Brams name from a few more runtime files (#12780)
Commit: https://github.com/vim/vim/commit/e8d6f03f6a61f60de6893253621d057f63dd6a23
Author: Christian Brabandt <cb@256bit.org>
Date: Wed Aug 23 20:23:07 2023 +0100
runtime: Remove Brams name from a few more runtime files (https://github.com/vim/vim/issues/12780)
syntax/model.vim: minor wording improvement
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Adri Verhoef <a3@a3.xs4all.nl>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 24 Aug 2023 07:33:28 +0200 |
parents | 2acb87ee55fc |
children | d81556766132 |
rev | line source |
---|---|
29756 | 1 vim9script |
2 | |
3 # Vim filetype plugin file | |
4 # Language: ConTeXt typesetting engine | |
5 # Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> | |
6 # Former Maintainers: Nikolai Weibull <now@bitwi.se> | |
7 # Latest Revision: 2022 Aug 12 | |
375 | 8 |
9 if exists("b:did_ftplugin") | |
10 finish | |
11 endif | |
12 | |
29756 | 13 import autoload '../autoload/context.vim' |
14 | |
15 b:did_ftplugin = 1 | |
375 | 16 |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
17 if !exists('current_compiler') |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
18 compiler context |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
19 endif |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
20 |
29756 | 21 b:undo_ftplugin = "setl com< cms< def< inc< sua< fo< ofu<" |
375 | 22 |
29756 | 23 setlocal comments=b:%D,b:%C,b:%M,:% |
24 setlocal commentstring=%\ %s | |
25 setlocal formatoptions+=tjcroql2 | |
26 setlocal omnifunc=context.Complete | |
27 setlocal suffixesadd=.tex,.mkxl,.mkvi,.mkiv,.mkii | |
375 | 28 |
29756 | 29 &l:define = '\\\%([egx]\|char\|mathchar\|count\|dimen\|muskip\|skip\|toks\)\=' |
30 .. 'def\|\\font\|\\\%(future\)\=let' | |
31 .. '\|\\new\%(count\|dimen\|skip\|muskip\|box\|toks\|read\|write' | |
32 .. '\|fam\|insert\|if\)' | |
375 | 33 |
29756 | 34 &l:include = '^\s*\\\%(input\|component\|product\|project\|environment\)' |
375 | 35 |
29756 | 36 if exists("g:loaded_matchit") && !exists("b:match_words") |
37 b:match_ignorecase = 0 | |
38 b:match_skip = 'r:\\\@<!\%(\\\\\)*%' | |
39 b:match_words = '(:),\[:],{:},\\(:\\),\\\[:\\],\\start\(\a\+\):\\stop\1' | |
40 b:undo_ftplugin ..= "| unlet! b:match_ignorecase b:match_words b:match_skip" | |
1698 | 41 endif |
375 | 42 |
29756 | 43 if !get(g:, 'no_context_maps', 0) && !get(g:, 'no_plugin_maps', 0) |
44 const context_regex = { | |
45 'beginsection': '\\\%(start\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>', | |
46 'endsection': '\\\%(stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>', | |
47 'beginblock': '\\\%(start\|setup\|define\)', | |
48 'endblock': '\\\%(stop\|setup\|define\)', | |
49 } | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
50 |
29756 | 51 def UndoMap(mapping: string, modes: string) |
52 for mode in modes | |
53 b:undo_ftplugin ..= printf(" | silent! execute '%sunmap <buffer> %s'", mode, mapping) | |
54 endfor | |
55 enddef | |
56 | |
57 def MoveAround(count: number, what: string, flags: string) | |
58 search(context_regex[what], flags .. 's') # 's' sets previous context mark | |
59 var i = 2 | |
60 while i <= count | |
61 search(context_regex[what], flags) | |
62 i += 1 | |
63 endwhile | |
64 enddef | |
25973 | 65 |
29756 | 66 # Macros to move around |
67 nnoremap <silent><buffer> [[ <scriptcmd>MoveAround(v:count1, "beginsection", "bW")<cr> | |
68 vnoremap <silent><buffer> [[ <scriptcmd>MoveAround(v:count1, "beginsection", "bW")<cr> | |
69 nnoremap <silent><buffer> ]] <scriptcmd>MoveAround(v:count1, "beginsection", "W") <cr> | |
70 vnoremap <silent><buffer> ]] <scriptcmd>MoveAround(v:count1, "beginsection", "W") <cr> | |
71 nnoremap <silent><buffer> [] <scriptcmd>MoveAround(v:count1, "endsection", "bW")<cr> | |
72 vnoremap <silent><buffer> [] <scriptcmd>MoveAround(v:count1, "endsection", "bW")<cr> | |
73 nnoremap <silent><buffer> ][ <scriptcmd>MoveAround(v:count1, "endsection", "W") <cr> | |
74 vnoremap <silent><buffer> ][ <scriptcmd>MoveAround(v:count1, "endsection", "W") <cr> | |
75 nnoremap <silent><buffer> [{ <scriptcmd>MoveAround(v:count1, "beginblock", "bW")<cr> | |
76 vnoremap <silent><buffer> [{ <scriptcmd>MoveAround(v:count1, "beginblock", "bW")<cr> | |
77 nnoremap <silent><buffer> ]} <scriptcmd>MoveAround(v:count1, "endblock", "W") <cr> | |
78 vnoremap <silent><buffer> ]} <scriptcmd>MoveAround(v:count1, "endblock", "W") <cr> | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
79 |
29756 | 80 for mapping in ['[[', ']]', '[]', '][', '[{', ']}'] |
81 UndoMap(mapping, 'nv') | |
82 endfor | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
83 |
29756 | 84 # Other useful mappings |
85 const tp_regex = '?^$\|^\s*\\\(item\|start\|stop\|blank\|\%(sub\)*section\|chapter\|\%(sub\)*subject\|title\|part\)' | |
86 | |
87 def TeXPar() | |
88 cursor(search(tp_regex, 'bcW') + 1, 1) | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
89 normal! V |
29756 | 90 cursor(search(tp_regex, 'W') - 1, 1) |
91 enddef | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
92 |
29756 | 93 # Reflow paragraphs with mappings like gqtp ("gq TeX paragraph") |
94 onoremap <silent><buffer> tp <scriptcmd>TeXPar()<cr> | |
95 # Select TeX paragraph | |
96 vnoremap <silent><buffer> tp <scriptcmd>TeXPar()<cr> | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
97 |
29756 | 98 # $...$ text object |
99 onoremap <silent><buffer> i$ <scriptcmd>normal! T$vt$<cr> | |
100 onoremap <silent><buffer> a$ <scriptcmd>normal! F$vf$<cr> | |
101 vnoremap <buffer> i$ T$ot$ | |
102 vnoremap <buffer> a$ F$of$ | |
25973 | 103 |
29756 | 104 for mapping in ['tp', 'i$', 'a$'] |
105 UndoMap(mapping, 'ov') | |
106 endfor | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
107 endif |
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
108 |
29756 | 109 # Commands for asynchronous typesetting |
110 command! -buffer -nargs=? -complete=buffer ConTeXt context.Typeset(<q-args>) | |
111 command! -buffer -nargs=0 ConTeXtLog context.Log('%') | |
112 command! -nargs=0 ConTeXtJobStatus context.JobStatus() | |
113 command! -nargs=0 ConTeXtStopJobs context.StopJobs() | |
10301
07d2b5a3b7cc
commit https://github.com/vim/vim/commit/46fceaaa8d1447a9588736d86eb4908214187b08
Christian Brabandt <cb@256bit.org>
parents:
1698
diff
changeset
|
114 |
29756 | 115 # vim: sw=2 fdm=marker |