PowerShell highlighting in Vim

Well, I feel stupid. I just finally got syntax highlighting for PowerShell to work in Vim. I did a little Googling and found my solution in the PDF document linked form this article. Why you need an 8 page PDF to explain this is a completely different issue.

Turns out I was just missing some lines in my filetype.vim file. I already had the syntax, indent, and file type plugins, I just didn't think to add the code to activate them (for some reason I thought that stuff was loaded dynamically). However, page 6 of that PDF gave the answer:

" Powershell
au BufNewFile,BufRead *.ps1,*.psc1 setf ps1

I just added those lines to my filetype.vim, below the corresponding entries for Povray files, and voilĂ ! Syntax highlighting now works.

You can reply to this entry by leaving a comment below. You can send TrackBack pings to this URL. This entry accepts Pingbacks from other blogs. You can follow comments on this entry by subscribing to the RSS feed.

Comments #

    Syntax highlighting?

    We don't need no steenking syntax highlighting! I told you I was hardcore! *GRIN*

    • Comment posted on Thursday 19 Feb 2009 at 7:19pm
    • By Dan

    Syntax highlighting is good...

    Syntax highlighting is great, I surrender my will as of this date.

    Or...na-na-na-na-na-na-na-na na-na-na-na-na-na-na-na SYNTAX HIGHLIGHTING!

    (Link for those who didn't see that episode of the Simpsons: http://www.snpp.com/episodes/5F23)

    I used to be hardcore. Or, at least, I tried to be. Then I realized it was way too much work and I couldn't really pull it off anyway. So I went back to using a fancy IDE with syntax highlighting and intellisense. To each his own.

    Also needed

    In vim73, you also must edit the file: Vim73\Syntax\synload.vim,
    to add the line, "SynAu ps1"

    Without this, mine never would do syntax highlighting, despite copying all the files into correct places, and editing the filetype.vim

    • Comment posted on Friday 10 Aug 2012 at 1:30am
    • By mhz

Add your comments #

A comment body is required. No HTML code allowed. URLs starting with http:// or ftp:// will be automatically converted to hyperlinks.