From 2774819384c3f29c4aeafbb31ddf95d54bdb57f5 Mon Sep 17 00:00:00 2001 From: Vanessa McHale Date: Sat, 23 Dec 2017 14:28:24 -0600 Subject: [PATCH] package publish --- ftplugin/ats.vim | 28 ++++++++++++++++++++++++++++ syntax/ats.vim | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 ftplugin/ats.vim diff --git a/ftplugin/ats.vim b/ftplugin/ats.vim new file mode 100644 index 0000000..8fd73d7 --- /dev/null +++ b/ftplugin/ats.vim @@ -0,0 +1,28 @@ +if exists('b:ats_ftplugin') + finish +endif +let b:ats_ftplugin = 1 + +if !exists('g:ats_autoformat') + let g:ats_autoformat = 0 +endif + +set smarttab +au BufNewFile,BufRead *.*ats + \ set shiftwidth=2 + +setlocal commentstring=(*\ %s\ *) + +function! AtsFormat() + exec 'normal! gg' + exec 'silent !atsfmt -i ' . expand('%') + exec 'e' +endfunction + +if g:ats_autoformat == 1 + augroup ats + autocmd BufWritePost *.ats,*.dats,*.sats,*.cats call AtsFormat() + augroup END +endif + +command Format call AtsFormat() diff --git a/syntax/ats.vim b/syntax/ats.vim index 2a7e507..b32ae69 100644 --- a/syntax/ats.vim +++ b/syntax/ats.vim @@ -68,7 +68,7 @@ endif " keyword highlighting syn keyword atsKeyword prefix postfix infix infixl infixr op nonfix -syn keyword atsKeyword staload stadef sta dynload +syn keyword atsKeyword staload stadef sta dynload stacst syn keyword atsCond if then else case sif syn keyword atsRepeat while syn keyword atsException exception raise try