[Tutorial] PAWN Compiler in SublimeText 2
#1

Hi friends,

SublimeText 2 is a powerful text editor, like notepad++ for example, but better, i think.
It's possible to create some plugins with python language.
So, i've created a small script for compile a PAWN script with sublimetext.

How to proceed ?

Step 1 : On the menu >> Tools -> New Plugin...
Step 2 : In the new window, you need to put the script :

PHP код:
import sublimesublime_plugin
import os
class PawnoCommand(sublime_plugin.TextCommand):
    
def run(selfedit):
        
self.view.window().run_command('pawno_compile')
class 
PawnoCompileCommand(sublime_plugin.WindowCommand):
    
def run(self):
        
filePath self.window.active_view().file_name()
        
dirName os.path.dirname(filePath);
        
os.system("C:\path\to\pawncc.exe \""+filePath+"\" -D\""+dirName+"\" & pause"); 
Gist : link

You need to replace "C:\path\to\pawncc.exe" by your pawncc.exe path.

Step 3 : Now we need to create the shortcut for execute the compilation.
So : Preferences -> Key Bindings - User and add this line :
Код:
{ "keys": ["ctrl+shift+p"], "command": "pawno" }
Step 4 : Save all!

Now when you want to compile your script, you have just to press ctrl+shift+p

I hope this tutorial can help somebody.

PS : I'm sorry for my english, i'm french so if you see many mistakes i'm sorry. You can correct me, for make my english better!
Reply
#2

Nice tip!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)