summaryrefslogtreecommitdiffstats
path: root/ftplugin/dhall.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2019-12-31 14:05:09 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2019-12-31 14:05:09 +0100
commitb8a5504021e0d21310bc603855ac8107828b5759 (patch)
tree2f2bf182b686597e7cc4c4f1b7d35881f9993f55 /ftplugin/dhall.vim
parentcea0d08a062478503814e51aa21c6486a0dd1b21 (diff)
downloadvim-polyglot-b8a5504021e0d21310bc603855ac8107828b5759.tar.gz
vim-polyglot-b8a5504021e0d21310bc603855ac8107828b5759.zip
Update
Diffstat (limited to 'ftplugin/dhall.vim')
-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