Awesome Tips about Atom Editor



Awesome Tips about Atom Series

Install Atom Editor

  • Install Atom from here
  • Install Shell Commands
    • Go to Atom -> Install Shell Commands, this will install shell commands: atom and apm or atom-beta, apm-beta depended on we choose to install atom or atom-beta.
  • Install Packages at Settings -> Packages

Atom Editor Settings

Core Settings
  • Show/Hide files/folders ignored by .gitignore
    • (un)check “Hide VCS Ignored Files” in Tree View package
  • Make files/folders ignored by .gitignore searchable or not
    • (un)check “Exclude VCS Ignored Paths” in Settings
Atom -> Preference -> Editor -> Enable soft wrap

Tune Package Configuration

  • After install a new package, read its settings page to configure it, learn its Keybindings etc.
  • Find the package in “Preference -> Packages”
Command Palette
  • Select Preserve Last Search at Packages -> Command Palette
    • As we usually call same functions multiple times.
Tree View
Fuzzy Finder
  • Select Preserve Last Search
cmd-t or cmd-popen the file finder
cmd-bopen the list of open buffers
cmd-shift-bopen the list of Git modified and untracked files
AutoSave
  • select “enabled”.
Whitespace package

How To Explore and Learn Atom Functions

  • Command Palette
    • Find all commands from one package by starting with the package name: e.g. Type Change Case to know all functions provided
  • Use Cmd+Shift+?: Search -> Help to find/explore/call command.
  • After install the package, read its readme, and settings, change them if applied.
  • When you want to figure out how to do xx, or want some features, change some settings, first figure out what package provides the function.
    • By using Key Binding Resolver which shows which package responds to your typing or shortcut.

    Functions

  • Multiple cursors
    • cmd++Shift+click: add new cursors
  • Fold
  • Pending Pane Items

Must-Have Atom Editor Packages


Atom Editor Shortcuts

  • Search shortcut at Settings -> Keybindings
  • Shortcuts from vim-mode-plus
  • New File under current folder when select the folder or a file in project panel: A
Command+PSwitch to File
Command+Shift+PCommand Palette
Command+\Toggle Tree View
Command+EnterReplace all
Ctrl+Shift+CCopy full path
Cmd+Option++(-)Increase(decrease) active panel size
Cmd+Ctrl+GSelect all matching characters
Shift+Ctrl+MMarkdown Preview
Cmd+RFile symbol navigation
Ctrl + gGo to Line
Ctrl+mGo to Matching Bracket
Cmd+Shift+tBring up the list of corrections (with spell-check extension)
Ctrl+Shift+left(or right)move tab to left(or right)
Shortcut for Moving/Selection
Option+left(right)Move to beginning/end of word
Option+Shift+left(right)Select to beginning/end of word
Ctrl+A(E)Move to first character(end) of Line
Ctrl+Shift+A(E)Select to first character(end) of line
Cmd+up(down)Move to top(bottom)
Shift+Cmd+up(down)Select to top(bottom)
Shortcut for Writing
Cmd+k+uConvert to Upper Case
Cmd+k+lConvert to Lower Case
Ctrl+Shift+kDelete Line
Ctrl+KCut to End of Line
New Line Above
  • Space and new line are important when we write with markdown and use Pandoc to convert it to HTML.
  • So we need insert a new line above to fix the format issue: the default cmd-shift-enter confits with maximize-panels:maxmize
  • To assign alt-enter to newline-above, add the following in keymap.cson:

Atom Editor Keymap

When Shortcut Doesn’t Work

Example: Ctrl+e doesn’t work: not go to end of line

  • Use Cmd+. to open Key Binding Resolver
  • Type the shortcut, the Key Binding Resolver will show what commands this keybinding resolves to, and which one wins
  • In my case, Ctrl+e conflicts with Emmet: expand abbreviation
  • To solve it, I can either uninstall Emmet(as I don’t really use it)
  • or replace the shortcut with desired function
    • in the Key Binding Resolver click and go to the keymap file and find the keymap definition
How to disable key binding
  • Click the clipboard to copy the shortcut definition in Keybindings settings
  • replace the function to unset! to remove it or change it to another function
Change “Alt+1” to Toggle Tree-View
  • By default, “Alt+1” in Linux would show the first tab which itself is not that useful as I often use “ctrl+p” to go to specific tab;
  • “Alt+1” is to toggle(hide) the project view (in left side) in intellij, so I am often confused, and type “alt+1” to hide tree view by mistake.
Solve the conflict between jumpy:toggle and markdown-preview-enhanced:run-code-chunk

Moving in Atom Editor without Mouse or Trackpad

ctrl+F2list bookmarks
cmd+F2create bookmark
cmd+Rtoggle file symbols

Tabs

  • In command palette: Tabs: close other tabs, close tabs to left/right etc
  • Pane: Move item left/right(ctrl+shift+left/right) to move tab to the left/right

Atom Editor Snippets

Pending Pane Items

  • single-clicking a file will open it in pending state
  • use this to open files that we don’t want to keep and avoid open too many files
  • Cmd+Shift+F: project find opens files in pending state.

More Atom Editor Tips

Find Replace with regex
  • Add | at the beginning (to fix markdown table)
    • Search for ^(.*)$ and replace with |$1
  • find all links that doesn’t start with http in markdown: \]\([^h]
  • Only in Selection
File/Directory Pattern Syntax
  • Use minimatch and glob patterns
  • “globstar” pattern (**) can be used to match arbitrarily many subdirectories: docs/**/*.md
  • Exclude file types or paths: !
  • Search only java source (exclude test) code: **/src/main/**/*.java or *.java,!*Test.java(this also works in Eclipse)
Hot to Print in Atom Editor
apm
Resources

Labels

adsense (5) Algorithm (69) Algorithm Series (35) Android (7) ANT (6) bat (8) Big Data (7) Blogger (14) Bugs (6) Cache (5) Chrome (19) Code Example (29) Code Quality (7) Coding Skills (5) Database (7) Debug (16) Design (5) Dev Tips (63) Eclipse (32) Git (5) Google (33) Guava (7) How to (9) Http Client (8) IDE (7) Interview (88) J2EE (13) J2SE (49) Java (186) JavaScript (27) JSON (7) Learning code (9) Lesson Learned (6) Linux (26) Lucene-Solr (112) Mac (10) Maven (8) Network (9) Nutch2 (18) Performance (9) PowerShell (11) Problem Solving (11) Programmer Skills (6) regex (5) Scala (6) Security (9) Soft Skills (38) Spring (22) System Design (11) Testing (7) Text Mining (14) Tips (17) Tools (24) Troubleshooting (29) UIMA (9) Web Development (19) Windows (21) xml (5)