summaryrefslogtreecommitdiffstats
path: root/ftplugin/pony.vim
blob: dee95d8e92240397c96451ea3b37ecd403393ac6 (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
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/pony.vim', 1, 1), Filter)
if len(files) > 0
  exec 'source ' . files[0]
  finish
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'pony') == -1

" Vim filetype plugin file
" Language:     Pony
" Maintainer:   Jak Wings

if exists('b:did_ftplugin')
  finish
endif

let s:cpo_save = &cpo
set cpo&vim


setlocal comments=://,nsr:/*,mb:*,ex:*/
setlocal commentstring=/*%s*/
setlocal formatoptions-=t fo+=c fo+=r fo+=o fo+=q fo+=l fo+=j

"setlocal path=
"setlocal includeexpr=
setlocal include=\\v^\\s*use\\_s+%(\\i+\\_s*\\=\\_s*)?"\\zs[^"]*\\ze"
setlocal define=\\v^\\s*%(actor\|class\|struct\|primitive\|trait\|interface\|type\|new\|be\|fun\|let\|var\|embed\|use\|for\\_s+%(\\i+\\_s*,\\_s*)*\|with\\_s+%(\\i+\\_s*,\\_s*)*)\|(<\\i+\\_s*:\\_s*\\i+)@=
setlocal isident=@,48-57,_,39
setlocal iskeyword=@,48-57,_,39
setlocal suffixesadd=.pony
setlocal matchpairs=(:),{:},[:]

let b:match_ignorecase = 0
let b:match_skip = 's:Comment\|String\|Character\|CaseGuard'
let b:match_words = '\v<%(ifdef|if|match|while|for|repeat|try|with|recover|object|lambda|iftype)>\m:\v<%(then|elseif|else|until|do|in|elseiftype)>|\|\m:\<end\>,(:),\[:\],{:}'
" TODO: for more concise behavior
"let b:match_words = 'pony#GetMatchWords()'
source $VIMRUNTIME/macros/matchit.vim

let b:undo_ftplugin = 'set comments< commentstring< formatoptions< path< include< includeexpr< define< isident< iskeyword< suffixesadd< matchpairs<'
      \ . ' | unlet! b:match_ignorecase b:match_skip b:match_words'


let &cpo = s:cpo_save
unlet s:cpo_save

let b:did_ftplugin = 1

endif