Mercurial > vim
annotate runtime/ftplugin/vim.vim @ 5024:7a2ffd685c0e
Update runtime files. Remove duplicate tags in help.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 28 Jun 2013 18:44:48 +0200 |
parents | 2cfb68fa26cd |
children | 37c24033b260 |
rev | line source |
---|---|
7 | 1 " Vim filetype plugin |
2 " Language: Vim | |
3 " Maintainer: Bram Moolenaar <Bram@vim.org> | |
5024
7a2ffd685c0e
Update runtime files. Remove duplicate tags in help.
Bram Moolenaar <bram@vim.org>
parents:
3445
diff
changeset
|
4 " Last Change: 2013 Jun 26 |
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 | |
2034 | 17 let b:undo_ftplugin = "setl fo< isk< com< tw< commentstring<" |
7 | 18 \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" |
19 | |
20 " Set 'formatoptions' to break comment lines but not other lines, | |
21 " and insert the comment leader when hitting <CR> or using "o". | |
22 setlocal fo-=t fo+=croql | |
23 | |
2034 | 24 " To allow tag lookup via CTRL-] for autoload functions, '#' must be a |
25 " keyword character. E.g., for netrw#Nread(). | |
26 setlocal isk+=# | |
27 | |
7 | 28 " Set 'comments' to format dashed lists in comments |
29 setlocal com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" | |
30 | |
31 " Format comments to be up to 78 characters long | |
32 if &tw == 0 | |
33 setlocal tw=78 | |
34 endif | |
35 | |
36 " Comments start with a double quote | |
37 setlocal commentstring=\"%s | |
38 | |
39 " Move around functions. | |
1622 | 40 nnoremap <silent><buffer> [[ m':call search('^\s*fu\%[nction]\>', "bW")<CR> |
41 vnoremap <silent><buffer> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "bW")<CR> | |
42 nnoremap <silent><buffer> ]] m':call search('^\s*fu\%[nction]\>', "W")<CR> | |
43 vnoremap <silent><buffer> ]] m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "W")<CR> | |
44 nnoremap <silent><buffer> [] m':call search('^\s*endf*\%[unction]\>', "bW")<CR> | |
45 vnoremap <silent><buffer> [] m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf*\%[unction]\>', "bW")<CR> | |
46 nnoremap <silent><buffer> ][ m':call search('^\s*endf*\%[unction]\>', "W")<CR> | |
47 vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf*\%[unction]\>', "W")<CR> | |
7 | 48 |
49 " Move around comments | |
1622 | 50 nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> |
51 vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> | |
52 nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> | |
53 vnoremap <silent><buffer> [" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> | |
7 | 54 |
55 " Let the matchit plugin know what items can be matched. | |
56 if exists("loaded_matchit") | |
57 let b:match_ignorecase = 0 | |
58 let b:match_words = | |
59 \ '\<fu\%[nction]\>:\<retu\%[rn]\>:\<endf\%[unction]\>,' . | |
2034 | 60 \ '\<\(wh\%[ile]\|for\)\>:\<brea\%[k]\>:\<con\%[tinue]\>:\<end\(w\%[hile]\|fo\%[r]\)\>,' . |
7 | 61 \ '\<if\>:\<el\%[seif]\>:\<en\%[dif]\>,' . |
62 \ '\<try\>:\<cat\%[ch]\>:\<fina\%[lly]\>:\<endt\%[ry]\>,' . | |
63 \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,' . | |
64 \ '(:)' | |
65 " Ignore ":syntax region" commands, the 'end' argument clobbers if-endif | |
66 let b:match_skip = 'getline(".") =~ "^\\s*sy\\%[ntax]\\s\\+region" || | |
67 \ synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string"' | |
68 endif | |
69 | |
2034 | 70 let &cpo = s:cpo_save |
71 unlet s:cpo_save | |
168 | 72 |
73 " removed this, because 'cpoptions' is a global option. | |
74 " setlocal cpo+=M " makes \%( match \) |