http://www.sublimetext.com/forum/viewtopic.php?f=2&t=10615
It's a work in progress, mainly geared around the things I use most often. Comments welcome.
Sublime Text 2 Tips
有用的链接
- http://www.sublimetext.com/dev
- http://docs.sublimetext.info/en/latest
- http://wesbos.com/sublime-text-code-folding
- http://benmccormick.org/blog/2013/01/01/sublime-text-for-javascript-configuration/
命令面板
- Ctrl+Shift+P (Tools > Command Palette...)
跳转
- 跳转到文件: Ctrl+P (Goto > Goto Anything...)
- 跳转到标记或函数: Ctrl+P, "@symbol" (Ctrl+R, Goto > Goto Symbol...)
- 跳转到行号: Ctrl+P, ":#" for line (Ctrl+G, Goto > Goto Line...) -
- 跳转到单词: Ctrl+P, "#word" (Ctrl+;)
编辑
- 在下面插入行: Ctrl+Enter
- 在上面插入行: Ctrl+Shift+Enter
- 重复上一个命令: Ctrl+Y (Edit > Repeat)
- Transpose: Ctrl+T (Edit > Text > Transpose)
- 行注释/取消注释: Ctrl+/ (Edit > Comment > Toggle Comment)
- 块注释/取消注释: Ctrl+Shift+/ (Edit > Comment > Toggle Block Comment)
- 缩进粘贴: Ctrl+Shift+V (Edit > Paste and Indent)
- 转为大写: Ctrl+K, Ctrl+U (Edit > Convert Case > Upper Case)
- 转为小写: Ctrl+K, Ctrl+L (Edit > Convert Case > Lower Case)
行操作
- 行缩进 Ctrl+] (Edit > Line > Indent)
- 取消缩进: Ctrl+[ (Edit > Line > Unindent)
- 当前行上移: Ctrl+Shift+Up (Edit > Line > Swap Line Up)
- 当前行下移: Ctrl+Shift+Down (Edit > Line > Swap Line Down)
- 复制当前行: Ctrl+Shift+D (Edit > Line > Duplicate Line)
- 合并行: Ctrl+J (Edit > Line > Join Lines)
删除
- Delete word forwards: Ctrl+Del
- Delete word backwards: Ctrl+Backspace
- Delete line: Ctrl+Shift+K (Edit > Line > Delete)
- Delete from cursor to end of line: Ctrl+K, Ctrl+K
- Delete from cursor to start of line: Ctrl+K, Ctrl+Backspace
选择 (选择操作可以连续重复多次)
- 选择行: Ctrl+L (Selection > Expand Selection to Line)
- 选择单词: Ctrl+D (Selection > Expand Selection to Word)
- 选择范围: Ctrl+Shift+Space (Selection > Expand Selection to Scope)
- 扩展为方括号内选择: Ctrl+Shift+M (Selection > Expand Selection to Brackets)
- Select indentation: Ctrl+Shift+J (Selection > Expand Selection to Indentation)
- Select tag: Ctrl+Shift+A (Selection > Expand Selection to Tag)
- Skip selection: Ctrl+K, Ctrl+D
- Scroll to selection: Ctrl+K, Ctrl+C (Goto > Scroll > Scroll to Selection)
导航
- Jump to closing parenthesis (repeat to go to opening): Ctrl+M (Goto > Jump to Matching Bracket)
- Jump to your last change (repeat to undo change): Ctrl+U (Edit > Undo Selection > Undo)
书签
- Toggle bookmark: Ctrl+F2 (Goto > Bookmarks > Toggle Bookmark)
- Next bookmark: F2 (Goto > Bookmarks > Next Bookmark)
- Previous bookmark: Shift+F2 (Goto > Bookmarks > Previous Bookmark)
- Select all bookmarks: Alt+F2 (Goto > Bookmarks > Select all Bookmarks)
查找替换
- Find: Ctrl+F (Find > Find...)
- Find Next: F3 (Find > Find Next)
- Find Previous: Shift+F3 (Find > Find Previous)
- Replace: Ctrl+H (Find > Replace...)
- Find in files (Navigate using F4, Shift+F4): Ctrl+Shift+F (Find > Find in Files...)
代码折叠
- Fold: Ctrl+Shift+[ (Edit > Code Folding > Fold)
- Unfold: Ctrl+Shift+] (Edit > Code Folding > Unfold)
- Unfold all: Ctrl+K,Ctrl+J (Edit > Code Folding > Unfold All)
- Fold attributes: Ctrl+K,Ctrl+T (Edit > Code Folding > Fold Tag Attributes)
宏
- Record: Ctrl+Q (Tools > Record Macro)
- Playback: Ctrl+Shift+Q (Tools > Playback Macro)
标签
- Previous tab: Ctrl+PgUp (Goto > Switch File > Previous File)
- Next tab: Ctrl+PgDown (Goto > Switch File > Next File)
- Switch to tab number: Alt+number (Goto > Switch File > ...)
分割布局
- 设为单窗口布局: Alt+Shift+1 (View > Layout > Single)
- 多列布局: Alt+Shift+2,3,4 (View > Layout > Columns)
- 多行布局: Alt+Shift+8,9 (View > Layout > Rows)
- 田字布局: Alt+Shift+5 (View > Layout > Grid)
- Move to group #: Ctrl+# (View > Focus Group)
- Move file to group #: Ctrl+Shift+# (View > Move file to Group)
组织
- 切换文件边栏: Ctrl+K, Ctrl+B (View > Side Bar > Hide Side Bar)
- 无干扰模式: Shift+F11 (View > Enter Distraction Free Mode)
- 激活拼写检查(Navigate using Ctrl+F6, Ctrl+Shift+F6): F6 (View > Spell Check)
多重编辑
- 列选模式:shift+鼠标右键拖拉,同时再按下alt键拖拉可以减去选择的字符
- 添加多个选择:按住ctrl键 点击多个位置
- Ctrl+Shift+L (Selection > Split into Lines)
- Highlight word, press Ctrl+D (Selection > Expand Selection to Word) repeatedly to select additional occurrences of that word.
- 所有相同的单词出现的地方添加光标 Alt+F3 (Find > Quick Find All)
- 多行列选择,使用键盘操作: Ctrl+Alt+Up, Ctrl+Alt+Down (Selection > Add Previous Line)
- Return to single selection: Esc (Selection > Single Selection)
标记
- Set mark: Ctrl+K, Ctrl+Space (Edit > Mark > Set Mark)
- Select to mark: Ctrl+K, Ctrl+A (Edit > Mark > Select to Mark)
- Delete to mark: Ctrl+K, Ctrl+W (Edit > Mark > Delete to Mark)
- Switch location with mark: Ctrl+K, Ctrl+X (Edit > Mark > Swap with Mark)
- Clear Mark: Ctrl+K Ctrl+G (Edit > Mark > Clear Mark)
项目
- Switch Project: Ctrl+Alt+P (Project > Switch Project in Window...)
- Select root folder: Project > Add Folder to Project...
- Save: Project > Save Project As... (.sublime-project file)
杂项
- Show scope in status bar: Ctrl+Alt+Shift+P
- Reindent Lines: Edit > Line > Reindent
- Close Tag: Alt+.
- Reopen Closed File: Ctrl+Shift+T (File > Open Recent... > Reopen Closed File)
- See Key Bindings: Preferences > Key Bindings – Default
TextMate 主题兼容
- http://textmatetheme.com/
- http://www.webgeekshub.com/webGeekDownloads/TextMate-Themes%20Bundle.zip
(extract zip to "%AppData%\Sublime Text 2\Packages")
推荐用户设置 (Preferences > Settings - User)
- CODE: SELECT ALL
-
{
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Zenburnesque.tmTheme",
"draw_minimap_border": false,
"font_face": "Consolas",
"font_options": ["directwrite"],
"font_size": 11,
"highlight_line": true,
"highlight_modified_tabs": true,
"hot_exit": false,
"ignored_packages": ["Vintage", "ZenCoding"],
"line_numbers": false,
"rulers": [80, 120],
"spell_check": true,
"theme": "Soda Dark.sublime-theme",
"trim_trailing_white_space_on_save": true,
"detect_indentation": false,
"tab_size": 4,
"translate_tabs_to_spaces": true,
"use_tab_stops": true
}
Packages
- Package Control: http://wbond.net/sublime_packages/packa ... stallation
Ctrl+Alt+P (Preferences > Package Control) - AdvancedNewFile: https://github.com/skuroda/Sublime-AdvancedNewFile
Ctrl+Alt+N [conflicts with "Sublime Files"] - Alignment: http://wbond.net/sublime_packages/alignment
Align selected lines: Ctrl+Alt+A - Automatic Backups: https://github.com/joelpt/sublimetext-automatic-backups
Preferences > Package Settings > Automatic Backups > Settings - User
- CODE: SELECT ALL
-
{
"backup_dir": "D:/Backups",
"backup_merge_command": "C:/Program Files (x86)/Beyond Compare 2/BC2.exe \"{oldfilepath}\" \"{curfilepath}\""
}
Backwards in history: Ctrl+Alt+[
Forwards in history: Ctrl+Alt+]
Merge from backup history: Ctrl+Alt+Shift+M - CTags: https://github.com/SublimeText/CTags (Find > CTags)
- DocBlockr: https://github.com/spadgos/sublime-jsdocs
- FileDiffs
- FindKeyConflicts: https://github.com/skuroda/FindKeyConflicts
Ctrl+Shift+P, FindKeyConflicts - Git: https://github.com/kemayo/sublime-text-2-git (Tools > Git)
- HexViewer: https://github.com/facelessuser/HexViewer
[Shortcuts conflict with "build"]
Toggle hex editor mode: Ctrl+Shift+B, Ctrl+Shift+H
Show hex inspector: Ctrl+Shift+B, Ctrl+Shift+I
Hex finder: Ctrl+Shift+B, Ctrl+Shift+F
Hex editor: Ctrl+Shift+B, Ctrl+Shift+E
Hex writer: Ctrl+Shift+B, Ctrl+Shift+X
Discard edits: Ctrl+Shift+B, Ctrl+Shift+U - Http Requester: https://github.com/braindamageinc/SublimeHttpRequester
- IndentGuides: https://github.com/SublimeText/IndentGuides
- Nettuts+ Fetch: http://net.tutsplus.com/articles/news/i ... uts-fetch/
- Origami (https://github.com/SublimeText/Origami)
Create an adjacent pane: Ctrl+K, Ctrl+Arrows (View > Origami > Pane > Create > ...)
Destroy an adjacent pane: Ctrl+K, Ctrl+Shift+Arrows (View > Origami > Pane > Destroy > ...)
Travel to adjacent pane: Ctrl+K, Arrows (View > Origami > Pane > Travel to > ...)
Carry the current file to destination: Ctrl+K, Shift+Arrows (View > Origami > File > Carry to > ...)
Clone the current file to destination: Ctrl+K, Alt+Arrows (View > Origami > File > Clone to > ...) - PlainTasks: https://github.com/aziz/PlainTasks
- Prefixr: https://github.com/wbond/sublime_prefixr
- SidebarEnhancements: https://github.com/titoBouzout/SideBarEnhancements
- Sublime Files: https://github.com/al63/SublimeFiles
Open file navigator: Ctrl+Alt+N [conflicts with "AdvancedNewFile"] - Super Calculator
Select text then press Alt+C - SublimeLinter: https://github.com/SublimeLinter/SublimeLinter
- SublimeXiki-master: https://github.com/lunixbochs/SublimeXiki
- SyncedSidebar
- Trailing Spaces
- Wrap Plus (https://github.com/ehuss/Sublime-Wrap-Plus)
Wrap selection: Alt+Q
Web Packages
- CSS-Snippets: https://github.com/joshnh/CSS-Snippets
- cssTidy: https://github.com/fitnr/SublimeCSSTidy
- Emmet: https://github.com/sergeche/emmet-sublime, http://docs.emmet.io/ (try "div>ul>li*3" <tab>)
- HTML5: https://github.com/mrmartineau/HTML5
- HtmlTidy: https://github.com/welovewordpress/SublimeHtmlTidy
- PyV8
- SublimeCodeIntel: https://github.com/Kronuz/SublimeCodeIntel
Jump to symbol definition: Ctrl+F3 - Sublime-HTMLPrettify: https://github.com/victorporof/Sublime-HTMLPrettify
Snippets
-
- Emmet Css Snippets
- HTML Snippet
另转:
http://www.veryued.org/2012/11/sublime%E5%B8%B8%E7%94%A8%E6%8F%92%E4%BB%B6%E6%94%B6%E9%9B%86%E8%B4%B4/
今天同事分享了一些sublime的插件,纪录在此。
Anypreter
可以临时执行选择的代码或整个文件,目前支持 PHP、Ruby 和 Python。
AdvancedNewFile
通过输入路径来创建文件,快捷键是 Command + Shift + N。
Alignment
可以根据 : 和 = 对齐,满足有代码洁癖同学的需求,快捷键是 Command + Control + A 。
AutoFileName
在代码里引用文件时,提供文件名的提示和补全。
Auto Semi-Colon
自动调整插入的分号位置。
All AutoComplete
让代码自动完成的匹配从所有打开的文件里去匹配,而不是只在当前文件里匹配。
BracketHighlighter
括号高亮。
BeautifyRuby
Ruby 语法支持。
Browser Refresh
按 Command + Shift + R,刷新打开的 Chrome 当前 Tab。
CoffeeScript
CoffeeScript 语法支持。
CTags
CTags 支持,提供语法导航功能。(目前还不支持 Coffee)
ChangeQuotes
切换单引号和多引号,很贴心的插件,快捷键是 Command + Shift + . 。
ColorPicker
颜色拾取器。
Close Oldest File
关闭最先打开的文件。
CoffeeScript Fundtion Finder
查看函数定义,不是太准确。
DocBlockr
提供 JSDoc 和 PHPDoc 的自动生成功能。
Edit History
可以用 Command + [,和 Command + ] 在历史编辑处来回切换。
Element Finder (待验证)
可以在项目中用 CSS 选择器查找 HTML。
http://keegan.st/2012/09/01/introducing-element-finder-for-sublime-text-2/
FavoriteFiles
提供文件收藏功能,可以保存一些常用的文件,方便快速打开编辑,快捷键是 Command + Shift + , 。
GBK ENcoding Support
支持 GBK 编码,有些小缺陷,比如会导致 Command + R 快速打开文件不能使用。
GenerateUUID
快速生成 UUID,快捷键是 Command + Shift + U。
Gist
用来创建和编辑 Gist。
GotoTab
可以让我们用 Command + 数字 打开执行顺序的 tab。
HTML5
Inc-Dec-Value
快速修改数字、布尔值等各种状态。
Jade
Jade 语法支持。
KeymapManager
Control + Alt + K,快速查看所有插件绑定的快捷键。
LESS
Less 语法支持。
LESS-build2
Less 的 build file。
Live CSS
CSS 颜色高亮。
Local History
本地编辑历史。
Markdown Preview
之前用的 MarkDown 插件,已经被下面的替代了。
MarkdownEditing
Markdown 的编辑和高亮。
Nettuts+ Fetch
可以快速获取预定义好的远程文件或远程 zip 包。
Origami —— 窗口管理工具
https://github.com/SublimeText/Origami
窗口管理,比如可以快速创建窗口,快速把一个文件复制、移动到另一窗口等。
PlistJsonConverter
用来做 PLIST 和 JSON 之间的格式转换。
Pretty JSON
JSON 美化,快捷键是 Command + Control + J 。
PlainTasks
任务管理。
Quick File Creator
快速创建文件和目录。
QuickFind
快速查找上一个,下一个选中的关键字。
Rails Related Files
Rake
RubyTest
RunExternal
执行 Bash 命令,并在当前窗口输出。
https://github.com/madeingnecca/sublime-run-external
SASS
SASS 语法支持。
SidebarEnhancements
侧边栏增强。
SideBarGit
侧边栏 Git 支持。
Simple Rails Navigator
Rails 导航。
SublimeLinter
实时 Lint,支持 JavaScript, Coffee,PHP, Ruby, Java 等各种语言。
SublimePeek
快速查看选中文字的帮助信息,支持 HTML, CSS, JavaScript, Ruby, Python, PHP, R 和 Stata,快捷键是 Command + Shift + H 。
SFTP
快速、智能地传文件到远程,可以用 ftp, ssh 等方式。
SVN
支持命令行和菜单两种接口。
ST2-Converter
提供一些便捷的转换函数,比如 Base64、MD5 等。
Theme – Soda
主题和配色。
Todo Manager
TODO 管理。
ToggleQuotes
同样是切换单双引号的,方式是选中要切换的代码,然后按单或双引号,并且会自动处理字符串里的引号转义。
WordCount
单词量实时计算,在状态栏显示。
ZenCoding
无需解释,快捷键是 Control + Alt + Enter 。