Sublime - change layout view in 2 columns
on 2014-02-27
Sublime - change layout view in 2 columns
Video
Setting
Preferences
-> Key Bindings - User
set key to use
[
{
"keys": ["super+ctrl+left"],
"command": "set_layout",
"args":
{
"cols": [0.0, 0.95, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
}
},
{
"keys": ["super+ctrl+right"],
"command": "set_layout",
"args":
{
"cols": [0.0, 0.05, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
}
}
]
Update
Add focus
If add focus, it need 2 commands so need write a python plugin
Tools
->New Plugin
# save as run_multiple.py
import sublime, sublime_plugin
# Takes an array of commands (same as those you'd provide to a key binding) with
# an optional context (defaults to view commands) & runs each command in order.
# Valid contexts are 'text', 'window', and 'app' for running a TextCommand,
# WindowCommands, or ApplicationCommand respectively.
class RunMultipleCommand(sublime_plugin.TextCommand):
def exec_command(self, command):
if not 'command' in command:
raise Exception('No command name provided.')
args = None
if 'args' in command:
args = command['args']
# default context is the view since it's easiest to get the other contexts
# from the view
context = self.view
if 'context' in command:
context_name = command['context']
if context_name == 'window':
context = context.window()
elif context_name == 'app':
context = sublime
elif context_name == 'text':
pass
else:
raise Exception('Invalid command context "'+context_name+'".')
# skip args if not needed
if args is None:
context.run_command(command['command'])
else:
context.run_command(command['command'], args)
def run(self, edit, commands = None):
if commands is None:
return # not an error
for command in commands:
self.exec_command(command)
Preferences
->Key Bindings - User
[
{
"keys": ["super+ctrl+left"],
"command": "run_multiple",
"args":
{
"commands": [
{
"command": "set_layout",
"args":
{
"cols": [0.0, 0.95, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
},
"context": "window"
},
{
"command": "focus_group",
"args": { "group": 0 },
"context": "window"
}
]
}
},
{
"keys": ["super+ctrl+right"],
"command": "run_multiple",
"args":
{
"commands": [
{
"command": "set_layout",
"args":
{
"cols": [0.0, 0.05, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
},
"context": "window"
},
{
"command": "focus_group",
"args": { "group": 1 },
"context": "window"
}
]
}
}
]
Refer - how to create a custom layout in sublime text 2? Refer - Custom layouts, Sublime text 2 Refer - set_layout reference Update Refer - Is it possible to chain key binding commands in sublime text 2? Refer - nilium / key-bindings.json
Sublime Text - Plug-In
on 2013-09-02
Plug-In
Install by Package Control
Fisrt use sublime need install Package Control Ctrl + ~ show command line enter
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
restart sublime finish
ZenCoding
jsFormat
讓 js 整齊 ctrl + alt + f GitHub
SublimeTmpl
載入預設的樣板
Emmet
快速輸入
Gist
BracketHighlighter
Themes
- Dayle Rees Color Schemes
- Farzher
- Fox
sublime-jslint
{
// Path to the jslint jar.
// Leave blank to use bundled jar.
"jslint_jar": "",
// Options pass to jslint.
"jslint_options": "--continue --nomen --regexp --sloppy",
// Ignore errors, regex.
"ignore_errors":
[
// "Expected an identifier and instead saw 'undefined' \(a reserved word\)"
],
// run jslint on save.
"run_on_save": true,
// debug flag.
"debug": false
}
javascript and jQuery API Completions
Better Completion
PHPLntel
SublimeLinter
"sublimelinter_popup_errors_on_save": true
"sublimelinter_mark_style": "fill"
"sublimelinter_gutter_marks": true
ColorPicker
調色盤 GitHub
SCSS
SFTP
利用 SFTP 連 server Sublime SFTP
DocBlockr
加強添加注釋
/** 按 tab
GitHub
ASCII-Decorator
利用 ASCII 文字當注釋 選擇要轉的文字後, 選選單的 Edit -> ASCII-Decorator, 就會轉換了 GitHub
Bootstrap 3 Snippets
Marking Changed Rows
ColorHighlighter
顯示 HEX 顏色 GitHub
AlignTab
對齊 :, =, … GitHub
Find Function Definition
找到 function 定義的位置 Find Function Definition
sublimetext-markdown-preview
Preview Markdown 文件 sublimetext-markdown-preview
sublimeBookmark
可以 mark line, 方便臨時標記找 code sublimeBookmark
CSS format
Sublime text 3
JSLint
JSHint
sublimeLinter
SublimeLinter-annotations
highlight TODO, README and FIXME SublimeLinter-annotations