ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Modern​Perl

by Blaizer ST2/ST3

Perl syntax highlighting for Sublime Text that isn't outdated

Details

  • 2016.07.07.04.05.59
  • github.​com
  • github.​com
  • 1 year ago
  • 1 hour ago
  • 4 years ago

Installs

  • Total 11K
  • Win 5K
  • OS X 3K
  • Linux 3K
Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2
Windows 3 1 1 1 2 6 2 2 1 1 5 5 4 4 1 4 2 2 3 3 3 8 7 1 1 5 4 9 5 7 2 4 11 11 10 4 3 3 0 5 4 5 5 6 1 1
OS X 2 2 2 1 7 4 1 5 1 2 1 4 3 9 3 3 1 3 6 4 3 5 4 0 3 3 3 5 8 4 3 3 4 3 10 3 8 0 1 4 2 1 3 6 2 1
Linux 1 0 2 1 5 3 1 4 1 1 1 3 4 5 0 2 3 1 1 4 1 3 4 1 1 4 5 4 4 9 4 2 5 8 7 4 1 2 1 1 0 3 2 3 3 0

Readme

Source
raw.​githubusercontent.​com

ModernPerl

Perl syntax highlighter for Sublime Text that isn't outdated

Description

ModernPerl is an updated Perl syntax highlighter for Sublime Text. It's a drop-in replacement for the outdated Perl.tmLanguage that comes default with Sublime Text. The name “ModernPerl” was mostly just chosen as a joke to follow the Modern::Perl buzzword thing. Well… it is a modern syntax definition for Perl, and among many bug fixes, it does implement some of Perl's new syntax.

It may be a bit tricky to get all your Perl files to open with the ModernPerl syntax. Make sure you read the Install section for the steps that might be required. In any case check that your files are opened with ModernPerl once it is installed. This information is shown on the far right of the status bar.

ModernPerl uses only the standard highlighting colors, so it should be compatible with your favorite theme. It was, however, designed and tested with the default Monokai theme, so it's most optimal with that.

Features

Compared to the original Perl.tmLanguage:

  • Huge update to //, s{}{}. See messages/2014.01.05.pl for details
  • Highlights functions as best as it can, so less stuff is white
  • Many different kinds of barewords are recognized so that they're not highlighted as functions
  • New Perl keywords such as say and state are recognized
  • Angle bracket readline/globs are recognized (<foo/* bar/*>)

As well as many other highlighting fixes and nuances.

Install

  1. Install this package with Package Control (or otherwise).
  2. In Sublime, use View > Syntax > Open all with current extension as… to reopen all current Perl files with ModernPerl.
  3. Fresh Perl files should automatically open with ModernPerl, while Perl files that have previously been opened with Sublime will tend to keep the syntax they were last opened with.

    To check this, open a Perl file that has never been opened with Sublime before (create a new .pl file if necessary), and check that it opens with ModernPerl.

  4. If fresh files do not open with ModernPerl, use Preferences > Settings – Syntax Specific – User on a file opened with ModernPerl to open up ModernPerl.sublime-settings and put the following into it:

    { "extensions": ["pl", "PL", "pm", "pod", "t"] }

  5. Whenever you open a Perl file that has previously been opened with Sublime, check which syntax it opens with, and manually switch it to ModernPerl if necessary.

Todo

  • Recognize interpolated characters in double quoted strings
  • Recognize metacharacters in regexes
  • Split up interpolation in repository more for better interpolation of tr, format, etc.
  • Support for multiple heredocs on one line
  • Further optimization and polish

Issues

If you find any bugs or want to suggest any improvements feel free to open an issue or send a pull request. You can also email me at blaizer@cpan.org. Before doing any of this, let me just repeat that you should check that your files are opened with ModernPerl.

License

© 2013-2014 Blaise Roth blaizer@cpan.org.

This is free software. It is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. Feel free to use this package in your own work. However, if you modify and/or redistribute it, please attribute me in some way, and distribute your work under this or a similar license.