-
Notifications
You must be signed in to change notification settings - Fork 9
/
sml.vim
66 lines (56 loc) · 2.01 KB
/
sml.vim
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
55
56
57
58
59
60
61
62
63
64
65
" Vim filtype plugin
" Language: SML
" Maintainer: Jake Zimmerman <jake@zimmerman.io>
" Created: 08 Mar 2016
" License: MIT License
" Use apostrophes in variable names (useful for things like ^P (completion),
" ^W (back delete word), etc.)
setlocal iskeyword+='
" '$' is valid as or in a variable name
setlocal iskeyword+=$
" '#' is valid in projections (like #1 or #foo)
setlocal iskeyword+=#
" Set comment string so things like vim-commentary and foldmethod can use them
" appropriately.
setlocal commentstring=(*%s*)
" The default lprolog filetype plugin that ships with Vim interferes with SML.
" To fight back, we explicitly turn off the formatprg here.
setlocal formatprg=
augroup vimbettersmlinternal
au!
" Automatically build def use file on save
if g:sml_auto_create_def_use !=# 'never'
au BufWritePost <buffer> call bettersml#process#BuildDefUse()
endif
augroup END
" ----- Raimondi/delimitMate -----
" Single quotes are part of identifiers, and shouldn't always come in pairs.
let b:delimitMate_quotes = '"'
" ----- scrooloose/syntastic -----
" Attempt to detect CM files in SML/NJ checker
if exists('g:loaded_syntastic_plugin')
let s:cm = bettersml#util#GetCmFileOrEmpty()
if s:cm !=# ''
let s:buf = bufnr('')
call setbufvar(s:buf, 'syntastic_sml_smlnj_fname', '')
call setbufvar(s:buf, 'syntastic_sml_smlnj_post_args', '-m ' . syntastic#util#shescape(s:cm))
endif
endif
" ----- w0rp/ale -----
" Set b:sml_smlnj_cm_file using config from JSON file
if exists('g:loaded_ale')
let s:buf = bufnr('')
call setbufvar(s:buf, 'ale_sml_smlnj_cm_file', bettersml#util#GetCmFilePattern())
endif
if exists('g:ale_linters')
if !has_key(g:ale_linters, 'sml')
if ale#handlers#smlsharp#GetExecutableSmlsharpFile(bufnr('')) ==# 'smlsharp'
let g:ale_linters.sml = ['smlsharp_file']
endif
endif
endif
" ----- a.vim -----
" Sets up *.sig and *.sml files as "alternates", similar to how *.h and *.c
" files are alternates
let g:alternateExtensions_sml = 'sig'
let g:alternateExtensions_sig = 'sml'