mirror of
https://github.com/google/vim-jsonnet.git
synced 2026-01-21 18:11:42 +01:00
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.
28 lines
491 B
VimL
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
|
|
|