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

fixed vim indentation issue

commit10a1154e58404e533ef42c487618d062b17ef3b0 authorEdwin Brady <edwin.brady@gmail.com> dateMon 5 Nov 2012, 02:59 (14 years ago) parentbd89fdc8e94d86
1 file changed+16−16
contribs/tool-support/vim/indent/idris.vim+16−16
contribs/tool-support/vim/indent/idris.vim+16−16
@@ -3,7 +3,7 @@
33" Based on haskell indentation by motemen <motemen@gmail.com>
44"
55" author: raichoo (raichoo@googlemail.com)
6−" date: Oct 31 2012
6+" date: Nov 2 2012
77"
88" Modify g:idris_indent_if and g:idris_indent_case to
99" change indentation for `if'(default 3) and `case'(default 5).
@@ -67,7 +67,7 @@ function! GetIdrisIndent()
6767 return match(prevline, '[{([]')
6868 endif
6969
70− if prevline =~ 'let\s\+.\+in\s*$'
70+ if prevline =~ '\<let\>\s\+.\+\<in\>\s*$'
7171 return match(prevline, 'let') + g:idris_indent_let
7272 endif
7373
@@ -83,40 +83,40 @@ function! GetIdrisIndent()
8383 endif
8484 endif
8585
86− if prevline =~ '\(where\|do\|=\|[{([]\)\s*$'
86+ if prevline =~ '\(\<where\>\|\<do\>\|=\|[{([]\)\s*$'
8787 return match(prevline, '\S') + &shiftwidth
8888 endif
8989
90− if prevline =~ 'where\s\+\S\+.*$'
91− return match(prevline, 'where') + g:idris_indent_where
90+ if prevline =~ '\<where\>\s\+\S\+.*$'
91+ return match(prevline, '\<where\>') + g:idris_indent_where
9292 endif
9393
94− if prevline =~ 'do\s\+\S\+.*$'
95− return match(prevline, 'do') + g:idris_indent_do
94+ if prevline =~ '\<do\>\s\+\S\+.*$'
95+ return match(prevline, '\<do\>') + g:idris_indent_do
9696 endif
9797
98− if prevline =~ '^\s*\(co\)\?data\s\+[^=]\+\s\+=\s\+\S\+.*$'
98+ if prevline =~ '^\s*\<\(co\)\?data\>\s\+[^=]\+\s\+=\s\+\S\+.*$'
9999 return match(prevline, '=')
100100 endif
101101
102− if prevline =~ 'with\s\+([^)]*)\s*$'
102+ if prevline =~ '\<with\>\s\+([^)]*)\s*$'
103103 return match(prevline, '\S') + &shiftwidth
104104 endif
105105
106− if prevline =~ 'case\s\+.\+of\s*$'
106+ if prevline =~ '\<case\>\s\+.\+\<of\>\s*$'
107107 return match(prevline, 'case') + g:idris_indent_case
108108 endif
109109
110− if prevline =~ '^\s*\(namespace\|\(co\)\?data\)\s\+\S\+\s*$'
111− return match(prevline, '\(namespace\|\(co\)\?data\)') + &shiftwidth
110+ if prevline =~ '^\s*\(\<namespace\>\|\<\(co\)\?data\>\)\s\+\S\+\s*$'
111+ return match(prevline, '\(\<namespace\>\|\<\(co\)\?data\>\)') + &shiftwidth
112112 endif
113113
114− if prevline =~ '^\s*\(using\|parameters\)\s*([^(]*)\s*$'
115− return match(prevline, '\(using\|parameters\)') + &shiftwidth
114+ if prevline =~ '^\s*\(\<using\>\|\<parameters\>\)\s*([^(]*)\s*$'
115+ return match(prevline, '\(\<using\>\|\<parameters\>\)') + &shiftwidth
116116 endif
117117
118− if prevline =~ '^\s*mutual\s*$'
119− return match(prevline, 'mutual') + &shiftwidth
118+ if prevline =~ '^\s*\<mutual\>\s*$'
119+ return match(prevline, '\<mutual\>') + &shiftwidth
120120 endif
121121
122122 let line = getline(v:lnum)