Last Updated: September 29, 2021
·
76.13K
· akhyar

Handy Sublime Text Shortcuts and Auto Completes for Web Developer

KEYBOARD SHORTCUTS

  • Block some lines of text and press CTRL+[ and CTRL+] to alter the indentation

  • Block some lines of text and press Ctrl+Shift+UP and Ctrl+Shift+DOWN to move the lines up and down

  • Block some lines of text and press Ctrl+Shift+K to delete the lines

  • Press Ctrl+Shift+D to duplicate current line

  • Press Alt+F3 to select all occurrences of current word or current selection

  • Press Ctrl+D to select next occurrence of current selection, Ctrl+K to skip last selected occurrence

  • Press Alt+. (alt+dot) to close open HTML tag. For example:

    <div> [alt+.]
    result:
    <div></div>
  • Press Alt+. (alt+dot) multiple times to close several open HTML tags in their orders. For example:

    <body><div><span> [alt+. 3 times]
    result:
    <body><div><span> </span></div></body>
  • Select some text and press Alt+Shift+W to wrap it in pre-selected

    tag that you can immediately type to change the tag.

  • Press Ctrl+G to go to certain line number

AUTO COMPLETES

When working on HTML/PHP files, or manually set it by Ctrl+Shift+P then type set php then ENTER

  • Type <html> then press TAB will results:

    <html>
    <head>
        <title></title>
    </head>
    <body>
    </body>
    </html>
  • Type anyhtmltag then press TAB will results

    <anyhtmltag>|<anyhtmltag> 
  • Type anyhtmltag.classname then press TAB will results

    <anyhtmltag class="classname">|<anyhtmltag> 
  • Type anyhtmltag#ID then press TAB will results

    <anyhtmltag id="ID">|<anyhtmltag> 
  • Type php then press TAB will results

    <?php | ?>
  • Type echo then press TAB will results

    <?php echo $var ?>
  • Type link then press TAB will results

    <link rel="stylesheet" type="text/css" href="|">
  • Type script then press TAB will results

    <script type="text/javascript"></script>

note that I use the pipe character "|" to indicate where the cursor will be placed after the auto complete