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.
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.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 thePreferences
menu. EspeciallyPackages
.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. ;)
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 sidebarctrl + 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/endingctrl + shift + ←, →
- select previous/next wordctrl + m
- jump to closing/opening bracket for current codectrl + 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 panelctrl + shift + tab
- previous used tab/file open in one panelctrl + ↑, ↓
- move file up/down by one line (like scroll)ctrl + shift + ↑, ↓
- switch lines in neighborhood, first line goes up, second goes downcrtl + /
- 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 afterctrl + shift + ↩
- insert line beforectrl + j
- join line below to the end of the current linectrl + alt + j
- pretty JSON power by SublimePrettyJsonctrl + ]
- indent current line(s)ctrl + [
- un-indent current line(s)ctrl + a
- select a whole filectrl + l
- select a whole linectrl + d
- select word (repeat select others occurrences in context for multiple editing)ctrl + shift + d
- duplicate line(s)ctrl + k + u
- upper casectrl + k + l
- lower casectrl + c
- copy selected text to clipboard or when you have cursor in line without selected text copy whole line to clipboardctrl + v
- paste selected text or whole line from clipboardctrl + x
- cut selected text or whole line (when text is not selected) to clipboardctrl + g
- go to line in current filectrl + ;
- go to word in current filectrl + r
- look for symbol (functions, method name, classes) in the filectrl + shift + r
- look for symbol (functions, method name, classes) in all projectsctrl + t
- replace letter in neighborhoodctrl + shift + t
- open last closed tab (just like in your browser)ctrl + h
- replace one phrase to another in current filectrl + f
- search in filectrl + shift + f
- search in whole project (directory), you can also replace phrase in this projectctrl + q
- close Sublime completelyctrl + w
- close current file/tabctrl + shift + w
- close all windowsctrl + n
- open new tabctrl + shift + n
- open new windowctrl + s
- save filectrl + shift + s
- save as (you can choose new name for file)ctrl + o
- open filectrl + shift + o
- open new directoryctrl + p
- quick-open files by name in your project (you can even search by first letters of each part of file name example: searching bymnf
, and SublimeText will findmy_new_file.txt
)ctrl + shift + p
- command line and package installerctrl + z
- undo your last changectrl + shift + z
- redo your last changectrl + y
- do one more time last actionctrl + shift + l
- add cursor to the end of each selected line of code/textshift + alt + ↑, ↓
- each time after press↑
or↓
add cursor to line above or below current linef6
- check spelling in selected language (it can require installation of language package)f9
- do alphabetical order of selected linesf3
- next searched phrasef3 + 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.