diff --git a/ftplugin/ats.vim b/ftplugin/ats.vim index f4319cf..2a899bc 100644 --- a/ftplugin/ats.vim +++ b/ftplugin/ats.vim @@ -3,6 +3,7 @@ if exists('b:ats_ftplugin') endif let b:ats_ftplugin = 1 +" set config values if !exists('g:ats_autoformat') if executable('atsfmt') == 1 let g:ats_autoformat = 1 @@ -11,12 +12,18 @@ if !exists('g:ats_autoformat') endif endif +" indentation rules set smarttab au BufNewFile,BufRead *.*ats \ set shiftwidth=2 +" set comment string to something prettier setlocal commentstring=(*\ %s\ *) +" register patscc as a checker +let g:syntastic_ats_checkers = [ 'patscc' ] + +" function to format our buffer function! AtsFormat() let cursor = getpos('.') exec 'normal! gg' @@ -25,10 +32,13 @@ function! AtsFormat() call setpos('.', cursor) endfunction +" format on write if g:ats_autoformat == 1 augroup ats autocmd BufWritePost *.ats,*.dats,*.sats,*.cats call AtsFormat() augroup END endif +" commands command -nargs=0 Format call AtsFormat() +command -nargs=0 Check SyntasticCheck patscc