summaryrefslogtreecommitdiffstats
path: root/ftplugin/pony.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ftplugin/pony.vim')
-rw-r--r--ftplugin/pony.vim44
1 files changed, 44 insertions, 0 deletions
diff --git a/ftplugin/pony.vim b/ftplugin/pony.vim
new file mode 100644
index 00000000..eef6824e
--- /dev/null
+++ b/ftplugin/pony.vim
@@ -0,0 +1,44 @@
+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