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

Pawn syntax

by Southclaws ST2/ST3

Pawn language settings for Sublime Text 3. Copied from C++ but with Pawn language and SA:MP specific modifications.

Details

Installs

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

Readme

Source
raw.​githubusercontent.​com

Pawn Tools for Sublime Text

Sublime Text is an extremely feature-rich and customisable plain-text editor. It's customisability is powered by Python scripting and there are a huge amount of extensions available. Sublime Text gives you an amazing toolset tailored to speeding up your writing workflow whether that is code, articles or just quick notes. (Example: I wrote this entire article in Sublime using an Evernote + Markdown extension)

Features

Here's a quick overview of my five favourite features.

Multiple Cursors

Multiple selection By far my favourite feature. Place as many carets as you want, select as much text as you want. Hold the CTRL button and tap the LMB to place a caret. Or click-drag MMB to select a 'rectangle' of text. CTRL+D will select the next instance of whatever text you have selected and ALT+F3 instantly selects every instance.

/readmes/img/e7e14d1a14fa34159d3500e31eb45e41fed98682.gif/readmes/img/23ec66c99b2df6757a9eecad2162229160d743e9.gif/readmes/img/4ba74ae7054259ecca7223b9db6ba7e7b58bbcdb.gif

Mini Map

A zoomed out version of your code that you can use to scroll around. Very handy for large files.

/readmes/img/ec4d6b6361c0cc209b239879b9894ef841e00dee.gif

Snippets

Snippets are templates of commonly used phrases that you can trigger by typing a certain set of characters. For instance, I can type ALS and all the code for an ALS hook will be inserted. Then I can tap TAB to cycle through each editable part of the template (prefix, function name and parameters)

/readmes/img/43ead0b948b73118f1b688e0a44ad08dd2b8007e.gif

Conversions

Convert to tabs, tab size, encoding and syntax buttons Okay, not exactly unique to Sublime but all handily placed at the bottom right. I code with tabs, but a lot of the time I need to push somewhere that only accepts spaces so conversion is useful.

/readmes/img/84253f49a0f86374dd9692d55051bf2d6de0ccac.gif

Configuration

Everything is JSON, Python or XML. Settings and key bindings are all stored in JSON format files and can be overwritten with user specific sets of settings. As soon as a change is made, Sublime reloads the settings and updates before your eyes! Extension scripts are written in Python and can expand the editor a lot.

Installation

Download and install Sublime Text for your operating system on the official site.

The software is available for free evaluation without any restrictions or hindrance aside from a small message box that pops up when saving sometimes. I encourage you support the development of this software if possible though!

Pawn Language Plugin

I created a Pawn language pack for sublime text which includes a ton of useful stuff such as a build configuration, syntax highlighting (modified C syntax) and snippets for common Pawn/SA:MP boilerplate code.

Install

You can quickly install this if you have Package Control installed. Simply open the Command Palette with CTRL+Shift+P, type Package Control: Install Package:

/readmes/img/489f8661911a15707e911d60c4fb89e72479e048.png

Once the list has loaded, search for the Pawn Syntax package and hit enter:

/readmes/img/1613ae8e98b754f006c2ee14e7f2a9196ea8c4d3.png

Now the package is installed, you need to generate a build configuration so that Sublime Text can talk to pawncc - the Pawn compiler. If you came from Pawno, the compiler is located in the Pawno directory and it's named pawncc.exe.

You can also install manually by getting the source from GitHub and dropping files from the repo into the Data\Packages\Pawn-Syntax\ directory which is located either in your Documents, AppData or Program Files directory for Sublime Text.

Setup

For sampctl

If you use sampctl you don't need to do any of this, just sampctl package init and select Sublime Text as your preferred editor, a build configuration will be automatically generated for you.

For pawncc

If you came from Pawno, follow these instructions to get set up.

To set up the Pawn compiler, open Preferences > Package Settings > Pawn Compiler Settings > Build Settings

Type the path to your Pawn compiler in the input panel that pops up, example: C:\SA-MP\Server\pawno\

The file will be automatically named and prompt to be saved, save it in Data\Packages\User (the save window may automatically open here anyway).

/readmes/img/f53f25d41951e702fb692869500e5a7a9a8827ee.gif

The file that's generated is a .sublime-build file and I'll go through each line explaining what it means here.

  • cmd: is the command to pass. You can include compiler flags such as -d3 and -Z+ in their own argument strings after this.
  • fileregex: is a regex used to parse error/warning output. This allows you to double-click errors/warnings to jump directly to the file and line.
  • workingdir: is the path to the directory where pawncc.exe is stored. This is the string that's set by your input.

Auto-Completion

The Pawn Syntax package includes auto-complete files for all SA:MP natives as well as a lot of popular libraries.

Head over to this thread to read more about auto-complete and contribute.

/readmes/img/b781c278681e7d856169b519f36ce1b5ee25e791.gif

Mapping Keys

Key bindings are stored in JSON format inside .sublime-keymap files. There are default key bindings, user key bindings and package specific key binds which conveniently overwrite each other in that reverse order.

In the Pawn Syntax package, I've included a small set of key bindings some of which emulate Pawno and others I just find useful:

  • f3: Find next
  • f4: Find previous
  • ctrl+r: Open the output panel (where warnings and errors appear)
  • f5: Compile the current file
  • pause: Cancels compilation (very useful if you realise you forgot something just after compiling!)

Contributors

See this page for a list of contributors to this project.