Sublime Text: Tips, Plugins

Sublime Text used to be a good code editor for many languages and for many programmers. There are many better ones these days but I still use it for quickly modify a file which doesn’t exist in any working project. Here are some Sublime Text tips that I use daily:

9 Tips

All hotkeys below are for Windows. For Mac users, just replace Ctrl with Command.

Split window for a file

Many files contain thousands lines of codes. Sometimes a task required to have different lines be compared or edited at the same time. That’s why we need to view different parts of the same file with clone or split view.

  • File > New View into File
  • View > Layout > Columns: 2 or Rows: 2
  • Drag a tab to other view

Browse a file by name

The editor provides a shortcut which allows you to find a file inside your working directory and you know the name of that file.

Ctrl + P

This hotkey open a popup where you can type in a part of a file’s name to search for it.

Show unsaved changes

You can right-click on an opening file then click on Show Unsaved Changes... to reveal recently changes which haven’t been saved.

Input a HTML tag

With Alt + Shift + W you can place an tag with both opening and closing syntax. By default it places p tag, but you can type in any HTML tags you want to replace it.

To wrap a block of text with a tag, you can highlight that block and press Alt + Shift + W.

Search within entire project

Finding a file is something we already know, but Sublime Text make it better with the ability to search an entire project folder.

Press Ctrl + Shift + F to open the search box. You can input any directory to search within it.

Duplicate current line

You can place the mouse cursor on a line then press Ctrl + Shift + D. This action will copy the entire current line and duplicate it below.

Move line up or down

Moving lines of codes around with copy and paste is slow. That’s why Sublime Text provides us a shortcut to shift a line up or down.

Ctrl + Shift + Up for moving up a line.

Ctrl + Shift + Down for moving down a line.

Delete current line

Sublime Text also has a method for deleting the entire current line, even if nothing is highlighted.

Ctrl + Shift + K

Auto save

I have a habit of pressing Ctrl + S every line of code written. If you are like me, using this feature will help a lot.

Open Preferences > Settings and add this line:

"save_on_focus_lost": true

Best Sublime Text Plugins

  • Package Control – This is the must-have package as it helps in installing, downloading and updating of other plugins.
  • Alignment – This package takes your code and aligns the configured characters vertically. It is a nice tool to align characters like =>, ( for array in language like PHP.
  • Emmet – Emmet is a plugin for many popular text editors which greatly improves HTML & CSS workflow. It turn ul#menu>li*2 into
<ul id="menu">
  • SublimeLinter – SublimeLinter is a plugin for Sublime Text that provides a framework for linting code.
  • SASS – This is SCSS and Sass syntax, including completions for CSS properties and values, as well as relevant Sass functions.
  • Babel – It provides language definitions for ES6+ JavaScript with the extensions of React JSX syntax.
  • GhostText –  Everything you type in the editor will be instantly updated in the browser (and vice versa). It is a real time-saver.
  • SublimeGit – If you’re used to Git and dealing with Sublime Text packages, you can probably just install SublimeGit, and get right to work.
  • DocBlockr – This package helps writing documentation and simplify writing DocBlock comments in Javascript, PHP, CoffeeScript, Actionscript, C & C++.
  • SideBarEnhancements – It provides enhancements to the operations on Sidebar of Files and Folders.
  • Minifier – Minifier supports Google Closure Compiler for Javascript minification and cssminifier or Reducisaurus for CSS minification.

Leave a Comment

Your email address will not be published. Required fields are marked *

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.