Atom Code Editor Tips: A Practical Guide to Improve Efficiency
Core points:
Atom is a code editor published and maintained by the GitHub team. The 2014 "Sublime Text Killer" has over 1.1 million monthly active users, and it's no surprise: an IDE that is easy to scale, customize and modify has become a favorite among many developers. Despite Atom's widespread use, I often see experienced developers doing tasks in lengthy ways or not realizing the true potential of Atom. This article explores some tips for improving Atom workflow. I hope that after you finish reading this article, you can learn at least a new technique that you cannot give up. Note: Although this article is for Atom users, many tips and shortcuts are also suitable for Sublime Text.
Techniques
First, introduce some general Atom tips. You can enable some options, use the IDE's capabilities, and menu settings that you never knew existed. It's worth browsing all menu options – you may find some features that you never knew existed!
Multi-cursor
One of the most impressive features of Atom is its multi-cursor support. This allows you to type multiple content at once at multiple locations in the document. Simply hold Cmd (Mac) or Ctrl (Windows/Linux) and click each location you want to type. There are other ways to get multiple cursors – but we'll introduce them later via keyboard shortcuts.
Automatic indentation
Indentation confusion is an annoying issue when copying code from elsewhere. Fortunately, Atom can solve this problem. Select the code and go to Edit > Lines > Auto Indent. This should copy the current indent of the file into your code for correction.
To speed up, I created a custom keyboard shortcut that allows me to use Ctrl Cmd ] (Mac) or Ctrl } (Windows/Linux) at any time. To do this yourself, go to Atom > Keymap (Mac) or File > Settings > Keybindings > Keymap (Windows/Linux) and paste the following (Mac):
<code>'atom-text-editor': 'ctrl-cmd-]': 'editor:auto-indent'</code>
or the following (Windows/Linux):
<code>'atom-text-editor': 'ctrl-}': 'editor:auto-indent'</code>
Show invisible characters
To make sure the document and all lines are using the correct indentation, I enabled the invisible characters in the editor. This will show ··· means space indentation, » means tab character, and ¬ means line break character. This helps you view accurate blank lines that mix tabs and spaces. While it will make your screen look "busy" at first, you will get used to it very quickly and I find it invaluable now. To do this, go to Atom (Mac) or File (Windows/Linux) > Preferences > (scroll down) Show Invisibles.
Soft line break
I don't like scrolling left and right and up and down, so to make sure there is only one direction, I enabled soft line wrap in Atom. This ensures that nothing goes beyond the edge of the screen, but instead surrounds the display. If it has a new line, it indents it to the same level as the previous line and replaces the line number in the slot with ·. To enable this option, go down several check boxes in Atom (Mac) or File (Windows/Linux)> Preferences > (scroll down) Soft Wrap.
Case conversion of characters
Sometimes your text is incorrectly case. You may need all capitalizations, or you may need to convert uppercase sentences to lowercase. In the Edit > Text menu, there are some clever text processing tools, including uppercase and lowercase features.
Bag
The package is a compelling reason to choose Atom. The ability to install and change anything is what makes this code editor so good. I won't list the best plugins you have to install - there are already many articles doing this. Instead, I recommend installing every plugin you encounter and uninstalling the plugin you don't like (or adding too much valuable startup time). If you go to Settings > Packages and click on the installed extension, it will tell you how many milliseconds of startup time it has added. Here are a few packages I rely on every day and are not listed in many other blog posts:
Project ManagerI like keyboard shortcuts. I can't help but try to learn all the shortcuts for each program I use. (I do something I use shortcuts in Photoshop, and I don't know how to do it without using it!) Of course, you will forget the shortcuts you don't use, and the shortcuts you use frequently will be remembered in your heart. I use the shortcut keys listed below at least once an hour. They are saviors. Copy line If the shortcut key has a medal, this will be one of the gold medals. I often use this shortcut key. It allows you to place the cursor on any row and copy it. It is very useful for copying CSS selectors, gradients, or table cells. Of course, you can also copy multiple lines at once—by highlighting them or using multiple cursors: Move the current line up and down This shortcut key works well with the copy line shortcut key above. No matter where your cursor is, this shortcut moves the current row above or below its surrounding rows. If you select multiple rows, it moves the entire block (and automatically indents) as you go in and out of the labels and brackets. Select the next matching character This command allows you to select the next word or character that matches the highlighted word or character. Then (using multiple cursors that are automatically generated), you can delete, edit, or update the highlighted values. This is especially useful if you want to update only a few values or properties without using find and replace. Deselect the next matching character If you are selecting the next match character, sometimes you will go too far. This shortcut key will deselect the most recently selected characters in the reverse order .
Switch comments (on and close) In some cases, you may want to comment out one or more lines of code. This shortcut comments out the current line (or lines) appropriately using the correct comment syntax of the language you are using. You no longer need to remember your... (The translation cannot be continued here due to the lack of the ending part of the original text.) <code>'atom-text-editor':
'ctrl-cmd-]': 'editor:auto-indent'</code>
<code>'atom-text-editor':
'ctrl-}': 'editor:auto-indent'</code>
<code>Cmd + Shift + D (Mac)
Ctrl + Shift + D (Windows/Linux)</code>
<code>Cmd + Ctrl + 上 (或下) 箭头 (Mac)
Ctrl + 上 (或下) 箭头 (Windows/Linux)</code>
<code>Cmd + D (Mac)
Ctrl + D (Windows/Linux)</code>
<code>'atom-text-editor':
'ctrl-cmd-]': 'editor:auto-indent'</code>
The above is the detailed content of 12 Favorite Atom Tips and Shortcuts to Improve Your Workflow. For more information, please follow other related articles on the PHP Chinese website!