various improvements

This commit is contained in:
Vanessa McHale 2017-12-23 19:52:41 -06:00
parent 12429bd0c4
commit 991a7105e1
3 changed files with 27 additions and 5 deletions

View File

@ -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*

View File

@ -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 <Plug>Clear :SyntasticReset<CR>

View File

@ -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,