First pass at documentation correctness

This commit is contained in:
Matt Colyer
2013-08-20 16:48:01 -07:00
parent 159f521104
commit f0677e43fa
4 changed files with 71 additions and 314 deletions

View File

@@ -24,22 +24,30 @@ my-package/
index.coffee
```
**NOTE:** NPM behavior is partially implemented until we get a working Node.js
API built into Atom. The goal is to make Atom packages be a superset of NPM
packages.
Below, we'll break down each directory. There's also [a tutorial](./creating_a_package.md)
on creating your first package.
## package.json
Similar to [npm packages](http://en.wikipedia.org/wiki/Npm_(software\)), Atom packages
Similar to [npm packages][npm], Atom packages
can contain a _package.json_ file in their top-level directory. This file contains metadata
about the package, such as the path to its "main" module, library dependencies,
and manifests specifying the order in which its resources should be loaded.
In addition to the regular [npm package.json keys](https://npmjs.org/doc/json.html)
available, Atom package.json files [have their own additions](./package_json.md).
available, Atom package.json files have their own additions.
- `main` (**Required**): the path to the CoffeeScript file that's the entry point
to your package
- `stylesheets` (**Optional**): an Array of Strings identifying the order of the
stylesheets your package needs to load. If not specified, stylesheets in the _stylesheets_
directory are added alphabetically.
- `keymaps`(**Optional**): an Array of Strings identifying the order of the
key mappings your package needs to load. If not specified, mappings in the _keymaps_
directory are added alphabetically.
- `snippets` (**Optional**): an Array of Strings identifying the order of the
snippets your package needs to load. If not specified, snippets in the _snippets_
directory are added alphabetically.
- `activationEvents` (**Optional**): an Array of Strings identifying events that
trigger your package's activation. You can delay the loading of your package until
one of these events is trigged.
## Source Code
@@ -104,7 +112,7 @@ please collaborate with us if you need an API that doesn't exist. Our goal is
to build out Atom's API organically based on the needs of package authors like
you.
See [Atom's built-in packages](https://github.com/github/atom/tree/master/src/packages)
See [Atom's built-in packages](https://github.com/atom/atom/)
for examples of Atom's API in action.
## Stylesheets
@@ -214,17 +222,17 @@ Under the hood, [Jasmine](https://github.com/pivotal/jasmine) is being used to r
to execute the tests, so you can assume that any DSL available there is available
to your package as well.
# Creating Packages
# Full Example
Let's take a look at creating our first package.
Atom has a command you can enter that'll create a package for you:
`package-generator:generate`. Otherwise, you can hit `meta-p`, and start typing
`package-generator:generate`. Otherwise, you can hit `-p`, and start typing
"Package Generator." Once you activate this package, it'll ask you for a name for
your new package. Let's call ours _changer_.
Now, _changer_ is going to have a default set of folders and files created for us.
Hit `meta-R` to reload Atom, then hit `meta-p` and start typing "Changer." You'll
Hit `cmd-r` to reload Atom, then hit `cmd-p` and start typing "Changer." You'll
see a new `Changer:Toggle` command which, if selected, pops up a new message. So
far, so good!
@@ -283,7 +291,7 @@ The next step is to hide elements in the tree that aren't modified. To do that,
we'll first try and get a list of files that have not changed.
All packages are able to use jQuery in their code. In fact, we have [a list of
some of the bundled libraries Atom provides by default](./included_libraries.md).
some of the bundled libraries Atom provides by default](#included-libraries).
Let's bring in jQuery:
@@ -300,7 +308,7 @@ magic: ->
console.log el
```
You can access the dev console by hitting `alt-meta-i`. When we execute the
You can access the dev console by hitting `alt-cmd-i`. When we execute the
`changer:magic` command, the browser console lists the items that are not being
modified. Let's add a class to each of these elements called `hide-me`:
@@ -480,21 +488,5 @@ libraries into their packages:
Additional libraries can be found by browsing Atom's _node_modules_ folder.
# package.json format
The following keys are available to your package's _package.json_ manifest file:
- `main` (**Required**): the path to the CoffeeScript file that's the entry point
to your package
- `stylesheets` (**Optional**): an Array of Strings identifying the order of the
stylesheets your package needs to load. If not specified, stylesheets in the _stylesheets_
directory are added alphabetically.
- `keymaps`(**Optional**): an Array of Strings identifying the order of the
key mappings your package needs to load. If not specified, mappings in the _keymaps_
directory are added alphabetically.
- `snippets` (**Optional**): an Array of Strings identifying the order of the
snippets your package needs to load. If not specified, snippets in the _snippets_
directory are added alphabetically.
- `activationEvents` (**Optional**): an Array of Strings identifying events that
trigger your package's activation. You can delay the loading of your package until
one of these events is trigged.
[npm]: http://en.wikipedia.org/wiki/Npm_(software)

View File

@@ -2,58 +2,4 @@
"title": "Creating a Theme"
}}}
# Authoring Themes
If you understand CSS, you can write an Atom theme easily. Your theme can style
Atom's user interface, specify the appearance of syntax-highlighted code, or
both. For making a syntax highlighting theme, refer to
[section 12.4 of the TextMate Manual](http://manual.macromates.com/en/language_grammars.html)
for a list of the common scopes used by TextMate grammars. You'll just need to
translate scope names to CSS classes. To theme Atom's user interface, take a
look at the existing light and dark themes for an example. Pressing `alt-meta-i`
and inspecting the Atom's markup directly can also be helpful.
The most basic theme is just a _.css_ file. More complex themes occupy their own
folder, which can contain multiple stylesheets along with an optional
_package.cson_ file containing a manifest to control their load-order:
```text
~/.atom/themes/
rockstar.css
rainbow/
package.json
core.css
editor.css
tree-view.css
```
package.cson:
```coffee-script
stylesheets: ["core.css", "editor.less", "tree-view.css"]
```
The `package.cson` file specifies which stylesheets to load and in what order
with the `stylesheets` key. If no manifest is specified, all stylesheets are
loaded in alphabetical order when the user selects the theme.
## Theme Extensions (Not Yet Implemented)
A theme may need to be extended to cover DOM elements that are introduced by a
third-party Atom package. When a package is loaded, stylesheets with the same
name as the package will automatically be loaded from the `packages` directory
of active themes:
```text
~/.atom/themes/
midnight/midnight.less
midnight/packages/terminal.less
midnight/packages/tree-view.less
```
In the example above, if the `midnight` theme is active, its `terminal` and
`tree-view` stylesheets will be loaded automatically if and when those packages
are activated. If you author an extension to a theme consider sending its author
a pull request to have it included in the theme by default. Package-specific
theme stylesheets need not be listed in the theme's `package.json` because they
will be loaded automatically when the package is loaded.
# Authoring Themes (Not Yet Implemented)

View File

@@ -7,7 +7,7 @@
## Your .atom Directory
When you install Atom, an _.atom_ directory is created in your home directory.
If you press `meta-,`, that directory is opened in a new window. For the
If you press `-,`, that directory is opened in a new window. For the
time being, this serves as the primary interface for adjusting configuration
settings, adding and changing key bindings, tweaking styles, etc.
@@ -85,7 +85,11 @@ keymaps or third-party packages.
Atom comes bundled with two themes `atom-dark-*` and `atom-light-*`.
Because Atom themes are based on CSS, it's possible to have multiple themes
active at the same time. For example, you'll usually select a theme for the UI
active at the same time.
VERIFY: Is this still true?
For example, you'll usually select a theme for the UI
and another theme for syntax highlighting. You can select themes by specifying
them in the `core.themes` array in your `config.cson`:
@@ -97,24 +101,13 @@ core:
```
You install new themes by placing them in the _~/.atom/themes_ directory. A
theme can be a CSS file, a directory containing multiple CSS files, or a
TextMate theme (either _.tmTheme_ or _.plist_).
theme can be a CSS file or a directory containing multiple CSS files.
VERIFY: Where did we wind up with themes?
## Installing Packages (Partially Implemented)
## Installing Packages
To install a package, clone it into the _~/.atom/packages_ directory. Atom will
also load grammars and snippets from TextMate bundles. If you want to disable a
package without removing it from the packages directory, insert its name into
_config.core.disabledPackages_:
```coffeescript
core:
disabledPackages: [
"fuzzy-finder",
"tree-view"
]
```
FIXME: Rewrite for the new dialog.
## Quick Personal Hacks
@@ -128,6 +121,8 @@ customizations become extensive, consider [creating a package](./packages/creati
### user.css
VERIFY: Do we favor less or css?
If you want to apply quick-and-dirty personal styling changes without creating
an entire theme that you intend to distribute, you can add styles to
_user.css_ in your _~/.atom_ directory.

View File

@@ -4,64 +4,35 @@
# Getting Started
Welcome to Atom. This documentation provides a basic introduction to being
productive with this editor. We'll then delve into more details about configuring,
theming, and extending Atom.
Welcome to Atom! This guide provides a quick introduction so you can be
productive as quickly as possible. There are also guides which cover
[configuring][configuring], [theming][theming], and [extending][extending] Atom.
## The Command Palette
If there's one key-command you must remember in Atom, it should be `meta-p` (`meta` is
synonymous with the ⌘ key). You can always hit `meta-p` to bring up a list of
commands that are relevant to the currently focused UI element. If there is a
key binding for a given command, it is also displayed. This is a great way to
explore the system and get to know the key commands interactively. If you'd like
to learn about adding or changing a binding for a command, refer to the [key
bindings](#customizing-key-bindings) section.
If there's one key-command you must remember in Atom, it should be `⌘-p`. You
can always hit `-p` to bring up a list of commands that are relevant to the
currently focused UI element. If there is a key binding for a given command, it
is also displayed. This is a great way to explore the system and get to know the
key commands interactively. If you'd like to learn about adding or changing a
binding for a command, refer to the [key bindings](#customizing-key-bindings)
section below.
![Command Palette](http://f.cl.ly/items/32041o3w471F3C0F0V2O/Screen%20Shot%202013-02-13%20at%207.27.41%20PM.png)
## Basic Key Bindings
You can always use `meta-p` to explore available commands and their
bindings, but here's a list of a few useful commands.
- `meta-o` : open a file or directory
- `meta-shift-n` : open new window
- `meta-r` : reload the current window
- `meta-alt-ctrl-s` : run test specs
- `meta-t` : open file finder to navigate files in your project
- `meta-;` : open command prompt
- `meta-f` : open command prompt with `/` for a local file search
- `meta-g` : repeat the last local search
- `meta-shift-f` : open command prompt with `Xx/` for a project-wide search
- `meta-\` : focus/open tree view, or close it when it is focused
- `meta-|` : open tree view with the current file selected
- `ctrl-w v`, `ctrl-|` : split screen vertically
- `ctrl-w s`, `ctrl--` : split screen horizontally
- `meta-l` : go to line
## Usage Basics
### If You See A Rendering Bug
Things are pretty stable, but we think we have a couple rendering bugs lurking
that are hard to reproduce. If you see one, please hit `meta-p` and type
"save debug snapshot". Run that command to save a snapshot of the misbehaving
editor and send it to us, along with a screenshot and your best description of
how you produced the bug. Refreshing with `meta-r` should usually resolve the
issue so you can keep working.
## The Basics
### Working With Files
#### Finding Files
The fastest way to find a file in your project is to use the fuzzy finder. Just
hit `meta-t` and start typing the name of the file you're looking for. If you
already have the file open as a tab and want to jump to it, hit `meta-b` to bring
hit `-t` and start typing the name of the file you're looking for. If you
already have the file open as a tab and want to jump to it, hit `-b` to bring
up a searchable list of open buffers.
You can also use the tree view to navigate to a file. To open or move focus to
the tree view, hit `meta-\`. You can then navigate to a file and select it with
the tree view, hit `-\`. You can then navigate to a file and select it with
`return`.
#### Adding, Moving, Deleting Files
@@ -74,33 +45,20 @@ needed.
To move or rename a file or directory, select it in the tree view and hit `m`.
To delete a file, select it in the tree view and hit `delete`.
### Searching For Stuff
### Searching
#### Using the Command Line
#### Find and Replace
Atom has a command line similar to old-school editors such as emacs and vim. Nearly
every command has a key binding which you can discover with `meta-p`.
The command line is also (currently) the only place you can perform a search. Hitting
`meta-f` opens the command line and prepopulates it with the `/` command. This finds
text in the current buffer, starting at the location of the cursor. Pressing `meta-g`
repeats the search. Hitting `meta-shift-f` opens the command line and prepopulates
it with `Xx/`, which is a composite command that performs a global search. The results
of the search appear in the operation preview list, which you can focus
with `meta-:`.
Atom's command language is still under construction, and is loosely based on
the [Sam editor](http://doc.cat-v.org/bell_labs/sam_lang_tutorial/) from the
Plan 9 operating system. It's similar to Ex mode in vim, but is selection-based
rather than line-based. It allows you to compose commands together in
interesting ways.
FIXME: Describe https://github.com/atom/find-and-replace
#### Navigating By Symbols
VERIFY: This seems to happen automatically now and cmd+shift+j doesn't seem to work.
If you want to jump to a method, you can use the ctags-based symbols package.
The `meta-j` binding opens a list of all symbols in the current file. The
`meta-shift-j` binding opens a list of all symbols for the current project
based on a tags file. `meta-.` jumps to the tag for the word currently
The `-j` binding opens a list of all symbols in the current file. The
`-shift-j` binding opens a list of all symbols for the current project
based on a tags file. `-.` jumps to the tag for the word currently
under the cursor.
Make sure you have a tags file generated for the project for
@@ -108,16 +66,6 @@ the latter of these two bindings to work. Also, if you're editing CoffeeScript,
it's a good idea to update your `~/.ctags` file to understand the language. Here
is [a good example](https://github.com/kevinsawicki/dotfiles/blob/master/.ctags).
### Replacing Stuff
To perform a replacement, open up the command line with `meta-;` and use the `s`
command, as follows: `s/foo/bar/g`. Note that if you have a selection, the
replacement will only occur inside the selected text. An empty selection will
cause the replacement to occur across the whole buffer. If you want to run the
command on the whole buffer even if you have a selection, precede your
substitution with the `,` address; this indicates that the following command should
run on the whole buffer.
### Split Panes
You can split any editor pane horizontally or vertically by using `ctrl-\` or
@@ -134,148 +82,24 @@ planning to improve it soon.
### Soft-Wrap
If you want to toggle soft wrap, trigger the command from the command palette.
Hit `meta-p` to open the palette, then type "wrap" to find the correct
Hit `-p` to open the palette, then type "wrap" to find the correct
command.
## Your .atom Directory
## Configuration
When you install Atom, an `.atom` directory is created in your home directory.
If you press `meta-,`, that directory will be opened in a new window. For the
time being, this will serve as the primary interface for adjusting configuration
If you press `⌘-,`, a configuration panel will appear in the currently focused
pane. This will serve as the primary interface for adjusting configuration
settings, adding and changing key bindings, tweaking styles, etc.
## Configuration Settings
For more advanced configuration see the [customization guide][customization].
Atom loads configuration settings from the `config.cson` file in your `~/.atom`
directory, which contains CoffeeScript-style JSON:
## Installing Packages
```coffeescript
'editor':
'fontSize': 16
'core':
'themes': [
'atom-dark-ui'
'atom-dark-syntax'
]
```
To install a package, open the configuration panel and select the packages tab.
Configuration is broken into namespaces, which are defined by the config hash's
top-level keys. In addition to Atom's core components, each package may define
its own namespace.
FIXME: Needs more details.
### Glossary of Config Keys
- core
- disabledPackages: An array of package names to disable
- hideGitIgnoredFiles: Whether files in the .gitignore should be hidden
- ignoredNames: File names to ignore across all of atom (not fully implemented)
- themes: An array of theme names to load, in cascading order
- autosave: Save a resource when its view loses focus
- editor
- autoIndent: Enable/disable basic auto-indent (defaults to true)
- autoIndentOnPaste: Enable/disable auto-indented pasted text (defaults to false)
- nonWordCharacters: A string of non-word characters to define word boundaries
- fontSize
- fontFamily
- invisibles: Specify characters that Atom renders for invisibles in this hash
- tab: Hard tab characters
- cr: Carriage return (For Microsoft-style line endings)
- eol: `\n` characters
- space: Leading and trailing space characters
- preferredLineLength: Packages such as autoflow use this (defaults to 80)
- showInvisibles: Whether to render placeholders for invisible characters (defaults to false)
- fuzzyFinder
- ignoredNames: Files to ignore *only* in the fuzzy-finder
- whitespace
- ensureSingleTrailingNewline: Whether to reduce multiple newlines to one at the end of files
- wrapGuide
- columns: Array of hashes with a `pattern` and `column` key to match the
the path of the current editor to a column position.
## Customizing Key Bindings
Atom keymaps work similarly to stylesheets. Just as stylesheets use selectors
to apply styles to elements, Atom keymaps use selectors to associate keystrokes
with events in specific contexts. Here's a small example, excerpted from Atom's
built-in keymaps:
```coffeescript
'.editor':
'enter': 'editor:newline'
'.select-list .editor.mini':
'enter': 'core:confirm'
```
This keymap defines the meaning of `enter` in two different contexts. In a
normal editor, pressing `enter` emits the `editor:newline` event, which causes
the editor to insert a newline. But if the same keystroke occurs inside of a
select list's mini-editor, it instead emits the `core:confirm` event based on
the binding in the more-specific selector.
By default, any keymap files in your `~/.atom/keymaps` directory will be loaded
in alphabetical order when Atom is started. They will always be loaded last,
giving you the chance to override bindings that are defined by Atom's core
keymaps or third-party packages.
## Changing The Theme
Atom comes bundles with two themes `atom-dark-*` and `atom-light-*`.
Because Atom themes are based on CSS, it's possible to have multiple themes
active at the same time. For example, you'll usually select a theme for the UI
and another theme for syntax highlighting. You can select themes by specifying
them in the `core.themes` array in your `config.cson`:
```coffeescript
core:
themes: ["atom-light-ui", "atom-light-syntax"]
# or, if the sun is going down:
# themes: ["atom-dark-ui", "atom-dark-syntax"]
```
You install new themes by placing them in the `~/.atom/themes` directory. A
theme can be a CSS file, a directory containing multiple CSS files, or a
TextMate theme (either `.tmTheme` or `.plist`).
## Installing Packages (Partially Implemented)
To install a package, clone it into the `~/.atom/packages` directory. Atom will
also load grammars and snippets from TextMate bundles. If you want to disable a
package without removing it from the packages directory, insert its name into
`config.core.disabledPackages`:
config.cson:
```coffeescript
core:
disabledPackages: [
"fuzzy-finder",
"tree-view"
]
```
## Quick Personal Hacks
### user.coffee
When Atom finishes loading, it will evaluate `user.coffee` in your `~/.atom`
directory, giving you a chance to run arbitrary personal CoffeeScript code to
make customizations. You have full access to Atom's API from code in this file.
Please refer to the Atom Internals Guide for more information. If your
customizations become extensive, consider creating a package.
### user.css
If you want to apply quick-and-dirty personal styling changes without creating
an entire theme that you intend to distribute, you can add styles to
`user.css` in your `~/.atom` directory.
For example to change the color of the highlighted line number for the line that
contains the cursor, you could add the following style to `user.css`:
```css
.editor .line-number.cursor-line {
color: pink;
}
```
[configuring]: customizing-atom.html
[theming]: creating-a-theme.html
[extending]: creating-a-package.html
[customization]: customizing-atom.html