@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vim') == -1
33" Vim filetype plugin
44" Language: Vim
55" Maintainer: Bram Moolenaar <[email protected] >6- " Last Change: 2020 Aug 14
6+ " Last Change: 2018 Aug 07
77
88" Only do this when not done yet for this buffer
99if exists (" b:did_ftplugin" )
@@ -14,11 +14,11 @@ endif
1414let b: did_ftplugin = 1
1515
1616let s: cpo_save = &cpo
17- set cpo & vim
17+ set cpo -= C
1818
1919if ! exists (' *VimFtpluginUndo' )
2020 func VimFtpluginUndo ()
21- setl fo < isk < com < tw < commentstring <
21+ setl fo < isk < com < tw < commentstring < keywordprg <
2222 if exists (' b:did_add_maps' )
2323 silent ! nunmap <buffer> [[
2424 silent ! vunmap <buffer> [[
@@ -32,7 +32,7 @@ if !exists('*VimFtpluginUndo')
3232 silent ! vunmap <buffer> ]"
3333 silent ! nunmap <buffer> ["
3434 silent ! vunmap <buffer> ["
35- endif
35+ endif
3636 unlet ! b: match_ignorecase b: match_words b: match_skip b: did_add_maps
3737 endfunc
3838endif
@@ -51,29 +51,31 @@ setlocal isk+=#
5151setlocal keywordprg = :help
5252
5353" Set 'comments' to format dashed lists in comments
54- " Avoid that #{} starts a comment.
55- setlocal com = sO:\" \ - ,mO:\" \ \ ,sO:#\ - ,mO:#\ \ ,eO:##,:\" ,b: #
54+ setlocal com = sO:\" \ - ,mO:\" \ \ ,eO:\"\" ,:\"
5655
5756" Format comments to be up to 78 characters long
5857if &tw == 0
5958 setlocal tw = 78
6059endif
6160
62- " Comments start with a double quote; in Vim9 script # would also work
61+ " Comments start with a double quote
6362setlocal commentstring = \" % s
6463
64+ " Prefer Vim help instead of manpages.
65+ setlocal keywordprg = :help
66+
6567if ! exists (" no_plugin_maps" ) && ! exists (" no_vim_maps" )
6668 let b: did_add_maps = 1
6769
6870 " Move around functions.
69- nnoremap <silent> <buffer> [[ m':call search('^\s*\( fu\%[nction]\\|def\) \>', "bW")<CR>
70- vnoremap <silent> <buffer> [[ m':<C-U> exe "normal! gv"<Bar> call search('^\s*\( fu\%[nction]\\|def\) \>', "bW")<CR>
71- nnoremap <silent> <buffer> ]] m':call search('^\s*\( fu\%[nction]\\|def\) \>', "W")<CR>
72- vnoremap <silent> <buffer> ]] m':<C-U> exe "normal! gv"<Bar> call search('^\s*\( fu\%[nction]\\|def\) \>', "W")<CR>
73- nnoremap <silent> <buffer> [] m':call search('^\s*end\(f\ %[unction]\\|def\) \>', "bW")<CR>
74- vnoremap <silent> <buffer> [] m':<C-U> exe "normal! gv"<Bar> call search('^\s*end\(f\ %[unction]\\|def\) \>', "bW")<CR>
75- nnoremap <silent> <buffer> ][ m':call search('^\s*end\(f\ %[unction]\\|def\) \>', "W")<CR>
76- vnoremap <silent> <buffer> ][ m':<C-U> exe "normal! gv"<Bar> call search('^\s*end\(f\ %[unction]\\|def\) \>', "W")<CR>
71+ nnoremap <silent> <buffer> [[ m':call search('^\s*fu\%[nction]\>', "bW")<CR>
72+ vnoremap <silent> <buffer> [[ m':<C-U> exe "normal! gv"<Bar> call search('^\s*fu\%[nction]\>', "bW")<CR>
73+ nnoremap <silent> <buffer> ]] m':call search('^\s*fu\%[nction]\>', "W")<CR>
74+ vnoremap <silent> <buffer> ]] m':<C-U> exe "normal! gv"<Bar> call search('^\s*fu\%[nction]\>', "W")<CR>
75+ nnoremap <silent> <buffer> [] m':call search('^\s*endf\ %[unction]\>', "bW")<CR>
76+ vnoremap <silent> <buffer> [] m':<C-U> exe "normal! gv"<Bar> call search('^\s*endf\ %[unction]\>', "bW")<CR>
77+ nnoremap <silent> <buffer> ][ m':call search('^\s*endf\ %[unction]\>', "W")<CR>
78+ vnoremap <silent> <buffer> ][ m':<C-U> exe "normal! gv"<Bar> call search('^\s*endf\ %[unction]\>', "W")<CR>
7779
7880 " Move around comments
7981 nnoremap <silent> <buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR>
8688if exists (" loaded_matchit" )
8789 let b: match_ignorecase = 0
8890 let b: match_words =
89- \ ' \<\%( fu\%[nction]\|def\)\>)\@! :\<retu\%[rn]\>:\<\%( endf\%[unction]\|enddef\) \>,' .
91+ \ ' \<fu\%[nction]\> :\<retu\%[rn]\>:\<endf\%[unction]\>,' .
9092 \ ' \<\(wh\%[ile]\|for\)\>:\<brea\%[k]\>:\<con\%[tinue]\>:\<end\(w\%[hile]\|fo\%[r]\)\>,' .
9193 \ ' \<if\>:\<el\%[seif]\>:\<en\%[dif]\>,' .
92- \ ' {:},' .
9394 \ ' \<try\>:\<cat\%[ch]\>:\<fina\%[lly]\>:\<endt\%[ry]\>,' .
9495 \ ' \<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,'
9596 " Ignore syntax region commands and settings, any 'en*' would clobber
0 commit comments