Mercurial > vim
annotate runtime/ftplugin/context.vim @ 32503:5d07e7e9580f v9.0.1583
patch 9.0.1583: get E304 when using 'cryptmethod' "xchacha20v2"
Commit: https://github.com/vim/vim/commit/3a2a60ce4a8e73594bca16814672fcc243d093ac
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 27 18:02:55 2023 +0100
patch 9.0.1583: get E304 when using 'cryptmethod' "xchacha20v2"
Problem: Get E304 when using 'cryptmethod' "xchacha20v2". (Steve Mynott)
Solution: Add 4th crypt method to block zero ID check. Avoid syncing a swap
file before reading the file. (closes #12433)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 27 May 2023 19:15:04 +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 |