From 0f604fbedb093ca0c83bc85a3b0fb3504224258a Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 9 Aug 2024 19:18:15 +0200 Subject: Add syntax highlighting and autoformatting for mintages --- .exrc | 12 ++++++++++-- contrib/syntax/mintage.vim | 8 ++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 contrib/syntax/mintage.vim diff --git a/.exrc b/.exrc index 1460ac2..7d08655 100644 --- a/.exrc +++ b/.exrc @@ -1,3 +1,5 @@ +set runtimepath+=contrib + " We make use of this feature, so set this in the environment so that all " Ex-calls to templ are aware of this call setenv("TEMPL_EXPERIMENT", "rawgo") @@ -8,8 +10,14 @@ function s:SaveExcursion(cmd) call winrestview(l:win) endfunction -autocmd BufWritePre *.go call s:SaveExcursion("gofmt -s") -autocmd BufWritePre *.templ call s:SaveExcursion("templ fmt") +autocmd BufNewFile,BufRead */data/mintages/* setfiletype mintage + +autocmd FileType go autocmd BufWritePre + \ call s:SaveExcursion("gofmt -s") +autocmd FileType mintage autocmd BufWritePre + \ call s:SaveExcursion("./mfmt") +autocmd FileType templ autocmd BufWritePre + \ call s:SaveExcursion("templ fmt") nnoremap gM :wall \| make all-i18n nnoremap t :vimgrep /TODO/ **/* diff --git a/contrib/syntax/mintage.vim b/contrib/syntax/mintage.vim new file mode 100644 index 0000000..d4cb533 --- /dev/null +++ b/contrib/syntax/mintage.vim @@ -0,0 +1,8 @@ +if exists('b:current_syntax') + finish +endif +let b:current_syntax = 'mintage' + +syntax keyword Keyword BEGIN CIRC BU PROOF +syntax match Label /[^\s]\+\*\?:/ +syntax match Number /[0-9\.]\+/ -- cgit v1.2.3