Sublime Text Editor

My favorite shortcuts

I think almost every programmer has his own favorite text editor. Some people like Vim, some people like Notepad++ and I love Sublime Text. There are lots of useful shortcuts, snippets, and plugins that allow me, in a fast and easy way, to work with code or simple text.

  1. I can see up to 4 files at the same time

    SublimeText has the option to see more than one file at the same time. If you add Origami plugin, you can have event more then 4 panels. To use basic SublimeText splitting panels functionality, you just go to the menu View -> Layout and you can choose which layout you like. You can also use the shortcut for that. In my SublimeText editor, I like to have two open files. First with code and second with tests. This is very useful when I work in TDD. I don’t need to switch between windows.

  2. Everything is customizable

    You just go to the menu Preferences -> Settings. There is everything you will need for customization. Colors, behaviors, everything. I recommend also to go through other setups in the Preferences menu. Especially Packages.

  3. Adding new packages

    If you like you can extend SublimeText behaviors by installing new packages. You can look at some of my favorites packages:

    • Emmet - for fast and easy creation of HTML or CSS
    • BracketHighlighter - to show you where you start and end brackets, this is nice especially when you have programming language like JavaScript
    • Git Gutter - to show which part of code changed. This is an integration with git. To get more details about git I recommend to you my git series. Start now from what is git article.
    • SublimePrettyJson - formatter for JSON, this is very useful when you have JSON in one line and you would like to read it easly
    • Sublime RuboCop - to show good practices in Ruby
    • Linters (Coffee Script, CSS, Sass, JS) - tools which shows good practices in different languages
    • Colorful syntax - you can add colors for different programming language syntax, when you don’t have specific colorization just install it

    There are even more extensions. The only thing you need to do is just search them on the Internet. ;)

  4. Shortcuts, shortcuts, shortcuts

    To be honest I love keyboard shortcuts. This is the reason why I write this article. As long as I can work without mouse using only keyboard, I’m very happy. Keybord is less time consuming then mouse. At least for me. And SublimeText is very useful, when it cames to shortcuts. You can see some of them below:

    • ctrl + k + b - toggle sidebar
    • ctrl + 0 - go to sidebar with folders (then you can use arrows to navigate between folders and files, enter ↩ opens selected file and move focus to this file)
    • ctrl + 1,2,3,4 - move focus between open panels/groups (it depends layout you choose)
    • ctrl + ←, → - go to word beginning/ending
    • ctrl + shift + ←, → - select previous/next word
    • ctrl + m - jump to closing/opening bracket for current code
    • ctrl + shift + m - select all contents of the current brackets (curly brackets, square brackets, parentheses)
    • ctrl + PgUp, PgDn - go to previous/next open tab (file)
    • ctrl + tab - next used tab/file open in one panel
    • ctrl + shift + tab - previous used tab/file open in one panel
    • ctrl + ↑, ↓ - move file up/down by one line (like scroll)
    • ctrl + shift + ↑, ↓ - switch lines in neighborhood, first line goes up, second goes down
    • crtl + / - comment/un-comment line (it depends selected programming language)
    • ctrl + delete - remove all next words (without adding to clipboard)
    • ctrl + backspace - remove all words before (without adding to clipboard)
    • ctrl + k + k - remove all next words (without adding to clipboard)
    • ctrl + shift + k - remove line (without adding to clipboard)
    • ctrl + ↩ - insert line after
    • ctrl + shift + ↩ - insert line before
    • ctrl + j - join line below to the end of the current line
    • ctrl + alt + j - pretty JSON power by SublimePrettyJson
    • ctrl + ] - indent current line(s)
    • ctrl + [ - un-indent current line(s)
    • ctrl + a - select a whole file
    • ctrl + l - select a whole line
    • ctrl + d - select word (repeat select others occurrences in context for multiple editing)
    • ctrl + shift + d - duplicate line(s)
    • ctrl + k + u - upper case
    • ctrl + k + l - lower case
    • ctrl + c - copy selected text to clipboard or when you have cursor in line without selected text copy whole line to clipboard
    • ctrl + v - paste selected text or whole line from clipboard
    • ctrl + x - cut selected text or whole line (when text is not selected) to clipboard
    • ctrl + g - go to line in current file
    • ctrl + ; - go to word in current file
    • ctrl + r - look for symbol (functions, method name, classes) in the file
    • ctrl + shift + r - look for symbol (functions, method name, classes) in all projects
    • ctrl + t - replace letter in neighborhood
    • ctrl + shift + t - open last closed tab (just like in your browser)
    • ctrl + h - replace one phrase to another in current file
    • ctrl + f - search in file
    • ctrl + shift + f - search in whole project (directory), you can also replace phrase in this project
    • ctrl + q - close Sublime completely
    • ctrl + w - close current file/tab
    • ctrl + shift + w - close all windows
    • ctrl + n - open new tab
    • ctrl + shift + n - open new window
    • ctrl + s - save file
    • ctrl + shift + s - save as (you can choose new name for file)
    • ctrl + o - open file
    • ctrl + shift + o - open new directory
    • ctrl + p - quick-open files by name in your project (you can even search by first letters of each part of file name example: searching by mnf, and SublimeText will find my_new_file.txt)
    • ctrl + shift + p - command line and package installer
    • ctrl + z - undo your last change
    • ctrl + shift + z - redo your last change
    • ctrl + y - do one more time last action
    • ctrl + shift + l - add cursor to the end of each selected line of code/text
    • shift + alt + ↑, ↓ - each time after press or add cursor to line above or below current line
    • f6 - check spelling in selected language (it can require installation of language package)
    • f9 - do alphabetical order of selected lines
    • f3 - next searched phrase
    • f3 + shift - previous searched phrase

I hope you find this useful. See you next time!


Need help?

If you're looking for a Ruby developer with over a decade of experience, don't hesitate to contact me.

I have experience in a variety of domains, with a focus on short user feedback loops and teamwork. I can help you build a great product.