Eric Guo's blog.cloud-mes.com

in HTML5, JavaScript, Ruby & Rails, Python, and Cloud MES!

Starting-to-use-a-modern-python-scripted-editor-sublime-text-2

Permalink

I used the Vim and UltraEdit quite a long time, but I’m always dissatisfy with the vim so unique key movement and larger and larger size of UltraEdit, recently I decided to switch to the Sublime, Sublime can be programmed with my most prefer language Python. Sublime also provide a same experience on Windows/OSX/Linux but only need to pay 1 license. So learning Sublime from the scratch is for a long time profitable and save money. After install the Sublime, I found the Sublime Package Control is also helpful, which can install the sublime plug-in from web directly; you can install the Alignment as a try after install package control and there are hundreds of packages already available. Currently I’m using below User Settings (with Global Settings Vintage Mode enable):

Preferences.sublime-settings
// Eric Guo's User Preferences Settings
{
"close_windows_when_empty": true,
"trim_trailing_white_space_on_save": true,
"vintage_start_in_command_mode": true
}
Distraction Free.sublime-settings
// Eric Guo's Sublime 2 User Distraction Free Settings
{
"rulers":[],
"word_wrap": false
}
Default (Windows).sublime-keymap
// Eric Guo's Sublime 2 User Key Bindings
[
{ "keys": ["ctrl+0"], "command": "reset_font_size" },
{ "keys": ["alt+/"], "command": "auto_complete" },
{ "keys": ["alt+/"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
]
},
{ "keys": ["alt+shift+e"], "command": "open_folder_in_explorer" }
]

which the open_folder_in_explorer is a plugin on %APPDATA%\Roaming\Sublime Text 2\Packages\User:

OpenFolderInExplorer.py
import sublime, sublime_plugin, os, subprocess
class OpenFolderInExplorerCommand(sublime_plugin.TextCommand):
def run(self, edit):
if self.view.file_name():
folder_name, file_name = os.path.split(self.view.file_name())
command = "explorer " + folder_name
subprocess.Popen(command)

Comments