Partilhar via


PowerShell indentation file for VIM

I've been writing my PowerShell scripts in VIM for a while now.
I've downloaded the syntax, ftplugin and indent scripts from vim site but I've found one annoying problem.
The original ps1.vim indent script was mostly a stub that assumed PowerShell indentation is exactly the same as C/C++/C#.
Well, mostly it is. There is one little (but annoying) difference.
In PowerShell - a line beginning with the '#' sign is a comment line and should be indented as any other code line in that indentation level.
In the C language variants, however, lines beginning with '#' are precompiler lines which are never indented.

And so, as the old saying goes - "Necessity is the mother of all inventions" - i sat down this morning and started to write my very first VIM script: PowerShell indentation.

You can find it in the scripts repository here. Free for all.
I think that for a first-timer it's not too bad.
Please let me know if you find any bugs or wish to add functionality (but I don't promise anything).