Skip to content
A Vim plugin for Windows PowerShell support
Vim script
Branch: master
Clone or download
Pull request Compare This branch is 4 commits ahead of PProvost:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



This is a fork of PProvost/vim-ps1. I've decided to fork Peter's project mostly due how the original project chose to set the vim filetype to ps1. Another user created an issue requesting it be changed to powershell, but that was rejected.

My main reason for wanting the filetype to be powershell is in association with the w0rp/ale (A vim plugin which brings linting support to many languages). In Ale, it did not seem fitting to create the powershell support to work with a filetype ps1 where all other filetypes are set based on the language name, not the file extension.

Thank-you to Peter and all other contributors of the original vim-ps1 project.

Changes from vim-ps1

  • Renamed filetype from ps1 to powershell
  • Replaced indentation script with script from Lior Elia.
  • Added compiler settings, so a powershell script can be parsed with :make

Thanks to Lior Elia for the indentation script and Enno Nagel for the suggestions on how to setup errorformat and makeprg in a filetype plugin. See here for info on that.

Original Readme

If you are a Windows PowerShell user who uses Vim or Gvim for editing scripts, then this plugin is for you.

It provides nice syntax coloring and indenting for PowerShell (.ps1) files, and also includes a filetype plugin so Vim can autodetect your PS1 scripts.

Includes contributions by:

  • Tomas Restrepo
  • Jared Parsons
  • Heath Stewart
  • Michael B. Smith
  • Alexander Kostikov


Copy the included directories into your .vim or vimfiles directory.

Or even better, use pathogen.vim and simply pull it in like this:

cd ~/.vim/bundle
git clone


The powershell syntax file provides syntax folding for script blocks and digital signatures in scripts.

When 'foldmethod' is set to "syntax" then function script blocks will be folded unless you use the following in your .vimrc or before opening a script:

:let g:ps1_nofold_blocks = 1

Digital signatures in scripts will also be folded unless you use:

:let g:ps1_nofold_sig = 1

Note: syntax folding might slow down syntax highlighting significantly, especially for large files.

Comments and Suggestions

Please follow, fork or submit issues on GitHub


Copyright 2005-2012 Peter Provost

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Version History

  • v2.10 (2013-06-24) Added Heath Stewart's here strings fix
  • v2.9 (2012-03-08) Included tomasr's changes
  • v2.81 (2012-03-05) Fixed a dumb typo
  • v2.8 (2012-03-05) Better number scanning, multiline comments, missing keywords and constants
  • v2.7 (2008-09-22) Begin, process & end keywords. Better highlighting of foreach and where
  • v2.6 (2007-03-05) Added unary -not operator
  • v2.5 (2007-03-03) Updates for here-strings, comment todos, other small cleanups
  • v2.4 (2007-03-02) Added elseif keyword
  • v2.3 (2007-02-27) Added param keyword
  • v2.2 (2007-02-19) Missing keywords
  • v2.1 (2006-07-31) Update for renaming
  • v2.0 (2005-12-21) Big update from Jared Parsons
  • v1.3 (2005-12-20) Updates to syntax elements
  • v1.2 (2005-08-13) Fix foreach and while problem
  • v1.1 (2005-08-12) Initial release
You can’t perform that action at this time.