-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Included Aquila Deus' cs indent file.
Fixes attribute indenting - #6
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |