Giter Club home page Giter Club logo

vim-ps1's Introduction

ps1.vim

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 Windows 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

Installation

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 https://github.com/PProvost/vim-ps1.git

If you use vim-plug add this to your config:

Plug 'pprovost/vim-ps1'

Folding

The ps1 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 and if you find it useful, please vote for it on vim.org.

License

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

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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

vim-ps1's People

Contributors

acc987 avatar anntzer avatar anthirian avatar anthony-geoghegan avatar bak-t avatar cyansprite avatar heaths avatar idbrii avatar jakykong avatar jimpallomeni avatar konfekt avatar laaman03 avatar machakann avatar macro187 avatar miiton avatar mwgamera avatar namelessuzer avatar nemo157 avatar ojdo avatar persistent13 avatar pprovost avatar tomasr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-ps1's Issues

Unexpected highlighting for System.Data

Hope this is still active repo.

Somehow if creating object from System.Data namespace, "Data" word gets highlighted:

$dt = New-Object System.Data.DataTable

Doesn't work on gvim 7.4?

I'm using Windows 10 and gvim 7.4.

I put vim-ps1 in ~\.vim\plugin but starting gvim doesn't seem to load the ps1 script correctly.

I also tried manually: :source ~\.vim\plugin\vim-ps1\ftplugin\ps1.vim. Still don't see Powershell among the languages.

Use better versioning for tags

Please use better versioning. Many tools consider 2.81 as the latest release
because they think 2.81 is higher than 2.9.
Maybe use semantic versioning -> 2.81 -> 2.8.1

How do I close the terminal?

I recently installed this plugin and everytime I open PS1 files, a terminal buffer is opening as well. This is happening both on my windows10 and Mac. It's not very obvious to me which option i should put. Any thoughts?

Add option to only recognize functions that Start-Words-With-Capitals

Currently, the syntax file recognizes all words-with-dashes as function invocations (syn match ps1FunctionInvocation /\w\+\(-\w\+\)\+/), which can yield many false positives, and is also incosistent with the line just above (syn match ps1FunctionDeclaration /\w\+\(-\w\+\)*/ contained -- no dash is needed for recognition).

A possibility to decrease the amount of false positives would be to require (perhaps togglable) additionally that the word starts with an uppercase letter (\u\w*), which is consistent with MS's style guide (https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/capitalization-conventions).

Why is 'formatoptions' j not enabled by default?

Currently ps1.vim overrides the 'formatoptions' as follows:

setlocal formatoptions=tcqro

Unfortunately that means that set formatoptions+=j in my .vimrc is not applied for PowerShell files. As that format option seems to work with PowerShell syntax (at least for comments starting with '#', which is what I tried), I wanted to know whether that omission is intentional or accidental?

Syntax highlighting isn't activated based on shebang

Hi there. Thanks for this handy plugin. I'm seeing behavior where a script named foo (with no ps1 extension) and the following content:

#!/usr/bin/env pwsh
Write-Output "foo"

Won't be highlighted properly until I explicitly run :set syn=ps1. For other languages the shebang line works to infer the appropriate syntax highlighter, so it'd be nice if this was the case for PowerShell scripts as well.

Indentation not correct when in block

The indentation of the powershell script is not correct when in braces blocks. For instance, the following lines are correct:

Write-Host "line 1"
Write-Host "line 2"

While, if they are inside a pair of braces, when use = to indent the code block, the outcome becomes:

If ($value -gt 0)
{
    Write-Host "line 1"
        Write-Host "line 2"
}

Add to vim package index (vim-pi)

Hello. I added your plugin to the vim package index, so that I could install it automagically via my plugin manager. Please review and provide your input on the pull request, over on BitBucket.

Thanks!

Invalid ^M in config files

This does not work out of the box on Linux because of the unexpected ^M.

You have to run the files with errors through dos2unix before it works correctly.

Please help me install this plugin

Hello,
Can someone please help me get this working?
Windows 10 ent, fully updated
I installed gvim81.exe
I have a _gvimrc file in c:\users\me
I downloaded this plugin vim-ps1-master.zip
I created a directory in c:\users\me.vim
I unzipped vim-ps1-master.zip in .vim
I also created c:\users\vimfile and unzipped vim-ps1-master.zip into it

When I edit a .ps1 file, I don't see any syntax highlighting. the setting in _gvimrc do work, so I am in the right directory, I think.

What else do I need to do?
Thanks

Why the name of filetype is "ps1"?

The extension of Ruby language is ".rb" and filetype is "ruby".
The extension of Python language is ".py" and filetype is "python".
The extension of Perl language is ".pl" and filetype is "perl".

Why the name of filetype is "ps1", not "powershell"?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.