From c200e7a0c587f70611b8dd702d0c3b378676a39a Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Mon, 2 May 2016 10:49:45 +0200 Subject: Add crystal syntax, closes #118 --- ftplugin/crystal.vim | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 ftplugin/crystal.vim (limited to 'ftplugin') diff --git a/ftplugin/crystal.vim b/ftplugin/crystal.vim new file mode 100644 index 00000000..f990a8da --- /dev/null +++ b/ftplugin/crystal.vim @@ -0,0 +1,60 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo&vim + +if exists('loaded_matchit') && !exists('b:match_words') + let b:match_ignorecase = 0 + + let b:match_words = + \ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|struct\|lib\|macro\|ifdef\|def\|fun\|begin\)\>=\@!' . + \ ':' . + \ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' . + \ ':' . + \ '\' . + \ ',{:},\[:\],(:)' + + let b:match_skip = + \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . + \ "\\'" +endif + +setlocal comments=:# +setlocal commentstring=#\ %s +setlocal suffixesadd=.cr + +" Set format for quickfix window +setlocal errorformat= + \%ESyntax\ error\ in\ line\ %l:\ %m, + \%ESyntax\ error\ in\ %f:%l:\ %m, + \%EError\ in\ %f:%l:\ %m, + \%C%p^, + \%-C%.%# + +if get(g:, 'crystal_define_mappings', 1) + nmap gd (crystal-jump-to-definition) + nmap gc (crystal-show-context) + nmap gss (crystal-spec-switch) + nmap gsa (crystal-spec-run-all) + nmap gsc (crystal-spec-run-current) +endif + +if &l:ofu ==# '' + setlocal omnifunc=crystal_lang#complete +endif + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: nowrap sw=2 sts=2 ts=8: + +endif -- cgit v1.2.3