Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match the specification in the comments #5

Merged
merged 1 commit into from Feb 13, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions indent/scala.vim
Expand Up @@ -45,7 +45,7 @@ function! GetScalaIndent()
" Add a 'shiftwidth' after lines that start a block
" If if, for or while end with ), this is a one-line block
" If val, var, def end with =, this is a one-line block
if prevline =~ '^\s*\<\(\(else\s\+\)\?if\|for\|while\|va[lr]\|def\)\>.*[)=]\s*$'
if prevline =~ '^\s*\(\<\(\(else\s\+\)\?if\|for\|while\)\>.*[)=]\|\<\(va[lr]\|def\)\>.*=\)\s*$'
\ || prevline =~ '^\s*\<else\>\s*$'
\ || prevline =~ '{\s*$'
let ind = ind + &shiftwidth
Expand All @@ -62,7 +62,7 @@ function! GetScalaIndent()

" Dedent after if, for, while and val, var, def without block
let pprevline = getline(prevnonblank(lnum - 1))
if pprevline =~ '^\s*\<\(\(else\s\+\)\?if\|for\|while\|va[lr]\|def\)\>.*[)=]\s*$'
if pprevline =~ '^\s*\(\<\(\(else\s\+\)\?if\|for\|while\)\>.*[)=]\|\<\(va[lr]\|def\)\>.*=\)\s*$'
\ || pprevline =~ '^\s*\<else\>\s*$'
let ind = ind - &shiftwidth
endif
Expand Down