summaryrefslogtreecommitdiffstats
path: root/ftplugin/dhall.vim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ftplugin/dhall.vim14
1 files changed, 14 insertions, 0 deletions
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