Skip to content

Commit b3763a9

Browse files
committed
Use neovim version of .vim highlighting, #578
1 parent 4bec20e commit b3763a9

File tree

5 files changed

+149
-221
lines changed

5 files changed

+149
-221
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr
191191
- [vbnet](https://github.com/vim-scripts/vbnet.vim)
192192
- [vcl](https://github.com/smerrill/vcl-vim-plugin)
193193
- [velocity](https://github.com/lepture/vim-velocity)
194+
- [vim](https://github.com/neovim/neovim/tree/master/runtime)
194195
- [vue](https://github.com/posva/vim-vue)
195196
- [xdc](https://github.com/amal-khailtash/vim-xdc-syntax)
196197
- [xml](https://github.com/amadeus/vim-xml)

ftplugin/vim.vim

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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
99
if exists("b:did_ftplugin")
@@ -14,11 +14,11 @@ endif
1414
let b:did_ftplugin = 1
1515

1616
let s:cpo_save = &cpo
17-
set cpo&vim
17+
set cpo-=C
1818

1919
if !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
3838
endif
@@ -51,29 +51,31 @@ setlocal isk+=#
5151
setlocal 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
5857
if &tw == 0
5958
setlocal tw=78
6059
endif
6160

62-
" Comments start with a double quote; in Vim9 script # would also work
61+
" Comments start with a double quote
6362
setlocal commentstring=\"%s
6463

64+
" Prefer Vim help instead of manpages.
65+
setlocal keywordprg=:help
66+
6567
if !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>
@@ -86,10 +88,9 @@ endif
8688
if 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

indent/vim.vim

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vim') == -1
33
" Vim indent file
44
" Language: Vim script
55
" Maintainer: Bram Moolenaar <[email protected]>
6-
" Last Change: 2020 Sep 27
6+
" Last Change: 2016 Jun 27
77

88
" Only load this indent file when no other was loaded.
99
if exists("b:did_indent")
@@ -12,8 +12,7 @@ endif
1212
let b:did_indent = 1
1313

1414
setlocal indentexpr=GetVimIndent()
15-
setlocal indentkeys+==end,=},=else,=cat,=finall,=END,0\\,0=\"\\\
16-
setlocal indentkeys-=0#
15+
setlocal indentkeys+==end,=else,=cat,=fina,=END,0\\,0=\"\\\
1716

1817
let b:undo_indent = "setl indentkeys< indentexpr<"
1918

@@ -59,31 +58,6 @@ function GetVimIndentIntern()
5958
" and :else. Add it three times for a line that starts with '\' or '"\ '
6059
" after a line that doesn't (or g:vim_indent_cont if it exists).
6160
let ind = indent(lnum)
62-
63-
" In heredoc indenting works completely differently.
64-
if has('syntax_items')
65-
let syn_here = synIDattr(synID(v:lnum, 1, 1), "name")
66-
if syn_here =~ 'vimLetHereDocStop'
67-
" End of heredoc: use indent of matching start line
68-
let lnum = v:lnum - 1
69-
while lnum > 0
70-
if synIDattr(synID(lnum, 1, 1), "name") !~ 'vimLetHereDoc'
71-
return indent(lnum)
72-
endif
73-
let lnum -= 1
74-
endwhile
75-
return 0
76-
endif
77-
if syn_here =~ 'vimLetHereDoc'
78-
if synIDattr(synID(lnum, 1, 1), "name") !~ 'vimLetHereDoc'
79-
" First line in heredoc: increase indent
80-
return ind + shiftwidth()
81-
endif
82-
" Heredoc continues: no change in indent
83-
return ind
84-
endif
85-
endif
86-
8761
if cur_text =~ s:lineContPat && v:lnum > 1 && prev_text !~ s:lineContPat
8862
if exists("g:vim_indent_cont")
8963
let ind = ind + g:vim_indent_cont
@@ -95,7 +69,7 @@ function GetVimIndentIntern()
9569
else
9670
" A line starting with :au does not increment/decrement indent.
9771
if prev_text !~ '^\s*au\%[tocmd]'
98-
let i = match(prev_text, '\(^\||\)\s*\(export\s\+\)\?\({\|\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\|finall\%[y]\|fu\%[nction]\|def\|el\%[seif]\)\>\)')
72+
let i = match(prev_text, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>')
9973
if i >= 0
10074
let ind += shiftwidth()
10175
if strpart(prev_text, i, 1) == '|' && has('syntax_items')
@@ -118,8 +92,8 @@ function GetVimIndentIntern()
11892

11993

12094
" Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry,
121-
" :endfun, :enddef, :else and :augroup END.
122-
if cur_text =~ '^\s*\(ene\@!\|}\|cat\|finall\|el\|aug\%[roup]\s\+[eE][nN][dD]\)'
95+
" :endfun, :else and :augroup END.
96+
if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s\+[eE][nN][dD]\)'
12397
let ind = ind - shiftwidth()
12498
endif
12599

packages.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5152,7 +5152,7 @@ filetypes:
51525152
- pattern: "*.vhdl_[0-9]*"
51535153
---
51545154
name: vim
5155-
remote: vim/vim:runtime
5155+
remote: neovim/neovim:runtime
51565156
glob: "**/vim.vim"
51575157
filetypes:
51585158
- name: vim

0 commit comments

Comments
 (0)