Skip to content

Setting up Atom

mlesueur edited this page Mar 21, 2019 · 20 revisions

Setting up Atom for Redback

Atom is a hackable text-editor from Github. We’ll be using Atom, plus a few plugins (called packages in Atom), to work with Redback code.

Versions:

Atom: latest

Packages:

In order to install packages in Atom for Mac, go to Atom->Preferences or use the shortcut: Command-Comma (,). This will open the Settings tab in Atom. One can find the Install option in the left-hand side menu of the tab. Then, one can use the search provided to look up for the following packages.

Autocomplete-clang:

This gives us autocompletion for *.C files.

Install from within atom; Then from command prompt, go to your Redback directory and run:

make clang_complete

This generates a .clang_complete file in the Redback directory, that has references to objects in both Moose and Redback. This functionality is implemented in Moose's makefile.

Autocomplete-moose:

Similar, but for *.i moose input files. Install from atom; no extra configuration needed.

language-moose:

Switch-header-source:

This lets you switch between .h and .C files within a project quickly.

Installation:

Install from atom.

To Use:

Right-click anywhere in the text-file and click Switch header/source.

External-open:

This lets you open various non-text files (e.g. xslx, docx) in the appropriate applications, straight from the tree view.

Installation:

Install from atom.

To use:

right-click on an item to open using the OS default application.

Multirow-tabs:

If you're like me, you'll have more files open at once than can be displayed in the tab bar. This lets the tab bar go to multiple rows.

Installation:

Install from atom.

To use:

Press control-alt-M to toggle between single-row and multirow.

Lucid-tabs:

Similar to above, this makes it easier to have many tabs open, by coloring them according to file extension.

Installation:

Install from atom. You will also need to edit the config file in ~/.atom/packages/lucid-tabs/styles/lucid-tabs.less; here's mine:

.lucid-tab('.c', rgb(60, 120, 168));
.lucid-tab('.C', rgb(60, 120, 168));
.lucid-tab('.h', rgb(252,128,27));
.lucid-tab('.i', rgb(214,233,245));
.lucid-tab('.py', rgb(60, 120, 168));
.lucid-tab('.e', rgb(50, 90, 162));
.lucid-tab('.sh', #29abde);
.lucid-tab('.csv', #29abde);
.lucid-tab('.$', rgb(107,125,196));

The file should already have some definitions for other extensions; just add these at the end of the file.

Advanced-open-file:

The default open dialog in OSX is awful. This is much better.

Installation:

Install from atom.

To use:

Press Command-alt-O to open the Open dialog. As well as the GUI, it accepts cut-pasted strings with autocomplete.

Fonts:

It's important that the code looks nice, because you'll be staring at it all day. This gives you many different choices in programming fonts.

Installation:

Install from atom.

To use:

You can switch the fonts from the package's Settings menu.

Making Atom hide various unimportant files in tree view

Running the compiler will produce various files that clutter the tree view. To hide them:

Atom->Preferences->Packages->Tree View->Settings->tick 'Hide Ignored Names'.

Then go to Settings->edit the Ignored Names list. Here's mine:

.git, .hg, .svn, .DS_Store, ._*, Thumbs.db, *.lo, *.d, *.o

Know issues

The plugins from MOOSE need to find a moose executable to work. You need to provide one in an upper folder. For this we can use a symbolic link of redback in the projects folder (if your input files are in a sub directory of projects):

ln -s ~/projects/redback/redback-opt ~/projects

The syntax for the atom plugins of MOOSE should be written with ./ and .. in order for it work:

[Postprocessors]
  [./truc]
    type = VolumePostprocessor
  [..]
[]