<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,20 +1,96 @@
 &quot; Vim indent file
-&quot; Language: Windows PowerShell
-&quot; Maintainer: Peter Provost &lt;peter@provost.org&gt;
-&quot; Version: 1.0
-&quot;
-&quot; $LastChangedDate $
-&quot; $Rev 	$
+&quot; Language:		PowerShell
+&quot; Maintainer:	Lior Elia - http://blogs.msdn.com/lior
+&quot; Version:		2.0
+&quot; Last Change:	2009 Oct 18
+&quot; Changelist:	
+&quot; 	Ver		Date		By			Fixed indentation of...
+&quot; 	-----	----------	--------	-----------------------------------------
+&quot;	1.0		2009-10-04	LiorE		Comment rows
+&quot; 	2.0		2009-10-18	LiorE		Lines after (.*), comments after '{' or
+&quot;					 				'}' and many many other things. I've made
+&quot;					 				this a major version change because there
+&quot;					 				are many changes in the behavior.
+
+&quot; Dedicated to my loving and supporting family: Anat, Amit and Ofir.
 
 &quot; Only load this indent file when no other was loaded.
 if exists(&quot;b:did_indent&quot;)
-  finish
+	finish
 endif
 let b:did_indent = 1
 
-&quot; PS indenting is like indenting C
-setlocal cindent cinoptions&amp; cinoptions+=+0 cinkeys-=0#
+setlocal cindent cinoptions&amp; cinoptions+=+0
+
+&quot; Set the function to do the work.
+setlocal indentexpr=GetPsIndent()
+
+let b:undo_indent = &quot;set cin&lt; cino&lt; indentkeys&lt; indentexpr&lt;&quot;
+
+&quot; Only define the function once.
+if exists(&quot;*GetPsIndent&quot;)
+	finish
+endif
+
+function! Log(text)
+		&quot; Enable the line below for debugging
+		&quot; call confirm(a:text)
+endfunction
+
+function! SkipPsComments(startline)
+	let lnum = a:startline
+	while lnum &gt; 1
+		let lnum = prevnonblank(lnum)
+		if getline(lnum) =~ '^\s*#'
+			let lnum = lnum - 1
+		else
+			break
+		endif
+	endwhile
+	return lnum
+endfunction
+
+function GetPsIndent()
+
+	&quot; PowerShell is almost like C; use the built-in C indenting and then correct the comment/precompiler duality.
+	let theIndent = cindent(v:lnum)
+	let prevLine = SkipPsComments(v:lnum-1)
+if (prevLine &gt; 0) 
+	let prevLineIndent = indent(prevLine)
+else
+	let prevLineIndent = 0
+endif
+
+	call Log(&quot;prevline &quot; . prevLine . &quot; - Indent is &quot; . prevLineIndent)
+	&quot; if prev line ends with paranthesis (...) it messes the indentation
+	if getline(prevLine) =~ '(.*)$'
+		&quot; set the indent to be the same of the prev non blank non comment line
+		let theIndent = prevLineIndent
+		if getline(v:lnum) =~ '^[^{]*}'
+			&quot; remove one indentation level, clsoing a block
+			let theIndent -= &amp;sw
+		endif
+	endif
 
-&quot; don't force comments to first line
+	&quot; comment lines are mishandled as precompiler directives ('#') so fix that.
+	
+	call Log(&quot;before comment - Indent is &quot; . theIndent)
+	&quot; if current line is a comment...
+	if getline(v:lnum) =~ '^\s*#'
+		let theIndent = prevLineIndent
+		&quot; if prev line opened a block - 
+		if getline(prevLine) =~ '{$'
+			&quot; indent once more, because we're in a beginning of a block
+			let theIndent += &amp;sw
+		elseif getline(prevLine) =~ '([^)]*$'
+			&quot; indent twice more, because we're in a beginning of a parameters
+			&quot; block which gets indented twice by cindent, for some obscure
+			&quot; reason...
+			let theIndent += &amp;sw
+			let theIndent += &amp;sw
+		endif
+	endif
+	call Log(&quot;After - Indent is &quot; . theIndent)
+	return theIndent
+endfunction
 
-let b:undo_indent = &quot;setl cin&lt;&quot;</diff>
      <filename>.vim/indent/ps1.vim</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8b266ec0aba9ff82c47b0eb18e0c2d5eb939dcda</id>
    </parent>
  </parents>
  <author>
    <name>Tomas Restrepo</name>
    <email>tomas@winterdom.com</email>
  </author>
  <url>http://github.com/tomasr/dotfiles/commit/d26939a52929d35f1f11713696a23a9e5e5fc03d</url>
  <id>d26939a52929d35f1f11713696a23a9e5e5fc03d</id>
  <committed-date>2009-10-19T12:11:36-07:00</committed-date>
  <authored-date>2009-10-19T12:11:36-07:00</authored-date>
  <message>Switching to Lior Elia's PowerShell indent plugin</message>
  <tree>0323750f19d664a7fa790fbc4344adea5058814a</tree>
  <committer>
    <name>Tomas Restrepo</name>
    <email>tomas@winterdom.com</email>
  </committer>
</commit>
