annotate runtime/ftplugin/mf.vim @ 18492:41a5f241e9d5 v8.1.2240

patch 8.1.2240: popup window width changes when scrolling Commit: https://github.com/vim/vim/commit/f2885d3fb7045d14ae58824e9cb8dea65e4052c4 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 2 20:21:25 2019 +0100 patch 8.1.2240: popup window width changes when scrolling Problem: Popup window width changes when scrolling. Solution: Also adjust maxwidth when applying minwidth and there is a scrollbar. Fix off-by-one error. (closes #5162)
author Bram Moolenaar <Bram@vim.org>
date Sat, 02 Nov 2019 20:30:03 +0100
parents bdd7fc1a38c0
children 2acb87ee55fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
389
4fe8e1a7758e updated for version 7.0102
vimboss
parents: 7
diff changeset
1 " Vim filetype plugin file
10244
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
2 " Language: METAFONT
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
3 " Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
4 " Former Maintainers: Nikolai Weibull <now@bitwi.se>
10261
bdd7fc1a38c0 commit https://github.com/vim/vim/commit/dc08328821a2c11e33dfb1980332e4923ec64fca
Christian Brabandt <cb@256bit.org>
parents: 10244
diff changeset
5 " Latest Revision: 2016 Oct 2
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 if exists("b:did_ftplugin")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 839
diff changeset
12 let s:cpo_save = &cpo
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 839
diff changeset
13 set cpo&vim
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 839
diff changeset
14
10244
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
15 let b:undo_ftplugin = "setl com< cms< fo< sua< inc< def< ofu<"
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
16 \ . "| unlet! b:match_ignorecase b:match_words b:match_skip"
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
17
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
18 setlocal comments=:% commentstring=%\ %s formatoptions-=t formatoptions+=cjroql2
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
19 setlocal suffixesadd=.mf
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
20 let &l:include = '\<input\>'
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
21 let &l:define = '\<\%(let\|newinternal\|interim\|def\|vardef\)\>\|\<\%(primary\|secondary\|tertiary\)def\>\s*[^ .]\+'
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
22 setlocal omnifunc=syntaxcomplete#Complete
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
23 let g:omni_syntax_group_include_mf = 'mf\w\+'
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
24 let g:omni_syntax_group_exclude_mf = 'mfTodoComment'
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
25
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
26 let s:mp_regex = {
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
27 \ 'beginsection' : '^\s*\%(\%(\|var\|primary\|secondary\|tertiary\)def\|beginchar\|beginlogochar\)\>',
10261
bdd7fc1a38c0 commit https://github.com/vim/vim/commit/dc08328821a2c11e33dfb1980332e4923ec64fca
Christian Brabandt <cb@256bit.org>
parents: 10244
diff changeset
28 \ 'endsection' : '^\s*\%(enddef\|endchar\)\>',
10244
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
29 \ 'beginblock' : '^\s*\%(begingroup\|if\|for\%(\|suffixes\|ever\)\)\>',
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
30 \ 'endblock' : '^\s*\%(endgroup\|fi\|endfor\)\>'
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
31 \ }
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
32
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
33 function! s:move_around(count, what, flags, visual)
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
34 if a:visual
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
35 exe "normal! gv"
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
36 endif
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
37 call search(s:mp_regex[a:what], a:flags.'s') " 's' sets previous context mark
10261
bdd7fc1a38c0 commit https://github.com/vim/vim/commit/dc08328821a2c11e33dfb1980332e4923ec64fca
Christian Brabandt <cb@256bit.org>
parents: 10244
diff changeset
38 call map(range(2, a:count), 'search(s:mp_regex[a:what], a:flags)')
10244
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
39 endfunction
389
4fe8e1a7758e updated for version 7.0102
vimboss
parents: 7
diff changeset
40
10244
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
41
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
42 " Move around macros.
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
43 nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
44 vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true) <CR>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
45 nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:false) <CR>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
46 vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:true) <CR>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
47 nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:false) <CR>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
48 vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:true) <CR>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
49 nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:false) <CR>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
50 vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:true) <CR>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
51 nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:false) <CR>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
52 vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:true) <CR>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
53 nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:false) <CR>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
54 vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:true) <CR>
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
55
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
56 if exists("loaded_matchit")
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
57 let b:match_ignorecase = 0
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
58 let b:match_words =
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
59 \ '\<if\>:\<else\%[if]\>:\<fi\>,' .
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
60 \ '\<for\%(\|suffixes\|ever\)\>:\<exit\%(if\|unless\)\>:\<endfor\>,' .
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
61 \ '\<\%(\|var\|primary\|secondary\|tertiary\)def\>:\<enddef\>,' .
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
62 \ '\<begingroup\>:\<endgroup\>,' .
10261
bdd7fc1a38c0 commit https://github.com/vim/vim/commit/dc08328821a2c11e33dfb1980332e4923ec64fca
Christian Brabandt <cb@256bit.org>
parents: 10244
diff changeset
63 \ '\<begin\%(logo\)\?char\>:\<endchar\>'
10244
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
64 " Ignore comments and strings
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
65 let b:match_skip = 'synIDattr(synID(line("."), col("."), 1), "name")
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
66 \ =~# "mf\\(Comment\\|String\\)$"'
876fbdd84e52 commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents: 1698
diff changeset
67 endif
389
4fe8e1a7758e updated for version 7.0102
vimboss
parents: 7
diff changeset
68
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 839
diff changeset
69 let &cpo = s:cpo_save
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 839
diff changeset
70 unlet s:cpo_save