Skip to content

Commit 133d808

Browse files
committed
[vim] Fix command already exists on opening multiple mir buffers
When using the vim syntax for mir, an error occurs in nvim (unknown if it affects the original vim) when opening multiple .mir buffers. Add '!' when defining HiLink to redefine the command instead of giving an error. Only the changes to mir.vim and llvm.vim are required to fix the error, but from similarity making the change in all the syntax files seems prudent.
1 parent 26db845 commit 133d808

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

llvm/utils/vim/syntax/llvm.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ syn match llvmSpecialComment /;\s*XFAIL:.*$/
246246
if version >= 508 || !exists("did_c_syn_inits")
247247
if version < 508
248248
let did_c_syn_inits = 1
249-
command -nargs=+ HiLink hi link <args>
249+
command! -nargs=+ HiLink hi link <args>
250250
else
251-
command -nargs=+ HiLink hi def link <args>
251+
command! -nargs=+ HiLink hi def link <args>
252252
endif
253253

254254
HiLink llvmType Type

llvm/utils/vim/syntax/machine-ir.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ syn match mirPReg /$[-a-zA-Z$._][-a-zA-Z$._0-9]*/
2323
if version >= 508 || !exists("did_c_syn_inits")
2424
if version < 508
2525
let did_c_syn_inits = 1
26-
command -nargs=+ HiLink hi link <args>
26+
command! -nargs=+ HiLink hi link <args>
2727
else
28-
command -nargs=+ HiLink hi def link <args>
28+
command! -nargs=+ HiLink hi def link <args>
2929
endif
3030

3131
HiLink mirType Type

llvm/utils/vim/syntax/mir.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ syn match mirSpecialComment /#\s*XFAIL:.*$/
3737
if version >= 508 || !exists("did_c_syn_inits")
3838
if version < 508
3939
let did_c_syn_inits = 1
40-
command -nargs=+ HiLink hi link <args>
40+
command! -nargs=+ HiLink hi link <args>
4141
else
42-
command -nargs=+ HiLink hi def link <args>
42+
command! -nargs=+ HiLink hi def link <args>
4343
endif
4444

4545
HiLink mirSpecialComment SpecialComment

llvm/utils/vim/syntax/tablegen.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ syn region tgComment2 matchgroup=tgComment2 start=+/\*+ end=+\*/+ contains=tgT
3333
if version >= 508 || !exists("did_c_syn_inits")
3434
if version < 508
3535
let did_c_syn_inits = 1
36-
command -nargs=+ HiLink hi link <args>
36+
command! -nargs=+ HiLink hi link <args>
3737
else
38-
command -nargs=+ HiLink hi def link <args>
38+
command! -nargs=+ HiLink hi def link <args>
3939
endif
4040

4141
HiLink tgKeyword Statement

0 commit comments

Comments
 (0)