Mercurial > vim
annotate runtime/ftplugin/context.vim @ 32814:cf6d98955c64 v9.0.1721
patch 9.0.1721: Build failure on Windows with dynamic lua
Commit: https://github.com/vim/vim/commit/4112acae0816e3f64c082b1e773dd5f4a100685e
Author: zeertzjq <zeertzjq@outlook.com>
Date: Wed Aug 16 07:29:28 2023 +0800
patch 9.0.1721: Build failure on Windows with dynamic lua
Problem: Build failure on Windows with dynamic lua (after 9.0.1719)
Solution: move definition further down in if_lua
closes: #12811
closes: #12814
closes: #12818
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 16 Aug 2023 20:51:33 +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 |