All Projects → MattDMo → Pythonimproved

MattDMo / Pythonimproved

Licence: mit
The best Python language definition for Sublime Text - ever. Includes full support for Unicode, as well as both Python 2 and Python 3 syntax. Check out the Neon Color Scheme for highlighting.

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects
python2
120 projects

Projects that are alternatives of or similar to Pythonimproved

network tech
Cisco config syntax and snippets for Sublime Text
Stars: ✭ 82 (-13.68%)
Mutual labels:  syntax-highlighting, sublime-text, sublime-text-3
Css3
The most complete CSS support for Sublime Text
Stars: ✭ 178 (+87.37%)
Mutual labels:  sublime-text, sublime-text-3, syntax-highlighting
Nord Sublime Text
An arctic, north-bluish clean and elegant Sublime Text theme.
Stars: ✭ 109 (+14.74%)
Mutual labels:  sublime-text, sublime-text-3, syntax-highlighting
Nineties
💾 Colors for World Wide Web pioneers
Stars: ✭ 16 (-83.16%)
Mutual labels:  syntax-highlighting, sublime-text, sublime-text-3
Coffeescript Sublime Plugin
Syntax highlighting and checking, commands, shortcuts, snippets, compilation and more.
Stars: ✭ 296 (+211.58%)
Mutual labels:  sublime-text, sublime-text-3
Handlebars
Fullest Handlebars.js templating support for Atom and Sublime Text 2 / 3. Also drives syntax colouring on Github and in Visual Studio Code. Install from: https://atom.io/packages/Handlebars and https://packagecontrol.io/packages/Handlebars.
Stars: ✭ 292 (+207.37%)
Mutual labels:  sublime-text, syntax-highlighting
Chromerepl
A Sublime Text plugin to execute JavaScript in Google Chrome
Stars: ✭ 347 (+265.26%)
Mutual labels:  sublime-text, sublime-text-3
Sublime zk
A SublimeText3 package featuring ID based wiki style links, and #tags, intended for zettelkasten method users. Loaded with tons of features like inline image display, sophisticated tag search, note transclusion features, support for note templates, bibliography support, support for multiple panes, etc. to make working in your Zettelkasten a joy 😄.
Stars: ✭ 408 (+329.47%)
Mutual labels:  sublime-text, sublime-text-3
eRCaGuy dotfiles
.bashrc file, terminal prompt that shows current git branch, Arduino setup, Eclipse setup, git diff with line numbers, helpful scripts, improved Linux productivity, etc.
Stars: ✭ 84 (-11.58%)
Mutual labels:  sublime-text, sublime-text-3
Packagedev
Tools to ease the creation of snippets, syntax definitions, etc. for Sublime Text.
Stars: ✭ 378 (+297.89%)
Mutual labels:  sublime-text, syntax-highlighting
Sublime Monokai Extended
Extends Monokai from Soda with additional syntax highlighting for Markdown, LESS, HTML, Handlebars and more.
Stars: ✭ 505 (+431.58%)
Mutual labels:  sublime-text, syntax-highlighting
Kung-Fury-Theme
80's dark retro theme for VS Code and Sublime Text
Stars: ✭ 29 (-69.47%)
Mutual labels:  syntax-highlighting, sublime-text
GDL-sublime
📝 A Sublime Text package for the programming language GDL (Geometric Description Language)
Stars: ✭ 25 (-73.68%)
Mutual labels:  syntax-highlighting, sublime-text
Javascript Completions
JavaScript Completions for sublime text. It helps you to write your scripts more quickly with hints and completions.
Stars: ✭ 341 (+258.95%)
Mutual labels:  sublime-text, sublime-text-3
ST-ShellScriptImproved
❌ [Deprecated] A better ShellScript (Bash) syntax highlight for Sublime Text >= 3143
Stars: ✭ 25 (-73.68%)
Mutual labels:  syntax-highlighting, sublime-text
Ayu
🎨🖌 Modern Sublime Text theme
Stars: ✭ 3,933 (+4040%)
Mutual labels:  sublime-text, sublime-text-3
Sublimetext
Caddyfile syntax highlighting for Sublime Text 3
Stars: ✭ 17 (-82.11%)
Mutual labels:  sublime-text, syntax-highlighting
Sublime Markdown Extended
Top 100 Sublime Text plugin! Markdown syntax highlighter for Sublime Text, with extended support for GFM fenced code blocks, with language-specific syntax highlighting. YAML Front Matter. Works with ST2/ST3. Goes great with Assemble.
Stars: ✭ 645 (+578.95%)
Mutual labels:  sublime-text, syntax-highlighting
Sublimeallautocomplete
Extend Sublime autocompletion to find matches in all open files of the current window
Stars: ✭ 906 (+853.68%)
Mutual labels:  sublime-text, sublime-text-3
Consolewrap
This plugin helps you to work easily with log statements
Stars: ✭ 75 (-21.05%)
Mutual labels:  sublime-text, sublime-text-3

Package Control GitHub release Donate via PayPal

Python Improved

A better Python .tmLanguage syntax highlighting definition for Sublime Text and TextMate. It includes support for both Python 2 and Python 3, and unlike any other Python syntax definition now fully supports Unicode identifiers anywhere in your code! It also provides its own improved regex syntax definition for inline highlighting of raw string literals.

Inspired by:

  • the original TextMate and Sublime Text Python.tmLanguage files
  • facelessuser's Better Python
  • Peter Varo's Python 3 syntax definition

as well as a number of my own changes to make things more consistent and understandable. For customized syntax highlighting taking advantage of all the new scopes, use PythonImproved with the Neon Color Scheme, or modify your own favorite color scheme with the scopes below.

Installation and Use

If you haven't already, install Package Control, then select Python Improved from the Package Control: Install Package option in the Command Palette. To use PythonImproved as your default Python syntax, open a .py file, then select View -> Syntax -> Open all with current extension as... -> PythonImproved.

While I haven't yet tried to install PythonImproved with TextMate, I can't think of a good reason as to why it wouldn't work. You could try putting it in the same directory as the standard Python.tmbundle package, in the Syntaxes subdirectory. Then, just pick PythonImproved from the syntax menu.

New/Changed Scopes

If you prefer to modify your own color scheme, here is a list of new/modified scopes, along with some examples. It's not perfectly complete, but it's a start.

  • support.ipython.in and support.ipython.out: IPython In [1]:/Out [1]: fields — designed for use with SublimeREPL. The cell number can be themed with a different color using support.ipython.cell-number.
  • constant.numeric.integer.(long).binary.python: binary literals 0b00101010, 0b00101010L
  • keyword.control.import.python now contains import, from, and as
  • support.type.exception.python now matches any identifier that ends with Exception or Error, not just the built-in ones like IndentationError or RuntimeException, allowing for the highlighting of custom exceptions such as those included in third-party modules.
  • Function annotation support for Python 3, thanks to @facelessuser. New scopes added: punctuation.separator.annotation.python, punctuation.separator.annotation.result.python, punctuation.definition.parameters-group.begin.python, and punctuation.definition.parameters-group.end.python.
  • You can now have comments in multi-line function definitions:
def myfunc(self,            # gotta have self
           param1="value",  # values are cool
           param2=True,     # or False, whatever
           *args,           # I'm here for an argument
           **kwargs):       # you never know

Multi-line comments and function annotations

  • New scopes for bytes, unicode, and raw/regex strings, thanks to @simonzack: string.quoted.(single|double).(block|single-line).(bytes|bytes-raw|bytes-raw-regex).python
  • Also from @simonzack, highlighting of self|cls in parameter strings: variable.parameter.function.(keyword|language)
  • comment.line.note.python is a comment line that contains (BUG|FIXME|TODO|XXX) at the beginning. comment.line.note.notation.python matches the actual word itself, so you can differentially highlight the word and the whole line:

BUG FIXME TODO XXX line highlighting

  • constant.other.allcaps.python captures variable names that are in all caps (OPENING_PORT, for example), assuming the convention that these are generally treated as constants in the code. Matches CONSTANT, class.CONSTANT and the CONSTANT part of CLASS.CONSTANT, but not CLASS.function(), class.FUNCTION(), or FUNCTION().
  • Fixed the octal integers so the Python 3-style 0o123 is matched as well as the old-style 0123
  • Built-in functions like any(), dict(), len(), raw_input(), etc. now have their arguments highlighted just like any other function. Many thanks to @facelessuser for the regex, and @FichteFoll for valuable discussion. For those working with Python 2, print is still a standalone keyword (as are assert and del).
  • support.function.magic and support.function.builtin have now been split in two — name and call, so that __init__ (support.function.magic.name.python), for example, can be themed differently than __init__() (support.function.magic.call.python).
  • Relatedly, magic function names (and calls), also known as the "dunder" methods for being surrounded by double underscores, have been collated from the 2.7 and 3.5 Data Model docs and cleaned up so that as much as possible is included there, but outdated or incorrect things are not. The same is true of the magic variables (support.variable.magic).
  • support.type now contains only what's defined in https://docs.python.org/X/library/functions.html and stdtypes.html (where X is 2 or 3) where the item is a class. They are highlighted as such only if not followed by an opening parenthesis — if it is, it's highlighted as support.function.builtin.call. This addresses #16.
  • Defined escaped characters (like \n, \', \\, etc.) are now individually named as constant.character.escape.*, where * is newline, single-quote, backslash, etc.
  • And probably some more stuff I forgot about...

Notes

  • To facilitate hacking, I'm also including my .YAML-tmLanguage file in the repo, which I use for my day-to-day work (I really hate debugging regexes embedded in XML). Install PackageDev for syntax highlighting, and tools for converting between YAML, JSON, and XML/Plist formats. Neon of course has great coloring for the .YAML-tmLanguage format, and especially the regexes :)
  • Speaking of which, for raw/regex strings, regexes will be scoped according to the accompanying Regular Expressions (Python Improved).tmLanguage file, instead of the builtin Python regular expressions definition. If you're using Neon for syntax highlighting (or any color scheme that highlights regexes), use a lowercase r to denote your string as containing a regex (i.e., r"\b(?i:(0[o]?[0-7]+))"). However, if you're just using a raw string literal to, for example, define a Windows path and you don't want regex highlighing for all the back slashes and whatnot, use an uppercase R (R"C:\Users\MattDMo"). Python can't tell the difference, but it will look nicer in your editor.
  • All Django-related stuff has been removed. If you want it back, just dig through the repo's history and you can find it. It was just too distracting.
  • I removed the SQL-related stuff from the string definitions, because 1) somebody complained, and 2) like Django, it was distracting. It didn't cover all of SQL, only highlighted some keywords, and just wasn't worth it.
  • Unicode escapes should now appear correctly in all strings, as with Python 3 all strings are Unicode. I think I got it right, if you think otherwise just let me know.
  • I've begun working on correctly highlighting all the various elements of the new-style string formatting mini-language, but I haven't applied it to the most recent release while I work out the kinks. Feel free to join the discussion.
  • Now that the ST3 public beta supports .sublime-syntax files, I'm going to begin transitioning PI over to that format. If you'd like to contribute, chime in on this issue. One major advantage will be fixing this bug with raw string literals.

Issues

If you have questions, concerns, or suggested improvements, I'd love to hear from you! Feel free to open an issue or send a pull request and I'll get back to you as soon as I can. You can also email me at [email protected] or find me on Twitter @MattDMo.

License

© 2013-2020 Matt Morrison [email protected].

This is free software. It is licensed under the MIT License. Feel free to use this 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. A shout-out or a beer would be appreciated.

Support

PayPal - The safer, easier way to pay online!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].