Skip to content

Commit

Permalink
Included Aquila Deus' cs indent file.
Browse files Browse the repository at this point in the history
Fixes attribute indenting - #6
  • Loading branch information
kianryan committed Jan 11, 2013
1 parent e1e2c55 commit 7a0db96
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions indent/cs.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
" Vim indent file
" Language: C#
" Maintainer: Aquila Deus
"

" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1


setlocal indentexpr=GetCSIndent()


function! GetCSIndent()

let this_line = getline(v:lnum)
let previous_line = getline(v:lnum - 1)

" Hit the start of the file, use zero indent.
if a:lnum == 0
return 0
endif

" If previous_line is an attribute line:
if previous_line =~? '^\s*\[[A-Za-z]' && previous_line =~? '\]$'
let ind = indent(v:lnum - 1)
return ind
else
return cindent(v:lnum)
endif

endfunction

0 comments on commit 7a0db96

Please sign in to comment.