vim-jsonnet/plugin/jsonnet.vim
Hakan Baba 5c07e8e8fa Added automatic jsonned execution at save time.
Added documentation, a vim command, a user callable function and an
autocommand that gets executed at every save.

The defaults are hight configurable with options that are also
documented in this change.
2016-10-07 23:14:11 -07:00

28 lines
491 B
VimL

" A plugin for jsonnet files.
" Install useful tools for *.jsonnet and *.libsonnet files
function! s:fmtAutosave()
" Jsonnet code formatting on save
if get(g:, "jsonnet_fmt_on_save", 1)
call jsonnet#Format()
endif
endfunction
" auto group and clear inside prevents multiple registration of the same
" auto commands
augroup vim-jsonnet
autocmd!
autocmd BufWritePre *.jsonnet call s:fmtAutosave()
autocmd BufWritePre *.libsonnet call s:fmtAutosave()
augroup END