GitHubが開発している話題のAtomエディタ、あなたは使っていますか?最初はオープンソース・ソフトウェアではないことに悲観する声も聞かれましたが、それもあってか現在はオープンソースとして公開されています。 そんなAtomエディタをさらに便利にしてくれるライブラリ群を手軽にインストールできるソフトウェアがapm、Atomパッケージパネージャです。

apmの使い方

apmはGitHubからクローンして、ディレクトリ内でnpm installとするとインストールされます。最新のAtomエディタがアプリケーションフォルダ内にある必要があります。

まずヘルプから見てみましょう。

$ apm help

apm - Atom Package Manager powered by https://atom.io

Usage: apm <command>

where </command><command> is one of:
    clean, dedupe, dev, develop, docs, featured, home, init, install, link,
    linked, links, list, ln, lns, login, ls, open, outdated, publish, rebuild,
    search, show, test, uninstall, unlink, unpublish, update, upgrade, view.

Run `apm help </command><command>` to see the more details about a specific command.

Options:
  --version, -v  Print the apm version   
  --help, -h     Print this usage message
  --color        Enable colored output     [boolean]  [default: true]

listやsearchから探してインストールするのが基本になるようです。

例えばemacsで検索してみます。

$ apm search emacs
Search Results For 'emacs' (10)
├── atom-mac-theme An OSX style theme for Atom (3248 downloads)
├── atomic-emacs An atomic implementation of emacs keybindings (997 downloads)
├── demain A fork of the tomorrow theme. Light grey background, white line highlight, blue text selection and blue HTML rather than red. (18 downloads)
├── emacs This repo will be abandoned shortly, please use the other extension called `emacs-mode`. (107 downloads)
├── emacs-center-screen A short description of your package (9 downloads)
├── emacs-flow Offers Emacs-like indentation functionality (27 downloads)
├── emacs-mode Enjoy a mouse-free Emacs experience on a modern editor. (225 downloads)
├── mac-classic A short description of your theme (308 downloads)
├── sort-machine Maintain SASS properties in order (41 downloads)
└── transient-emacs Emacs mode using transient mark (30 downloads)

Use `apm install` to install them or visit http://atom.io/packages to read more about them.

こんな感じです。テーマやキーバインドなど様々なライブラリがあります。

では実際にインストールしてみます。今回はMarkdownのプレビューライブラリです。

$ apm install  markdown-preview
Installing markdown-preview to /Users/nakatsugawa/.atom/packages ✓

インストールはすぐに終わります。インストールされるとメニューにMarkdownプレビューが追加されます。

こうするとMarkdownエディタ的なものが不要になってしまいそうですね。

最近はこの手のパッケージ管理が大事な役目を果たすようになっています。apmを見ると、利用だけでなく開発側としても使えるコマンドがありそうなので、Atomをより便利にするコマンド、テーマを作ってみるのは面白そうですね。

apmはnode/JavaScript製のオープンソース・ソフトウェア(MIT License)です。

atom/apm