summaryrefslogtreecommitdiffstats
path: root/ftplugin
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2019-09-04 16:06:18 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2019-09-04 16:06:18 +0200
commit832dfece7629ac1a6f4894e956802b456ae791ea (patch)
tree2165f0f8cfded20568d3022b0a19bbb25b025434 /ftplugin
parent933e42ea1f2d615c8ce5aa6daa2994e6369de3cf (diff)
downloadvim-polyglot-832dfece7629ac1a6f4894e956802b456ae791ea.tar.gz
vim-polyglot-832dfece7629ac1a6f4894e956802b456ae791ea.zip
Add dhall, closes #426
Diffstat (limited to '')
-rw-r--r--ftplugin/dhall.vim39
1 files changed, 39 insertions, 0 deletions
diff --git a/ftplugin/dhall.vim b/ftplugin/dhall.vim
new file mode 100644
index 00000000..7afad55f
--- /dev/null
+++ b/ftplugin/dhall.vim
@@ -0,0 +1,39 @@
+if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dhall') != -1
+ finish
+endif
+
+if exists('b:dhall_ftplugin')
+ finish
+endif
+let b:dhall_ftplugin = 1
+
+setlocal commentstring=--\ %s
+
+set smarttab
+
+if exists('g:dhall_use_ctags')
+ if g:dhall_use_ctags == 1
+ augroup dhall
+ autocmd BufWritePost *.dhall silent !ctags -R .
+ augroup END
+ endif
+endif
+
+function! StripTrailingWhitespace()
+ let myline=line('.')
+ let mycolumn = col('.')
+ exec 'silent %s/ *$//'
+ call cursor(myline, mycolumn)
+endfunction
+
+if exists('g:dhall_strip_whitespace')
+ if g:dhall_strip_whitespace == 1
+ augroup dhall
+ au BufWritePre *.dhall silent! call StripTrailingWhitespace()
+ augroup END
+ endif
+endif
+
+augroup dhall
+ au BufNewFile,BufRead *.dhall setl shiftwidth=2
+augroup END