patch 9.1.0769: filetype: MLIR files are not recognized
Problem: filetype: MLIR files are not recognized
Solution: Detect '*.mlir' files as mlir filetype,
include a mlir filetype plugin
(Wu, Zhenyu)
closes: #15826
Signed-off-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 7f39625..4b5577a 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -576,6 +576,9 @@
" LyRiCs
au BufNewFile,BufRead *.lrc setf lyrics
+" MLIR
+au BufNewFile,BufRead *.mlir setf mlir
+
" Modula-3 configuration language (must be before *.cfg and *makefile)
au BufNewFile,BufRead *.quake,cm3.cfg setf m3quake
au BufNewFile,BufRead m3makefile,m3overrides setf m3build
diff --git a/runtime/ftplugin/mlir.vim b/runtime/ftplugin/mlir.vim
new file mode 100644
index 0000000..c6a9dc3
--- /dev/null
+++ b/runtime/ftplugin/mlir.vim
@@ -0,0 +1,10 @@
+" Vim filetype plugin file
+" Language: MLIR
+
+if exists("b:did_ftplugin") | finish | endif
+let b:did_ftplugin = 1
+
+setl comments=:///,://
+setl commentstring=//\ %s
+
+let b:undo_ftplugin = "setl commentstring< comments<"