Atom: My Coding Environment

/img/atom/atom_drawing.jpg

I have been using the Atom text editor for quite a while and I am mostly happy with it. I also tried VS Code and the JetBrains IDEs and were pretty satisfied with them as well. Atom is open source and mainly developed by GitHub, the official description is:

A hackable text editor for the 21st Century

It is possible to edit all settings via text files, and it is highly configurable with packages (= plugins). In the following post I will list my most used packages and editor functionalities.

Atom Package Manager

Atom comes with the Atom Package manager apm. This command line tool has some useful functions:

# install a package (e.g. file-icons)
apm install file-icons

# list all installed packages
apm list

# save installed packages as list
apm list \
  --bare \
  --installed \
  > packages.txt

# install packages from list
apm install \
  --packages-file \
  packages.txt

Start Atom from Terminal

Atom can be started from the terminal by simply entering atom path_of_directory.Atom does not send any log messages to the terminal anymore. This is quite handy, since the terminal can be used for other tasks again.

File Icons

The package file-icons creates nice icons in the file tree.

Shortcuts

CTRL + SHIFT + p is the most important shortcut you should definitely remember. Every functionality can be reached with it by typing its name into the search field. It also displays the shortcut for the respective functionality. With CTRL + p you can browse all files of your project.

Markdown

CTRL + SHIFT + m shows a preview of a Markdown file. That is useful for editing READMEs and documentation. I also use it for writing this blog post. The package markdown-scroll-sync is useful for syncing the source markdown file with the rendered version.

Delete lines matching a pattern

The delete-lines package deletes lines matching a pattern. Sometimes this quite useful.

Snippets

Atom has many prebuild code snippets. For example if you are editing a markdown file and you type c then a markdown code block will be created. There are many more snippets. These can be found in the repositories of the language packages (e.g. JavaScript, Python, … ). It is also possible to add custom snippets (docs).

Project Manager

The package project-manager can store all you different projects. It basically remembers which folders are in the files overview, and which windows and tabs are opened. There is also an option to selected a workspace folder, the package will then look for git repositories and automatically creates Atom projects out of them.

Better Overview: Minimap and Highlight Selection

The package minimap displays an “overview” of the text file on the right side of the editor. This is very handy for navigating through long files. The package highlight-selected highlights the text snippet you have selected. The minimap-highlight-selected even displays the snippets inside the minimap.

Beautify

The package atom-beautify helps to format code properly (Shortcut CTRL + ALT + b). It takes care about proper indentation, removes whitespace or unnecessary empty lines and much more. Many programming languages are supported. It also possible to select a part of the text file and beautify it according to any wished language:

  1. select part of code
  2. CTRL + SHIFT + p
  3. search for your language

This can be useful for code blocks inside a Markdown file, or JavaScript inside an HTML.

Find and Replace

Atom contains a useful find and replace function. The short cut CTRL + f searches for a phrase in the current file. The CTRL + SHIFT + f searches the whole project. It is also possible to replace the selection.

Git integration

Atom has a build-in git integration. If the project uses git, at the bottom right some git specific buttons are shown. I typically use them for viewing my changes, staging files, writing commit messages and to push/pull. For more complex git operations I still use the command line.

Atom is also well suited as a git GUI e.g. Atom can be opened in two windows: one for coding and the other one for committing and viewing diffs. Especially viewing diffs is great, because they are updated permanently. It is also possible to revert specific lines of code using the GUI. Doing this with the command line would be much more complicated.

Terminal

The package atom-ide-ui contains many advances functionalities. I find the build-in terminal very useful, because I can edit files and execute them in the same window. I before I needed a separate terminal window for this.

Drawbacks

The low speed of the editor is the biggest drawback I have encountered so far. Also it sometimes freezes when it tries to open big files. In rare cases the git functionality loses track of the repository. A simple restart fixed this issue for me. All in all, I am very satisfied with the Atom text editor.

Feel free to contact me if you have any questions or feedback.