
Enter “ss” when the search bar pops up to jump down to the various “Set Syntax” options. This shortcut actually opens up the Command Palette – a menu that includes a number of things like package controls and preference settings. Command + Shift + p = Set Syntax Highlighting Now, we could probably do some refactoring here, but that’s another blog post! 7. If the keys of the hash happen to be named the same as the keys of the class’s attributes, then there is no need to type these out twice! If you start out withĭef import_dog_characteristics ( hash ) self. In Ruby, you might be setting several attributes of a class to values from a hash. As with the previous shortcut, this gets really powerful when combined with other keyboard shortcuts, like copy/paste. To get this to work, all you have to do is keep pressing the Command key and highlight different regions of text with the trackpad. This one is similar to the Command + d, but is not restricted to highlighting repetitions of the same text. Command + Highlight Text = Multiple Select of Different Words This is the first demo on the Sublime Text website – check it out if you haven’t yet! 6. What’s really cool about this is that Sublime gives you a cursor for each highlighted block of text! That means when you change the highlighted text in what you think should be one place, all of the highlighted texts change. I could do a global replacement with Command + Shift + f, but if I want to do a more fine-grained change and have more control over exactly what I’m highlighting and editing, I go with Command + d.
#Sublime text delete line code
Let’s say I’m refactoring my code and I decide to change the name of a method. Command + d = Multiple Select of the Same Word Control + Shift + k = Delete Current LineĪlso straightforward, and a more efficient version of “the number one tool for improving code.” 5. Simply duplicates the line you call the command on and places the new line below. Command + Shift + d = Duplicate Current Line Command + Shift + Enter has saved me many times here. a Ruby file)Īnd then immediately realize I want to write the body of the method.

It’s perfect if you write a couple of lines at the top of a file (e.g. I didn’t realize how much I needed this shortcut until I started using it.

Command + Shift + Enter = New Line AboveĪ slight modification of the above, and an insanely useful shortcut. This shortcut has saved me a lot of energy – instead of worrying about where the cursor is on a line when hitting Enter, I only need to make sure that the cursor is on that line. Gone are the days of pressing Enter and accidentally cutting a line in half, then having to undo, then having to figure out a way to get the cursor to get to the end of the line before hitting Enter again. I do almost all of my coding and blogging in Sublime, and as such there are a few convenient keyboard shortcuts I’ve picked up along the way.
#Sublime text delete line software
Like many software developers, Sublime Text is my preferred text editor. My Favorite Sublime Text Keyboard Shortcuts
