Built-In Git IntegrationĪtom includes Git integration since version 1.18. To use it select the code you want to indent, open the command palette ( CTRL + ALT + P), then search for “auto”. Sometimes your indentation can get out of whack & it’s a pain to fix it by hand…Ītom has you covered because it comes with an “Auto Indent” feature. Think about what things you have to type often that are not already covered by built-in snippets, then write your own custom snippet for that. When you press “tab” your cursor will go to $2, then $3, etc. You can also have more than one of these cursor things. Notice the $1 here, that represents where the cursor is going to be positioned after the code snippet is inserted. by), you just group everything under there, properly indented. If you have multiple snippets you don’t want to repeat the language part (. Where the first string is the language for this snippet, then we have the name for this snippet (can be anything), and “prefix” is the actual word that will trigger the snippet, “body” is the code template. To do that just open your command palette ( CTRL + ALT + P) & type “osni” then press enter.Ī file will open where you can define your custom snippets.Ī snippet looks like this: ".by": In addition, you can create your own snippets. This happens automatically if you are editing a file with a. Notice that your file type needs to be set to “Ruby” for these snippets to work. There are also ERB specific snippets, like = for and - for. Here’s a list of some useful built-in Ruby snippets: Snippet Once you get used to it you will be doing this all the time. It will also put your cursor on the method name so you can start typing right away.Īfter that you can press the “tab” key & it will place your cursor inside the method body. ![]() That will create a method template for you. Snippets allow you to create expandable templates to write code faster.įor example, you can type def & the enter key. How to Use Atom Snippets To Boost Your Productivity Here’s a GIF demonstrating the multi-select feature: Search for files in current projects (quick open) Let me give you a table with some of my favorites: Shortcut (New & official Package for pair programming).You can install the “linter-ruby” package if you want to enable linting in your editor. This helps you find these errors faster without even having to run your tests. Mostly syntax errors, so don’t expect any miracles here □ Linter RubyĪ linter is a tool that points out errors in your code. To use it position your cursor inside the pair of quotes you would like to switch then press CTRL + " (or CMD + " on a Mac). You can easily switch between single & double quotes with the “toggle-quotes” package. This GIF demonstrates this package in action: With this package installed position your cursor inside a block, open the command-palette ( CTRL + ALT + P) & search for “converter”, then select either “to do end” or “to curly brackets”. You can save yourself some work by using the “block convert” package. You may want to convert between the do.end & block format. Note: If it doesn’t work try opening Atom from a terminal, instead of a menu or desktop icon.įirst open Atom’s style sheet file (with CTRL + ALT + P, type “osty”, then enter). Then to launch it make sure your file type is set to Ruby & then press ALT + R ( CTRL + R on Mac). To install it simply search for its name on the package manager window & click “Install”. The output will appear in a split window on the right (on the bottom if you have Atom 1.17 or newer). This package allows you to run code directly inside your editor. The first package I want to recommend is called “atom runner”. ![]() You can type in that search box to install the recommended packages. ![]() Open your settings ( CTRL + ,) & click on the “Install” tab. ![]() They can be installed from the editor’s interface itself. If you are an Atom user you’re going to love this article because that’s exactly what I cover here! Best Atom PackagesĪtom packages add new functionality to the editor. If you are using Atom for Ruby development then you probably know that there are plugins ( packages in Atom) that can improve your productivity with the editor.īut Atom’s package repository has thousands of packages!Īnd on top of that, what are some useful keyboard shortcuts you can use to work faster?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |