From b3763a917a6a3ca85ae51086fc8d29b28f66fc88 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 7 Oct 2020 23:52:17 +0200 Subject: Use neovim version of .vim highlighting, #578 --- ftplugin/vim.vim | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'ftplugin/vim.vim') diff --git a/ftplugin/vim.vim b/ftplugin/vim.vim index bf721a02..af269d05 100644 --- a/ftplugin/vim.vim +++ b/ftplugin/vim.vim @@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vim') == -1 " Vim filetype plugin " Language: Vim " Maintainer: Bram Moolenaar -" Last Change: 2020 Aug 14 +" Last Change: 2018 Aug 07 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -14,11 +14,11 @@ endif let b:did_ftplugin = 1 let s:cpo_save = &cpo -set cpo&vim +set cpo-=C if !exists('*VimFtpluginUndo') func VimFtpluginUndo() - setl fo< isk< com< tw< commentstring< + setl fo< isk< com< tw< commentstring< keywordprg< if exists('b:did_add_maps') silent! nunmap [[ silent! vunmap [[ @@ -32,7 +32,7 @@ if !exists('*VimFtpluginUndo') silent! vunmap ]" silent! nunmap [" silent! vunmap [" - endif + endif unlet! b:match_ignorecase b:match_words b:match_skip b:did_add_maps endfunc endif @@ -51,29 +51,31 @@ setlocal isk+=# setlocal keywordprg=:help " Set 'comments' to format dashed lists in comments -" Avoid that #{} starts a comment. -setlocal com=sO:\"\ -,mO:\"\ \ ,sO:#\ -,mO:#\ \ ,eO:##,:\",b:# +setlocal com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" " Format comments to be up to 78 characters long if &tw == 0 setlocal tw=78 endif -" Comments start with a double quote; in Vim9 script # would also work +" Comments start with a double quote setlocal commentstring=\"%s +" Prefer Vim help instead of manpages. +setlocal keywordprg=:help + if !exists("no_plugin_maps") && !exists("no_vim_maps") let b:did_add_maps = 1 " Move around functions. - nnoremap [[ m':call search('^\s*\(fu\%[nction]\\|def\)\>', "bW") - vnoremap [[ m':exe "normal! gv"call search('^\s*\(fu\%[nction]\\|def\)\>', "bW") - nnoremap ]] m':call search('^\s*\(fu\%[nction]\\|def\)\>', "W") - vnoremap ]] m':exe "normal! gv"call search('^\s*\(fu\%[nction]\\|def\)\>', "W") - nnoremap [] m':call search('^\s*end\(f\%[unction]\\|def\)\>', "bW") - vnoremap [] m':exe "normal! gv"call search('^\s*end\(f\%[unction]\\|def\)\>', "bW") - nnoremap ][ m':call search('^\s*end\(f\%[unction]\\|def\)\>', "W") - vnoremap ][ m':exe "normal! gv"call search('^\s*end\(f\%[unction]\\|def\)\>', "W") + nnoremap [[ m':call search('^\s*fu\%[nction]\>', "bW") + vnoremap [[ m':exe "normal! gv"call search('^\s*fu\%[nction]\>', "bW") + nnoremap ]] m':call search('^\s*fu\%[nction]\>', "W") + vnoremap ]] m':exe "normal! gv"call search('^\s*fu\%[nction]\>', "W") + nnoremap [] m':call search('^\s*endf\%[unction]\>', "bW") + vnoremap [] m':exe "normal! gv"call search('^\s*endf\%[unction]\>', "bW") + nnoremap ][ m':call search('^\s*endf\%[unction]\>', "W") + vnoremap ][ m':exe "normal! gv"call search('^\s*endf\%[unction]\>', "W") " Move around comments nnoremap ]" :call search('^\(\s*".*\n\)\@ @@ -86,10 +88,9 @@ endif if exists("loaded_matchit") let b:match_ignorecase = 0 let b:match_words = - \ '\<\%(fu\%[nction]\|def\)\>)\@!:\:\<\%(endf\%[unction]\|enddef\)\>,' . + \ '\:\:\,' . \ '\<\(wh\%[ile]\|for\)\>:\:\:\,' . \ '\:\:\,' . - \ '{:},' . \ '\:\:\:\,' . \ '\\)\@!\S:\,' " Ignore syntax region commands and settings, any 'en*' would clobber -- cgit v1.2.3