on master help sign in
Merge pull request #247 from raichoo/vim

vim: added rewrite construct

commit30124793c4822bbd979b85470b3bb28351204543 authorEdwin Brady <edwin.brady@gmail.com> dateWed 20 Mar 2013, 04:14 (14 years ago) parent8cf25fc3bed740
2 files changed+13−3
contribs/tool-support/vim/indent/idris.vim+11−1 contribs/tool-support/vim/syntax/idris.vim+2−2
contribs/tool-support/vim/indent/idris.vim+11−1
@@ -3,7 +3,7 @@
33" Based on haskell indentation by motemen <motemen@gmail.com>
44"
55" author: raichoo (raichoo@googlemail.com)
6−" date: Nov 2 2012
6+" date: Mar 19 2013
77"
88" Modify g:idris_indent_if and g:idris_indent_case to
99" change indentation for `if'(default 3) and `case'(default 5).
@@ -36,6 +36,12 @@ if !exists('g:idris_indent_let')
3636 let g:idris_indent_let = 4
3737endif
3838
39+if !exists('g:idris_indent_rewrite')
40+ " rewrite prf in expr
41+ " >>>>x
42+ let g:idris_indent_rewrite = 8
43+endif
44+
3945if !exists('g:idris_indent_where')
4046 " where f : Nat -> Nat
4147 " >>>>>>f x = x
@@ -71,6 +77,10 @@ function! GetIdrisIndent()
7177 return match(prevline, 'let') + g:idris_indent_let
7278 endif
7379
80+ if prevline =~ '\<rewrite\>\s\+.\+\<in\>\s*$'
81+ return match(prevline, 'rewrite') + g:idris_indent_rewrite
82+ endif
83+
7484 if prevline !~ '\<else\>'
7585 let s = match(prevline, '\<if\>.*\&.*\zs\<then\>')
7686 if s > 0
contribs/tool-support/vim/syntax/idris.vim+2−2
@@ -4,7 +4,7 @@
44" highlighter to support idris.
55"
66" author: raichoo (raichoo@googlemail.com)
7−" date: Mar 12 2013
7+" date: Mar 19 2013
88
99syn match idrisModule "\<\(module\|namespace\)\>"
1010syn match idrisImport "\<import\>"
@@ -12,7 +12,7 @@ syn match idrisStructure "\<\(class\|\(co\)\?data\|instance\|where\|record\|dsl\
1212syn match idrisVisibility "\<\(public\|abstract\|private\)\>"
1313syn match idrisBlock "\<\(parameters\|mutual\|postulate\|using\)\>"
1414syn match idrisAnnotation "\<\(total\|partial\|auto\|impossible\|static\|implicit\)\>"
15−syn match idrisStatement "\<\(do\|case\|of\|let\|in\|with\)\>"
15+syn match idrisStatement "\<\(do\|case\|of\|rewrite\|let\|in\|with\)\>"
1616syn match idrisSyntax "\(pattern \+\|term \+\)\?syntax"
1717syn match idrisConditional "\<\(if\|then\|else\)\>"
1818syn match idrisTactic contained "\<\(intros\?\|rewrite\|exact\|refine\|trivial\|let\|focus\|try\|compute\|solve\|attack\|reflect\)\>"