An open API service indexing awesome lists of open source software.

https://github.com/p-org/sublime-p

Sublime plugin for P
https://github.com/p-org/sublime-p

Last synced: 6 months ago
JSON representation

Sublime plugin for P

Awesome Lists containing this project

README

          

# Sublime-P
P language plugin for Sublime Text 3. Includes basic syntax highlighting, comments format and some snippets.

# Screenshot
![Screenshot](/example.png?raw=true)

# Install

Use the Command Palette to `Add Repository` and add this GitHub repository.
Then use the Command Palette to `Install Package` and search for and install `Sublime-P`.

# Conventions
The syntax highlighting assumes the following conventions, but you don't have to follow them.
* Type names end with `Type`. E.g. `StartMessageType`.
* Fields end with `V`. E.g. `TimerV`.
* Events start with `e`. E.g. `eStop`, `eStart`.
* Machine names end with `Machine`. E.g. `ElevatorMachine`.
* State names have no conventions and so have no color.

These conventions are followed by the snippets, so you don't have to remember them.

# Snippets
Snippets include: `event`, `implementation`, `machine`, `module`, `test`, `type`, `var` (for fields), `whileindex`.
To use a snippet, start typing one of these words and press tab. Then continue typing to replace the placeholder names and press tab further times to jump to the next placeholder or cursor position.

E.g. Start typing `while`. The `whileindex` completion pops up. Press tab to get:
```
index = 0;
while(index < sizeof(Array))
{

index = index + 1;
}
```
Typing will replace all instances of `index`. Pressing tab jumps to `Array` which is the next placeholder. Pressing tab again places the cursor after the first curly brace.

# Making changes to `p.tmLanguage`
The `p.tmLanguage` file defines the syntax highlighting. It is a generated file, but is committed for convenience.
To make changes, do the following:

1. Install [Package Control](https://packagecontrol.io/installation) in Sublime Text 3 and then use the Command Palette `Ctrl+Shift+P` to `Install Package` and search for and install `PackageDev`.
2. Open `p.YAML-tmLanguage`.
3. Make your changes.
4. Use the Command Palette to execute `Build With: Convert to ... - Property List`.