Sublime Text 2 : the "killer" source editor !

Walking the web, i’ve found the ultimate text editor.

A multi-platform 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 synthaxe 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):

Capture_du_2012-04-20_011516
figure 1 : The text editor with all features activated:
 project explorer, console, and mini-map mode.
Capture_du_2012-04-20_012004
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/" named 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" , #   "args": {"url" : "http://www.google.fr/#hl=fr&output=search&sclient=psy-ab&q={search}&oq={search}"}## 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)                webbrowser.open_new_tab(url.format(search=selection))

, 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" ,              "args": {"url" : "http://www.google.fr/#hl=fr&output=search&sclient=psy-ab&q={search}&oq={search}"}      }]

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 !

 

Publicités

2 commentaires sur “Sublime Text 2 : the "killer" source editor !

  1. Hi there!I was trying to use/adapt your code in order to looking up on several websites such WordReference and others. If the selected text doesn’t have accents or that sort of characters the code runs out of the box, but if selected text has accents simply doesn’t work for me.I’m not a programmer but I tried to encode the string with several alternatives such as: u"", encode(string), string.encode("utf-8")… declaring de ecoding at the beginning of the script… without success. :(Can you help me? It would be very kind of you…Thanks a lot.

Les commentaires sont fermés.

Créez un site Web ou un blog gratuitement sur WordPress.com.

Retour en haut ↑

%d blogueurs aiment cette page :