Add test for indenting

This commit is contained in:
baabelfish 2016-03-15 00:22:06 +02:00
commit dc958bcc42
2 changed files with 34 additions and 4 deletions

View file

@ -21,6 +21,10 @@ function! Up()
return (indent(prevnonblank(v:lnum - 1)) + &tabstop)
endfunction
function! Hold()
return indent(prevnonblank(v:lnum - 1))
endfunction
function! NimIndent()
let line = getline(v:lnum)
let prev = prevnonblank(v:lnum - 1)
@ -28,6 +32,10 @@ function! NimIndent()
let prev2empty = getline(v:lnum - 2) =~ '^\s*$'
let prevl = getline(prev)
if prevl =~ ',\s*$'
return Hold()
endif
if prev2empty && prevempty
return
endif
@ -52,10 +60,6 @@ function! NimIndent()
return Up()
endif
if prevl =~ ',\s*$'
return -1
endif
if prevempty && prevl =~ '\s*\(result\|return\|break\|continue\|raise\)'
return Down()
endif

View file

@ -0,0 +1,26 @@
Given nim:
import
sequtils,
streams
type Obj = object
x, y: int
proc nope =
echo "foobar"
nope()
Do:
gg=G
Expect:
import
sequtils,
streams
type Obj = object
x, y: int
proc nope =
echo "foobar"
nope()