comparison runtime/ftplugin/context.vim @ 25973:3b34837f4538

Update runtime files Commit: https://github.com/vim/vim/commit/2286304cdbba53ceb52b3ba2ba4a521b0a2f8d0f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 16 15:23:36 2021 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Sat, 16 Oct 2021 16:30:07 +0200
parents 169a62d5bcb9
children 2acb87ee55fc
comparison
equal deleted inserted replaced
25972:3856b7d0d996 25973:3b34837f4538
1 " Vim filetype plugin file 1 " Vim filetype plugin file
2 " Language: ConTeXt typesetting engine 2 " Language: ConTeXt typesetting engine
3 " Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> 3 " Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com>
4 " Former Maintainers: Nikolai Weibull <now@bitwi.se> 4 " Former Maintainers: Nikolai Weibull <now@bitwi.se>
5 " Latest Revision: 2016 Oct 30 5 " Latest Revision: 2021 Oct 15
6 6
7 if exists("b:did_ftplugin") 7 if exists("b:did_ftplugin")
8 finish 8 finish
9 endif 9 endif
10 let b:did_ftplugin = 1 10 let b:did_ftplugin = 1
15 if !exists('current_compiler') 15 if !exists('current_compiler')
16 compiler context 16 compiler context
17 endif 17 endif
18 18
19 let b:undo_ftplugin = "setl com< cms< def< inc< sua< fo< ofu<" 19 let b:undo_ftplugin = "setl com< cms< def< inc< sua< fo< ofu<"
20 \ . "| unlet! b:match_ignorecase b:match_words b:match_skip"
21 20
22 setlocal comments=b:%D,b:%C,b:%M,:% commentstring=%\ %s formatoptions+=tjcroql2 21 setlocal comments=b:%D,b:%C,b:%M,:% commentstring=%\ %s formatoptions+=tjcroql2
23 if get(b:, 'context_metapost', get(g:, 'context_metapost', 1)) 22 if get(b:, 'context_metapost', get(g:, 'context_metapost', 1))
24 setlocal omnifunc=contextcomplete#Complete 23 setlocal omnifunc=contextcomplete#Complete
25 let g:omni_syntax_group_include_context = 'mf\w\+,mp\w\+' 24 let g:omni_syntax_group_include_context = 'mf\w\+,mp\w\+'
33 32
34 let &l:include = '^\s*\\\%(input\|component\|product\|project\|environment\)' 33 let &l:include = '^\s*\\\%(input\|component\|product\|project\|environment\)'
35 34
36 setlocal suffixesadd=.tex 35 setlocal suffixesadd=.tex
37 36
38 if exists("loaded_matchit") 37 if exists("loaded_matchit") && !exists("b:match_words")
39 let b:match_ignorecase = 0 38 let b:match_ignorecase = 0
40 let b:match_skip = 'r:\\\@<!\%(\\\\\)*%' 39 let b:match_skip = 'r:\\\@<!\%(\\\\\)*%'
41 let b:match_words = '(:),\[:],{:},\\(:\\),\\\[:\\],' . 40 let b:match_words = '(:),\[:],{:},\\(:\\),\\\[:\\],' .
42 \ '\\start\(\a\+\):\\stop\1' 41 \ '\\start\(\a\+\):\\stop\1'
42 let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words b:match_skip"
43 endif 43 endif
44 44
45 let s:context_regex = { 45 let s:context_regex = {
46 \ 'beginsection' : '\\\%(start\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>', 46 \ 'beginsection' : '\\\%(start\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>',
47 \ 'endsection' : '\\\%(stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>', 47 \ 'endsection' : '\\\%(stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>',
55 endif 55 endif
56 call search(s:context_regex[a:what], a:flags.'s') " 's' sets previous context mark 56 call search(s:context_regex[a:what], a:flags.'s') " 's' sets previous context mark
57 call map(range(2, a:count), 'search(s:context_regex[a:what], a:flags)') 57 call map(range(2, a:count), 'search(s:context_regex[a:what], a:flags)')
58 endfunction 58 endfunction
59 59
60 " Move around macros. 60 if !exists("no_plugin_maps") && !exists("no_context_maps")
61 nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR> 61 " Move around macros.
62 vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true) <CR> 62 nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR>
63 nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:false) <CR> 63 vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true) <CR>
64 vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:true) <CR> 64 nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:false) <CR>
65 nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:false) <CR> 65 vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:true) <CR>
66 vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:true) <CR> 66 nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:false) <CR>
67 nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:false) <CR> 67 vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:true) <CR>
68 vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:true) <CR> 68 nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:false) <CR>
69 nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:false) <CR> 69 vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:true) <CR>
70 vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:true) <CR> 70 nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:false) <CR>
71 nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:false) <CR> 71 vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:true) <CR>
72 vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:true) <CR> 72 nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:false) <CR>
73 vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:true) <CR>
74
75 let b:undo_ftplugin .= " | sil! exe 'nunmap <buffer> [[' | sil! exe 'vunmap <buffer> [['" .
76 \ " | sil! exe 'nunmap <buffer> ]]' | sil! exe 'vunmap <buffer> ]]'" .
77 \ " | sil! exe 'nunmap <buffer> []' | sil! exe 'vunmap <buffer> []'" .
78 \ " | sil! exe 'nunmap <buffer> ][' | sil! exe 'vunmap <buffer> ]['" .
79 \ " | sil! exe 'nunmap <buffer> [{' | sil! exe 'vunmap <buffer> [{'" .
80 \ " | sil! exe 'nunmap <buffer> ]}' | sil! exe 'vunmap <buffer> ]}'"
81 end
73 82
74 " Other useful mappings 83 " Other useful mappings
75 if get(g:, 'context_mappings', 1) 84 if get(g:, 'context_mappings', 1)
76 let s:tp_regex = '?^$\|^\s*\\\(item\|start\|stop\|blank\|\%(sub\)*section\|chapter\|\%(sub\)*subject\|title\|part\)' 85 let s:tp_regex = '?^$\|^\s*\\\(item\|start\|stop\|blank\|\%(sub\)*section\|chapter\|\%(sub\)*subject\|title\|part\)'
77 86
79 call cursor(search(s:tp_regex, 'bcW') + 1, 1) 88 call cursor(search(s:tp_regex, 'bcW') + 1, 1)
80 normal! V 89 normal! V
81 call cursor(search(s:tp_regex, 'W') - 1, 1) 90 call cursor(search(s:tp_regex, 'W') - 1, 1)
82 endf 91 endf
83 92
84 " Reflow paragraphs with commands like gqtp ("gq TeX paragraph") 93 if !exists("no_plugin_maps") && !exists("no_context_maps")
85 onoremap <silent><buffer> tp :<c-u>call <sid>tp()<cr> 94 " Reflow paragraphs with commands like gqtp ("gq TeX paragraph")
86 " Select TeX paragraph 95 onoremap <silent><buffer> tp :<c-u>call <sid>tp()<cr>
87 vnoremap <silent><buffer> tp <esc>:<c-u>call <sid>tp()<cr> 96 " Select TeX paragraph
97 vnoremap <silent><buffer> tp <esc>:<c-u>call <sid>tp()<cr>
88 98
89 " $...$ text object 99 " $...$ text object
90 onoremap <silent><buffer> i$ :<c-u>normal! T$vt$<cr> 100 onoremap <silent><buffer> i$ :<c-u>normal! T$vt$<cr>
91 onoremap <silent><buffer> a$ :<c-u>normal! F$vf$<cr> 101 onoremap <silent><buffer> a$ :<c-u>normal! F$vf$<cr>
92 vnoremap <buffer> i$ T$ot$ 102 vnoremap <buffer> i$ T$ot$
93 vnoremap <buffer> a$ F$of$ 103 vnoremap <buffer> a$ F$of$
104
105 let b:undo_ftplugin .= " | sil! exe 'ounmap <buffer> tp' | sil! exe 'vunmap <buffer> tp'" .
106 \ " | sil! exe 'ounmap <buffer> i$' | sil! exe 'vunmap <buffer> i$'" .
107 \ " | sil! exe 'ounmap <buffer> a$' | sil! exe 'vunmap <buffer> a$'"
108 endif
94 endif 109 endif
95 110
96 " Commands for asynchronous typesetting 111 " Commands for asynchronous typesetting
97 command! -buffer -nargs=? -complete=file ConTeXt call context#typeset(<q-args>) 112 command! -buffer -nargs=? -complete=file ConTeXt call context#typeset(<q-args>)
98 command! -nargs=0 ConTeXtJobStatus call context#job_status() 113 command! -nargs=0 ConTeXtJobStatus call context#job_status()