Sublime Text 2 : the « killer » source editor !

It's like TextMate on OS-X and bring a lots of fantastic feature like a "distraction free" mode, displaying your current text in a fullscreen format without anything else like menubar or status bar. Only a big black screen with synthax highlighted text.

Ok, for coder it's not heaven, but with all the snippets, plugins, console, templates, and more (Column edtion mode, etc…)

Sublime Text in its second edition is not only a good editor but also a beautiful one: see screen captures bellow on Linux (Ubuntu 11.10):

figure 1 : The text editor with all features activated:
 project explorer, console, and mini-map mode.


figure 2 : Here is the Famous Distraction Free Mode
for Hardcore developers 🙂

This Very good "professional" text editor is quiet stable, during all my edition sessions: no bug, no crash!  

Very good work, guy's !

I also like the easy way to create plugin (complexe one can be implemented because of the Python embbeded engine !). 

Create a plugin from scratch

You just have to create a new Directory in the "~/.config/sublime-text-2/Packages/" nammed with your new extension name to create.
The create a new *.py file script with the name to be used in the configuration file (see later). For exemple "open_google". just copy and paste the following peace of code bellow :

import sublime, sublime_plugin, webbrowser

# Open the default browser to seach for the selected text in Google 
# (or any other search engine, through Default.sublie-keymap parameters)
# sample:
# { "keys": ["ctrl+alt+g"] , 
#   "command": "open_browser" , 
# where *search* is the selected string to serach for.
class OpenBrowserCommand(sublime_plugin.TextCommand):

def run(self, edit, url):
selection = ""
for region in self.view.sel():
selection += self.view.substr(region)

, and update the  keybinding user (CTRL+P and select "Default (Windows).sublime-keymap" file

and paste the following lines:

        "keys": ["ctrl+alt+g"] , 
            "command": "open_browser" , 

Save the files and try to select some text in any sublime editor window, and then press a magic [CTRL]+[ALT]+[G]…

Your default Web browser would open a new tab and display result of the google search with the selected text.

Have fun !

Les commentaires sont fermés.

Propulsé par

Retour en haut ↑

%d blogueurs aiment cette page :