blob: 76a6bd224ee1ae050950225946448fb9bc512cef (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
let s:base = expand("<sfile>:h:h")
let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" }
let files = filter(globpath(&rtp, 'ftplugin/dhall.vim', 1, 1), Filter)
if len(files) > 0
exec 'source ' . files[0]
finish
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dhall') == -1
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
autocmd BufWritePost *.dhall silent !ctags -R .
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
au BufWritePre *.dhall silent! call StripTrailingWhitespace()
endif
endif
function! DhallFormat()
let cursor = getpos('.')
exec 'normal! gg'
exec 'silent !dhall format --inplace ' . expand('%')
exec 'e'
call setpos('.', cursor)
endfunction
if exists('g:dhall_format')
if g:dhall_format == 1
au BufWritePost *.dhall call DhallFormat()
endif
endif
au BufNewFile,BufRead *.dhall setl shiftwidth=2
endif
|