Guest User

sublime

a guest
Feb 3rd, 2013
939
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 17.24 KB | None | 0 0
  1. # Sublime Text Cheat Sheet
  2.  
  3. ##### *Jeff Miller, 22 January 2013*
  4.  
  5. ### Useful URLs
  6. * [Latest developer builds](http://www.sublimetext.com/dev)
  7. * [Official documentation](http://www.sublimetext.com/docs/2/)
  8. * [Unofficial documentation](http://docs.sublimetext.info/en/latest/)
  9. * [Code Folding tutorial](http://wesbos.com/sublime-text-code-folding)
  10. * [Package Control packages](http://wbond.net/sublime_packages/community)
  11. * [Default Color Schemes](http://d.hatena.ne.jp/pmekyky385/20121207/1354982155)
  12.  
  13. ### Command Palette
  14. * Open Palette: Ctrl+Shift+P (Tools > Command Palette...)
  15.  
  16. ### Goto Anything
  17. * Go to file: Ctrl+P (Goto > Goto Anything...)
  18. * Go to symbol: Ctrl+P, "@symbol" (Ctrl+R, Goto > Goto Symbol...)
  19. * Go to line number: Ctrl+P, ":#" for line (Ctrl+G, Goto > Goto Line...)
  20. * Go to word: Ctrl+P, "#word" (Ctrl+;)
  21.  
  22. ### Editing
  23. * Insert line after: Ctrl+Enter
  24. * Insert line before: Ctrl+Shift+Enter
  25. * Repeat last keyboard command: Ctrl+Y (Edit > Repeat)
  26. * Transpose: Ctrl+T (Edit > Text > Transpose)
  27. * (Un)Comment current line: Ctrl+/ (Edit > Comment > Toggle Comment)
  28. * Block (un)comment current selection Ctrl+Shift+/ (Edit > Comment > Toggle Block Comment)
  29. * Paste and indent correctly: Ctrl+Shift+V (Edit > Paste and Indent)
  30. * Uppercase: Ctrl+K, Ctrl+U (Edit > Convert Case > Upper Case)
  31. * Lowercase: Ctrl+K, Ctrl+L (Edit > Convert Case > Lower Case)
  32.  
  33. ### Line Operations
  34. * Indent current line(s): Ctrl+] (Edit > Line > Indent)
  35. * Unindent current line(s): Ctrl+[ (Edit > Line > Unindent)
  36. * Move line/selection up: Ctrl+Shift+Up (Edit > Line > Swap Line Up)
  37. * Move line/selection down: Ctrl+Shift+Down (Edit > Line > Swap Line Down)
  38. * Duplicate lines:  Ctrl+Shift+D (Edit > Line > Duplicate Line)
  39. * Join lines: Ctrl+J (Edit > Line > Join Lines)
  40.  
  41. ### Deleting
  42. * Delete word forwards: Ctrl+Del
  43. * Delete word backwards: Ctrl+Backspace
  44. * Delete line: Ctrl+Shift+K (Edit > Line > Delete)
  45. * Delete from cursor to end of line: Ctrl+K, Ctrl+K
  46. * Delete from cursor to start of line: Ctrl+K, Ctrl+Backspace
  47.  
  48. ### Selection (can Be Repeated Multiple Times)
  49. * Select line: Ctrl+L (Selection > Expand Selection to Line)
  50. * Select word: Ctrl+D (Selection > Expand Selection to Word); Skip selection: Ctrl+K, Ctrl+D; Undo last selection: Ctrl+U
  51. * Select scope: Ctrl+Shift+Space (Selection > Expand Selection to Scope)
  52. * Select brackets: Ctrl+Shift+M (Selection > Expand Selection to Brackets)
  53. * Select indentation: Ctrl+Shift+J (Selection > Expand Selection to Indentation)
  54. * Select tag: Ctrl+Shift+A (Selection > Expand Selection to Tag)
  55. * Scroll to selection: Ctrl+K, Ctrl+C (Goto > Scroll > Scroll to Selection)
  56.  
  57. ### Navigation
  58. * Jump to matching bracket: Ctrl+M (Goto > Jump to Matching Bracket)
  59. * Jump to your last change (repeat to undo change): Ctrl+U (Edit > Undo Selection > Undo)
  60.  
  61. ### Bookmarks
  62. * Toggle bookmark: Ctrl+F2 (Goto > Bookmarks > Toggle Bookmark)
  63. * Next bookmark: F2 (Goto > Bookmarks > Next Bookmark)
  64. * Previous bookmark: Shift+F2 (Goto > Bookmarks > Previous Bookmark)
  65. * Select all bookmarks: Alt+F2 (Goto > Bookmarks > Select all Bookmarks)
  66.  
  67. ### Find/replace
  68. * Find: Ctrl+F (Find > Find...)
  69. * Find Next: F3 (Find > Find Next)
  70. * Find Previous: Shift+F3 (Find > Find Previous)
  71. * Replace: Ctrl+H (Find > Replace...)
  72. * Find in files (Navigate using F4, Shift+F4): Ctrl+Shift+F (Find > Find in Files...)
  73.  
  74. ### Code Folding:
  75. * Fold: Ctrl+Shift+[ (Edit > Code Folding > Fold)
  76. * Unfold: Ctrl+Shift+] (Edit > Code Folding > Unfold)
  77. * Unfold all: Ctrl+K,Ctrl+J (Edit > Code Folding > Unfold All)
  78. * Fold attributes: Ctrl+K,Ctrl+T (Edit > Code Folding > Fold Tag Attributes)
  79.  
  80. ### Macros
  81. * Record: Ctrl+Q (Tools > Record Macro)
  82. * Playback: Ctrl+Shift+Q (Tools > Playback Macro)
  83.  
  84. ### Tabs
  85. * Previous tab: Ctrl+PgUp (Goto > Switch File > Previous File)
  86. * Next tab: Ctrl+PgDown (Goto > Switch File > Next File)
  87. * Switch to tab number: Alt+number (Goto > Switch File > ...)
  88.  
  89. ### Split Layout
  90. * Set single layout: Alt+Shift+1 (View > Layout > Single)
  91. * Set # columns: Alt+Shift+2,3,4 (View > Layout > Columns)
  92. * Set 2 or 3 rows: Alt+Shift+8,9 (View > Layout > Rows)
  93. * Set 2x2 grid: Alt+Shift+5 (View > Layout > Grid)
  94. * Move to group #: Ctrl+# (View > Focus Group)
  95. * Move file to group #: Ctrl+Shift+# (View > Move file to Group)
  96.  
  97. ### Organization
  98. * Toggle side bar: Ctrl+K, Ctrl+B (View > Side Bar > Hide Side Bar)
  99. * Distraction free: Shift+F11 (View > Enter Distraction Free Mode)
  100. * Enable spell-check (Navigate using Ctrl+F6, Ctrl+Shift+F6): F6 (View > Spell Check)
  101.  
  102. ### Multiple Cursors
  103. * Press Ctrl then click in each region
  104. * Ctrl+Shift+L (Selection > Split into Lines)
  105. * Highlight word, press Ctrl+D (Selection > Expand Selection to Word) repeatedly to select additional occurrences of that word.
  106. * Add cursor at all occurrences of a word with Alt+F3 (Find > Quick Find All)
  107. * Add new line with cursor: Ctrl+Alt+Up, Ctrl+Alt+Down (Selection > Add Previous Line)
  108. * Return to single selection: Esc (Selection > Single Selection)
  109. * You can select a rectangular selection by using Shift, then holding the right mouse button and dragging over the area you wish to select. You can remove part of the selection using Shift+Alt.
  110.  
  111. ### Marking
  112. * Set mark: Ctrl+K, Ctrl+Space (Edit > Mark > Set Mark)
  113. * Select to mark: Ctrl+K, Ctrl+A (Edit > Mark > Select to Mark)
  114. * Delete to mark: Ctrl+K, Ctrl+W (Edit > Mark > Delete to Mark)
  115. * Switch location with mark: Ctrl+K, Ctrl+X (Edit > Mark > Swap with Mark)
  116. * Clear Mark: Ctrl+K Ctrl+G (Edit > Mark > Clear Mark)
  117.  
  118. ### Projects
  119. * Switch Project: Ctrl+Alt+P (Project > Switch Project in Window...)
  120. * Select root folder: Project > Add Folder to Project...
  121. * Save: Project > Save Project As... (.sublime-project file)
  122.  
  123. ### Miscellaneous
  124. * Show scope in status bar: Ctrl+Alt+Shift+P
  125. * Re-indent Lines: Edit > Line > Reindent
  126. * Close Tag: Alt+.
  127. * Reopen Closed File: Ctrl+Shift+T (File > Open Recent... > Reopen Closed File)
  128. * See Key Bindings:  Preferences > Key Bindings - Default
  129. * TextMate Theme Compatible: [Themes Bundle](http://www.webgeekshub.com/webGeekDownloads/TextMate-Themes%20Bundle.zip) (extract to "%AppData%\Sublime Text 2\Packages")
  130. * A list of all installed packages is in "%AppData%\Sublime Text 2\Packages\User\Package Control.sublime-settings" (see "installed_packages")
  131.  
  132. ### Command Line Script
  133.  
  134. Save as "subl.cmd" in your path, and run it.  Supports wildcards.
  135.  
  136.     @ECHO OFF
  137.     REM 2012-12-30 Jeff Miller
  138.     SETLOCAL
  139.  
  140.     CALL :GetStPath
  141.     IF "%StPath%"=="" ( ECHO Can't find Sublime Text & GOTO :EOF )
  142.  
  143.    PATH %StPath%;%PATH%
  144.  
  145.    set LIST=
  146.    :NEXTARG
  147.    IF "%~1"=="" GOTO :START
  148.    FOR %%i IN (%1) DO CALL :ADDARG "%%~fi"
  149.    SHIFT
  150.    GOTO :NEXTARG
  151.    :ADDARG
  152.    SET LIST=%LIST% %1
  153.    GOTO :EOF
  154.  
  155.    :START
  156.    START "Sublime Text" sublime_text.exe --add %LIST%
  157.    GOTO :EOF
  158.  
  159.    :GetStPath
  160.    SETLOCAL
  161.    FOR /F "skip=2 delims=" %%f IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sublime Text 2_is1" /v InstallLocation') DO SET P=%%f
  162.    ENDLOCAL & SET StPath=%p:~33%
  163.    GOTO :EOF
  164.  
  165.  
  166. ### My User Settings
  167. Install “Theme - Nexus” and [“DejaVu” fonts](http://dejavu-fonts.org/wiki/Download)
  168.  
  169. **Preferences > Settings - User :**
  170.  
  171.    {
  172.        "bold_folder_labels": true,
  173.        "caret_style": "phase",
  174.        "color_scheme": "Packages/Theme - Nexus/Nexus.tmTheme",
  175.        "detect_indentation": false,
  176.        "draw_minimap_border": false,
  177.        "ensure_newline_at_eof_on_save": true,
  178.        "fade_fold_buttons": false,
  179.        "font_face": "DejaVu Sans Mono",
  180.        "font_options": [
  181.            "directwrite"
  182.        ],
  183.        "font_size": 10,
  184.        "highlight_line": true,
  185.        "highlight_modified_tabs": true,
  186.        "hot_exit": false,
  187.        "ignored_packages": [
  188.            "Vintage",
  189.            "ZenCoding"
  190.        ],
  191.        "line_numbers": false,
  192.        "line_padding_bottom": 1,
  193.        "line_padding_top": 1,
  194.        "rulers": [
  195.            80,
  196.            120
  197.        ],
  198.        "spell_check": true,
  199.        "tab_size": 4,
  200.        "theme": "Nexus.sublime-theme",
  201.        "translate_tabs_to_spaces": true,
  202.        "trim_trailing_white_space_on_save": true,
  203.        "use_tab_stops": true
  204.    }
  205.  
  206. ## PACKAGES I USE
  207.  
  208. ### [AdvancedNewFile](https://github.com/skuroda/Sublime-AdvancedNewFile)
  209. *File Creation Plugin.*
  210.  
  211. * Ctrl+Alt+N [conflicts with "Sublime Files"]
  212.  
  213. **Preferences > Package Settings > AdvancedNewFile > Settings - User :**
  214.  
  215.    {
  216.        "alias": {
  217.            "desktop": "C:/Users/jeff/Desktop/",
  218.            "temp": "C:/Users/jeff/AppData/Local/Temp"
  219.        }
  220.    }
  221.  
  222. ### [Automatic Backups](https://github.com/joelpt/sublimetext-automatic-backups)
  223. *Automatically Save Off A Backup Of Your Files Each Time You Save A File.*
  224.  
  225. * Backwards in history: Ctrl+Alt+[
  226. * Forwards in history: Ctrl+Alt+]
  227. * Merge from backup history: Ctrl+Alt+Shift+M
  228.  
  229. **Preferences > Package Settings > Automatic Backups > Settings - User :**
  230.  
  231.    {
  232.        "backup_dir": "D:/Backups",
  233.        "backup_merge_command": "C:/Program Files (x86)/Beyond Compare 2/BC2.exe \"{oldfilepath}\" \"{curfilepath}\""
  234.    }
  235.  
  236. ### [BracketHighlighter](https://github.com/facelessuser/BracketHighlighter)
  237. *Bracket And Tag Highlighter.*
  238.  
  239. **Preferences > Package Settings > Bracket Highlighter > Settings - User :**
  240.  
  241.    {
  242.        "angle_style": "outline",
  243.        "curly_style": "outline",
  244.        "quote_style": "outline",
  245.        "round_style": "outline",
  246.        "square_style": "outline",
  247.        "tag_style": "outline"
  248.    }
  249.  
  250. ### [BufferScroll](https://github.com/SublimeText/BufferScroll)
  251. *Remember, restore and sync scroll, bookmarks, marks, folds and cursors.*
  252.  
  253. ### [Clipboard History](https://github.com/kemayo/sublime-text-2-clipboard-history)
  254. *Keep a history of your clipboard items.*
  255.  
  256. * Show History: Ctrl+Alt+V
  257. * Paste Previous History Entry: Ctrl+Shift+V
  258. * Paste Newer History Entry: Ctrl+Shift+Alt+V
  259.  
  260. ### [CTags](https://github.com/SublimeText/CTags)
  261. *CTags Support.*
  262.  
  263. * Find > CTags
  264. * Rebuild Tags: Ctrl+T, Ctrl+R
  265. * Navigate to Definition: Ctrl+Shift+.
  266. * Jump Back: Ctrl+Shift+,
  267. * Show Tags: Alt+S
  268. * Show All Tags: Alt+Shift+S
  269.  
  270. ### [DocBlockr](https://github.com/spadgos/sublime-jsdocs)
  271. *Make Writing Documentation A Breeze. Supports Javascript, Php, Actionscript, Coffeescript, Java, Objective C, C And C++.*
  272.  
  273. * `/**`< Enter >
  274. * `/*` < Enter >
  275. * `/**`< Enter >`function foobar (baz, quux) { }` - where function (or variable definition) already exists. Shift-Enter will place the definition inline.
  276. * Decorate comment: `// foo!`< Ctrl+Enter >
  277.  
  278. ### [Emmet](https://github.com/sergeche/emmet-sublime)
  279. *Emmet (previously Called Zen Coding).*
  280.  
  281. * [Documentation](http://docs.emmet.io/)
  282. * `div#page.section`< Tab > becomes `<div id="page" class="section"></div>`
  283. * `div[title="Hello"]`< Tab > becomes `<div title="Hello"></div>`
  284. * `li.item$*3`< Tab > becomes `<li class="item#"></li>` (3 times)
  285. * `p>{Click }+a{here}+{ to continue}`< Tab > becomes `<p>Click <a href="">here</a> to continue</p>`
  286. * `div#page>(div#header>ul#nav>li*4>a{Item $})+(div#page>(h1>span)+p*2)+div#footer`< Tab >
  287.  
  288. ### [FileDiffs](https://github.com/spape/SublimeFileDiffs)
  289. *Shows Diffs Between The Current File, Or Selection(s) In The Current File, And Clipboard, Another File, Or Unsaved Changes.*
  290.  
  291. **Preferences > Package Settings > FileDiffs > Settings - Default :**
  292.  
  293. For [Beyond Compare 2](http://scootersoftware.com):
  294.  
  295.    {
  296.        "cmd": [
  297.            "C:/Program Files (x86)/Beyond Compare 2/BC2.exe",
  298.            "$file1",
  299.            "$file2"
  300.        ],
  301.        "open_in_sublime": false
  302.    }
  303.  
  304.  
  305. ### [FindKeyConflicts](https://github.com/skuroda/FindKeyConflicts)
  306. Assist In Finding Key Conflicts Between Various Plugins.
  307.  
  308. * Ctrl+Shift+P, FindKeyConflicts
  309.  
  310. ### [GenerateUUID](https://github.com/SublimeText/GenerateUUID)
  311. Generate Uuid.
  312.  
  313. * Generate UUID: Ctrl+Shift+U
  314.  
  315. ### [Git](https://github.com/kemayo/sublime-text-2-git)
  316. Git Integration.
  317.  
  318. * [Wiki](https://github.com/kemayo/sublime-text-2-git/wiki)
  319. * Install [Git](http://git-scm.com/download/win) using “Run Git from the Windows Command Prompt”
  320. * Tools > Git
  321.  
  322. ### [HexViewer](https://github.com/facelessuser/HexViewer)
  323. *Allows The Toggling Of A File Into A Hex Viewing Mode.*
  324.  
  325. * Tools > Packages > Hex Viewer
  326. * NOTE: Shortcuts conflict with "build"
  327. * Toggle hex editor mode: Ctrl+Shift+B, Ctrl+Shift+H
  328. * Show hex inspector: Ctrl+Shift+B, Ctrl+Shift+I
  329.  
  330. **Preferences > Package Settings > Hex Viewer > Settings - User :**
  331.  
  332.    {
  333.        "auto_open": true,
  334.        "auto_open_patterns": [
  335.            "*.bin",
  336.            "*.dll",
  337.            "*.ico",
  338.            "*.lib",
  339.            "*.pyc",
  340.            "*.exe",
  341.            "*.res"
  342.        ],
  343.        "bytes_per_line": 16,
  344.        "custom_font": "Consolas",
  345.        "custom_font_size": 12,
  346.        "group_bytes_by_bits": 8,
  347.        "inspector": false
  348.    }
  349.  
  350. ### [HighlightWords](https://github.com/seanliang/HighlightWords)
  351. *Highlight mutiple words in different colors.*
  352.  
  353. * Highlight Words: Ctrl+Alt+H (Edit > Highlight Words > Highlight Words)
  354. * Unhighlight Words: Ctrl+Alt+U (Edit > Highlight Words > Unhighlight Words)
  355.  
  356. ### [HTML5](https://github.com/mrmartineau/HTML5)
  357. *HTML5 bundle.*
  358.  
  359. ### [INI](https://github.com/clintberry/sublime-text-2-ini)
  360. *INI Syntax Highlighting.*
  361.  
  362. ### [Markdown Preview](https://github.com/revolunet/sublimetext-markdown-preview)
  363. *Preview Your Markdown Files Quickly In Your Web Browser.*
  364.  
  365. * Ctrl+Shift+P, Markdown Preview
  366.  
  367. ### [Open URL](https://github.com/noahcoad/open-url)
  368. *Open URLs, Files, Folders, Or Google Text Under The Cursor Or In Selected Text.*
  369.  
  370. * Open URL: Ctrl+U
  371.  
  372. ### [Package Control](http://wbond.net/sublime_packages/package_control/installation)
  373. *A Full-featured Package Manager That Helps Discovering, Installing, Updating And Removing Packages.*
  374.  
  375. Ctrl+` then paste:
  376.  
  377.    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'
  378.  
  379. * Ctrl+Shift+P, Install Package (Preferences > Package Control)
  380.  
  381. ### [PlainTasks](https://github.com/aziz/PlainTasks)
  382. *An opinionated todo-list plugin*
  383.  
  384. * Tutorial: Preferences > Package Settings > PlainTasks > Tutorial
  385. * Create list: Ctrl+Shift+P, Tasks: New document
  386. * New Task: Ctrl+Enter (or Ctrl+I)
  387. * Task Complete (toggle): Ctrl+D
  388.  
  389. ### [PowerShell](https://github.com/SublimeText/PowerShell)
  390. *Support For The Ms PowerShell 2 Programming Language.*
  391.  
  392. ### [Prefixr](http://wbond.net/sublime_packages/prefixr)
  393. *Run CSS Through The Prefixr API.*
  394.  
  395. * Prefixr: Ctrl+Alt+X
  396.  
  397. ### [Pretty JSON](https://github.com/dzhibas/SublimePrettyJson)
  398. Prettify JSON.
  399.  
  400. * Prettify: Ctrl+Alt+J
  401.  
  402. **Preferences > Package Settings > Pretty JSON > Settings - User :**
  403.  
  404.    {
  405.        "ensure_ascii": true,
  406.        "indent": 4,
  407.        "sort_keys": true,
  408.        "use_entire_file_if_no_selection": true
  409.    }
  410.  
  411. ### [SideBarEnhancements](https://github.com/titoBouzout/SideBarEnhancements)
  412. *Provides Enhancements To The Operations On Side Bar Of Files And Folders.*
  413.  
  414. * Open current file in browser: F12 (NOTE: doesn’t support IE)
  415.  
  416. ### [Sublime-HTMLPrettify](https://github.com/victorporof/Sublime-HTMLPrettify)
  417. *Html, Css And Javascript Code Formatter.*
  418.  
  419. * Requires [Node.js](http://nodejs.org)
  420. * Prettify: Ctrl+Shift+P, htmlprettify
  421.  
  422. ### [SublimeCodeIntel](https://github.com/Kronuz/SublimeCodeIntel)
  423. *Code Intelligence Plugin For Php, Python, Rhtml, Javascript, Smarty, Mason, Node.js, Xbl, Tcl, Html, Html5, Templatetoolkit, Xul, Django, Perl, Ruby, Python3.*
  424.  
  425. * Jump to Symbol: Ctrl+F3 (or Alt+Click)
  426. * Manual autocomplete: Ctrl+J [NOTE: conflicts with “Join Lines”]
  427.  
  428. ### [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter)
  429. *Highlights Lines Of Code The Linter Deems To Contain (potential) Errors.*
  430.  
  431. * CSS, JS requires [Node.js](http://nodejs.org)
  432. * C++ requires [cppcheck](http://cppcheck.sourceforge.net/)
  433. * Note that C++ filters [can’t be modified](https://github.com/SublimeLinter/SublimeLinter/issues/300)
  434. * HTML requires [tidy](https://github.com/w3c/tidy-html5)
  435. * Lint: Ctrl+Alt+L
  436. * Next/Previous Error: Ctrl+Alt+E, Ctrl+Alt+Shift+E
  437.  
  438. **Preferences > Package Settings > SublimeLinter > Settings - User :**
  439.  
  440.    {
  441.        "sublimelinter": "load-save",
  442.        "sublimelinter_executable_map": {
  443.            "c": "C:/Program Files/cppcheck/cppcheck.exe",
  444.            "css": "C:/Program Files/nodejs/node.exe",
  445.            "javascript": "C:/Program Files/nodejs/node.exe"
  446.        },
  447.        "sublimelinter_gutter_marks": true,
  448.        "sublimelinter_popup_errors_on_save": true
  449.    }
  450.  
  451. ### [Tag](https://github.com/SublimeText/Tag)
  452. *Collection Of Packages About Tags.*
  453.  
  454. * Edit > Tag
  455. * Put matching closing tag: Alt+.
  456.  
  457. ### [Theme - Nexus](https://github.com/EleazarCrusader/nexus-theme)
  458. *Dark Custom Ui Theme.*
  459.  
  460. ### [Open URL](https://github.com/noahcoad/open-url)
  461. *Open URLs, files, folders, or google text under the cursor or in selected text.*
  462.  
  463. * Open highlighted URL: Ctrl+U
  464.  
  465. ### [VBScript](https://github.com/SublimeText/VBScript)
  466. VBScript Package.
Add Comment
Please, Sign In to add comment