Skip to content

Commit

Permalink
Opt in to register aucmd for auto format and ast check.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiseno committed Dec 30, 2023
1 parent 54c216e commit db6d516
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ftplugin/zig.vim
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ endif
let b:undo_ftplugin =
\ 'setl isk< et< ts< sts< sw< fo< sua< mp< com< cms< inex< inc< pa<'

augroup vim-zig
autocmd! * <buffer>
autocmd BufWritePre <buffer> if get(g:, 'zig_fmt_autosave', 1) | call zig#fmt#Format() | endif
augroup END

let b:undo_ftplugin .= '|au! vim-zig * <buffer>'
if get(g:, 'zig_fmt_autosave', 0)
augroup vim-zig
autocmd! * <buffer>
autocmd BufWritePre <buffer> call zig#fmt#Format()
augroup END
let b:undo_ftplugin .= '|au! vim-zig * <buffer>'
endif

let &cpo = s:cpo_orig
unlet s:cpo_orig
Expand Down

0 comments on commit db6d516

Please sign in to comment.