Mercurial > vim
annotate runtime/ftplugin/vim.vim @ 24024:ef454a7f485d
Update runtime files.
Commit: https://github.com/vim/vim/commit/9faec4e3d439968e21ad74e917aebb289df8f849
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 27 16:38:07 2021 +0100
Update runtime files.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 27 Feb 2021 16:45:04 +0100 |
parents | 5b37a0bf7e3a |
children | 9f41bfdbc6fc |
rev | line source |
---|---|
7 | 1 " Vim filetype plugin |
2 " Language: Vim | |
3 " Maintainer: Bram Moolenaar <Bram@vim.org> | |
24024 | 4 " Last Change: 2021 Feb 20 |
7 | 5 |
6 " Only do this when not done yet for this buffer | |
7 if exists("b:did_ftplugin") | |
8 finish | |
9 endif | |
10 | |
11 " Don't load another plugin for this buffer | |
12 let b:did_ftplugin = 1 | |
13 | |
2034 | 14 let s:cpo_save = &cpo |
20552 | 15 set cpo&vim |
7 | 16 |
14298
4a588e3afd4a
Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
17 if !exists('*VimFtpluginUndo') |
4a588e3afd4a
Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
18 func VimFtpluginUndo() |
4a588e3afd4a
Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
19 setl fo< isk< com< tw< commentstring< |
14519 | 20 if exists('b:did_add_maps') |
21 silent! nunmap <buffer> [[ | |
22 silent! vunmap <buffer> [[ | |
23 silent! nunmap <buffer> ]] | |
24 silent! vunmap <buffer> ]] | |
25 silent! nunmap <buffer> [] | |
26 silent! vunmap <buffer> [] | |
27 silent! nunmap <buffer> ][ | |
28 silent! vunmap <buffer> ][ | |
29 silent! nunmap <buffer> ]" | |
30 silent! vunmap <buffer> ]" | |
31 silent! nunmap <buffer> [" | |
32 silent! vunmap <buffer> [" | |
14298
4a588e3afd4a
Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
33 endif |
4a588e3afd4a
Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
34 unlet! b:match_ignorecase b:match_words b:match_skip b:did_add_maps |
4a588e3afd4a
Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
35 endfunc |
4a588e3afd4a
Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
36 endif |
4a588e3afd4a
Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
37 |
4a588e3afd4a
Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
38 let b:undo_ftplugin = "call VimFtpluginUndo()" |
7 | 39 |
40 " Set 'formatoptions' to break comment lines but not other lines, | |
41 " and insert the comment leader when hitting <CR> or using "o". | |
42 setlocal fo-=t fo+=croql | |
43 | |
2034 | 44 " To allow tag lookup via CTRL-] for autoload functions, '#' must be a |
45 " keyword character. E.g., for netrw#Nread(). | |
46 setlocal isk+=# | |
47 | |
12826 | 48 " Use :help to lookup the keyword under the cursor with K. |
49 setlocal keywordprg=:help | |
50 | |
23573 | 51 if "\n" .. getline(1, 10)->join("\n") =~# '\n\s*vim9\%[script]\>' |
52 " Set 'comments' to format dashed lists in comments | |
53 setlocal com=sO:#\ -,mO:#\ \ ,eO:##,:# | |
23666 | 54 " Comments starts with # in Vim9 script |
55 setlocal commentstring=#%s | |
23573 | 56 else |
24024 | 57 setlocal com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" |
23666 | 58 " Comments starts with a double quote in legacy script |
59 setlocal commentstring=\"%s | |
23573 | 60 endif |
61 | |
7 | 62 |
63 " Format comments to be up to 78 characters long | |
64 if &tw == 0 | |
65 setlocal tw=78 | |
66 endif | |
67 | |
13051 | 68 if !exists("no_plugin_maps") && !exists("no_vim_maps") |
14298
4a588e3afd4a
Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
69 let b:did_add_maps = 1 |
4a588e3afd4a
Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
70 |
13051 | 71 " Move around functions. |
20552 | 72 nnoremap <silent><buffer> [[ m':call search('^\s*\(fu\%[nction]\\|def\)\>', "bW")<CR> |
73 vnoremap <silent><buffer> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\s*\(fu\%[nction]\\|def\)\>', "bW")<CR> | |
74 nnoremap <silent><buffer> ]] m':call search('^\s*\(fu\%[nction]\\|def\)\>', "W")<CR> | |
75 vnoremap <silent><buffer> ]] m':<C-U>exe "normal! gv"<Bar>call search('^\s*\(fu\%[nction]\\|def\)\>', "W")<CR> | |
76 nnoremap <silent><buffer> [] m':call search('^\s*end\(f\%[unction]\\|def\)\>', "bW")<CR> | |
77 vnoremap <silent><buffer> [] m':<C-U>exe "normal! gv"<Bar>call search('^\s*end\(f\%[unction]\\|def\)\>', "bW")<CR> | |
78 nnoremap <silent><buffer> ][ m':call search('^\s*end\(f\%[unction]\\|def\)\>', "W")<CR> | |
79 vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*end\(f\%[unction]\\|def\)\>', "W")<CR> | |
7 | 80 |
13051 | 81 " Move around comments |
82 nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> | |
83 vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> | |
84 nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> | |
85 vnoremap <silent><buffer> [" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> | |
86 endif | |
7 | 87 |
88 " Let the matchit plugin know what items can be matched. | |
89 if exists("loaded_matchit") | |
90 let b:match_ignorecase = 0 | |
23737 | 91 " "func" can also be used as a type: |
92 " var Ref: func | |
93 " or to list functions: | |
94 " func name | |
95 " require a parenthesis following, then there can be an "endfunc". | |
7 | 96 let b:match_words = |
23931 | 97 \ '\<\%(fu\%[nction]\|def\)!\=\s\+\S\+(:\<retu\%[rn]\>:\<\%(endf\%[unction]\|enddef\)\>,' . |
2034 | 98 \ '\<\(wh\%[ile]\|for\)\>:\<brea\%[k]\>:\<con\%[tinue]\>:\<end\(w\%[hile]\|fo\%[r]\)\>,' . |
7 | 99 \ '\<if\>:\<el\%[seif]\>:\<en\%[dif]\>,' . |
19181
94eda51ba9ba
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents:
14695
diff
changeset
|
100 \ '{:},' . |
7 | 101 \ '\<try\>:\<cat\%[ch]\>:\<fina\%[lly]\>:\<endt\%[ry]\>,' . |
14695 | 102 \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,' |
6213 | 103 " Ignore syntax region commands and settings, any 'en*' would clobber |
104 " if-endif. | |
105 " - set spl=de,en | |
106 " - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ … | |
107 let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") | |
108 \ =~? "comment\\|string\\|vimSynReg\\|vimSet"' | |
7 | 109 endif |
110 | |
2034 | 111 let &cpo = s:cpo_save |
112 unlet s:cpo_save | |
168 | 113 |
114 " removed this, because 'cpoptions' is a global option. | |
115 " setlocal cpo+=M " makes \%( match \) |