Mercurial > vim
annotate runtime/ftplugin/vim.vim @ 17459:02dc4260ddbb
Added tag v8.1.1727 for changeset cfdef48743edfd9e4dcea017e6691202317e9f5c
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 21 Jul 2019 19:30:07 +0200 |
parents | b178e2039b2d |
children | 94eda51ba9ba |
rev | line source |
---|---|
7 | 1 " Vim filetype plugin |
2 " Language: Vim | |
3 " Maintainer: Bram Moolenaar <Bram@vim.org> | |
14519 | 4 " Last Change: 2018 Aug 07 |
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 |
7 | 15 set cpo-=C |
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 | |
7 | 51 " Set 'comments' to format dashed lists in comments |
52 setlocal com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" | |
53 | |
54 " Format comments to be up to 78 characters long | |
55 if &tw == 0 | |
56 setlocal tw=78 | |
57 endif | |
58 | |
59 " Comments start with a double quote | |
60 setlocal commentstring=\"%s | |
61 | |
13051 | 62 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
|
63 let b:did_add_maps = 1 |
4a588e3afd4a
Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
64 |
13051 | 65 " Move around functions. |
66 nnoremap <silent><buffer> [[ m':call search('^\s*fu\%[nction]\>', "bW")<CR> | |
67 vnoremap <silent><buffer> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "bW")<CR> | |
68 nnoremap <silent><buffer> ]] m':call search('^\s*fu\%[nction]\>', "W")<CR> | |
69 vnoremap <silent><buffer> ]] m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "W")<CR> | |
14695 | 70 nnoremap <silent><buffer> [] m':call search('^\s*endf\%[unction]\>', "bW")<CR> |
71 vnoremap <silent><buffer> [] m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf\%[unction]\>', "bW")<CR> | |
72 nnoremap <silent><buffer> ][ m':call search('^\s*endf\%[unction]\>', "W")<CR> | |
73 vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf\%[unction]\>', "W")<CR> | |
7 | 74 |
13051 | 75 " Move around comments |
76 nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> | |
77 vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> | |
78 nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> | |
79 vnoremap <silent><buffer> [" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> | |
80 endif | |
7 | 81 |
82 " Let the matchit plugin know what items can be matched. | |
83 if exists("loaded_matchit") | |
84 let b:match_ignorecase = 0 | |
85 let b:match_words = | |
86 \ '\<fu\%[nction]\>:\<retu\%[rn]\>:\<endf\%[unction]\>,' . | |
2034 | 87 \ '\<\(wh\%[ile]\|for\)\>:\<brea\%[k]\>:\<con\%[tinue]\>:\<end\(w\%[hile]\|fo\%[r]\)\>,' . |
7 | 88 \ '\<if\>:\<el\%[seif]\>:\<en\%[dif]\>,' . |
89 \ '\<try\>:\<cat\%[ch]\>:\<fina\%[lly]\>:\<endt\%[ry]\>,' . | |
14695 | 90 \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,' |
6213 | 91 " Ignore syntax region commands and settings, any 'en*' would clobber |
92 " if-endif. | |
93 " - set spl=de,en | |
94 " - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ … | |
95 let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") | |
96 \ =~? "comment\\|string\\|vimSynReg\\|vimSet"' | |
7 | 97 endif |
98 | |
2034 | 99 let &cpo = s:cpo_save |
100 unlet s:cpo_save | |
168 | 101 |
102 " removed this, because 'cpoptions' is a global option. | |
103 " setlocal cpo+=M " makes \%( match \) |