Skip to content

Commit 1b918dc

Browse files
gpandersandrewrk
authored andcommitted
Move BufWrite autocmd to ftplugin
Move the autocommand into the ftplugin, making it buffer local.
1 parent 1cb9cd5 commit 1b918dc

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

ftplugin/zig.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ endif
5050
let b:undo_ftplugin =
5151
\ 'setl isk< et< ts< sts< sw< fo< sua< mp< com< cms< inex< inc< pa<'
5252

53+
augroup vim-zig
54+
autocmd! * <buffer>
55+
autocmd BufWritePre <buffer> if get(g:, 'zig_fmt_autosave', 1) | call zig#fmt#Format() | endif
56+
augroup END
57+
58+
let b:undo_ftplugin .= '|au! vim-zig * <buffer>'
59+
5360
let &cpo = s:cpo_orig
5461
unlet s:cpo_orig
5562
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab

plugin/zig.vim

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)