From b8a5504021e0d21310bc603855ac8107828b5759 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 31 Dec 2019 14:05:09 +0100 Subject: Update --- ftplugin/dhall.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'ftplugin/dhall.vim') diff --git a/ftplugin/dhall.vim b/ftplugin/dhall.vim index 3e7c2d0a..d09f4c31 100644 --- a/ftplugin/dhall.vim +++ b/ftplugin/dhall.vim @@ -32,6 +32,20 @@ if exists('g:dhall_strip_whitespace') endif endif +function! DhallFormat() + let cursor = getpos('.') + exec 'silent %!dhall format' + call setpos('.', cursor) +endfunction + +if exists('g:dhall_format') + if g:dhall_format == 1 + augroup dhall + au BufWritePre *.dhall call DhallFormat() + augroup END + endif +endif + augroup dhall au BufNewFile,BufRead *.dhall setl shiftwidth=2 augroup END -- cgit v1.2.3