diff --git a/doc/ats.txt b/doc/ats.txt index 0a22d75..3a45e1e 100644 --- a/doc/ats.txt +++ b/doc/ats.txt @@ -20,13 +20,22 @@ By default, ats-vim provides one command, viz. Section 2: Config *ATSConfig* ---------------------------------------------------------------------- - *'g:ats_autoformat'* + *'g:ats_use_ctags'* + Values: 0, 1 Default: 0 +When set to 1, ctags will be called on each file write to index the +current project. > + let g:ats_use_ctags=1 +< + + *'g:ats_autoformat'* +Values: 0, 1 + When set to 1, the current buffer will be formatted every time it is written to. > - let g:ats_autoformat='1' + let g:ats_autoformat=0 < *ClearATS* diff --git a/ftplugin/ats.vim b/ftplugin/ats.vim index ca69f83..9fbb5c9 100644 --- a/ftplugin/ats.vim +++ b/ftplugin/ats.vim @@ -3,6 +3,10 @@ if exists('b:ats_ftplugin') endif let b:ats_ftplugin = 1 +if !exists('g:ats_use_ctags') + let g:ats_use_ctags = 0 +endif + " set config values if !exists('g:ats_autoformat') if executable('atsfmt') == 1 @@ -32,15 +36,24 @@ function! AtsFormat() call setpos('.', cursor) endfunction +augroup ats + autocmd BufWritePost *.ats,*.dats,*.sats,*.cats silent !rm -f a.out +augroup END + +if g:ats_use_ctags == 1 + augroup ats + autocmd BufWritePost *.dats,*.cats,*.sats,*.hats silent !ctags -R . + augroup END +endif + " format on write if g:ats_autoformat == 1 augroup ats - autocmd BufWritePost *.ats,*.dats,*.sats,*.cats call AtsFormat() + autocmd BufWritePost *.ats,*.dats,*.sats,*.cats call AtsFormat() augroup END endif " commands command -nargs=0 Format call AtsFormat() -command -nargs=0 Check SyntasticCheck patscc map Clear :SyntasticReset diff --git a/syntax_checkers/ats/patscc.vim b/syntax_checkers/ats/patscc.vim index 2a125b0..523571d 100644 --- a/syntax_checkers/ats/patscc.vim +++ b/syntax_checkers/ats/patscc.vim @@ -13,7 +13,7 @@ function! SyntaxCheckers_ats_patscc_GetLocList() dict let errorformat = \ 'exit(ATS):%m,' . - \ '%f:%m' + \ '%f:\ %\d%#(line=%l\,\ offs=%c) --%m' let loclist = SyntasticMake({ \ 'makeprg': makeprg,