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