pulsar/docs/customizing-atom.md

168 lines
6.4 KiB
Markdown
Raw Normal View History

2013-10-15 01:40:18 +04:00
# Customizing Atom
2013-04-25 00:34:23 +04:00
2013-10-15 01:40:18 +04:00
To change a setting, configure a theme, or install a package just open the
Settings view in the current window by pressing `cmd+,`.
2013-04-25 00:34:23 +04:00
2013-10-15 01:40:18 +04:00
## Changing The Theme
Atom comes with both light and dark UI themes as well as several syntax themes.
You are also encouraged to [create or fork][create-theme] your own theme.
2013-10-15 01:40:18 +04:00
To change the active theme just open the Settings view (`cmd-,`) and select the
`Themes` section from the left hand side. You will see a drop-down menu to
change the active _Syntax_ and _UI_ themes.
You can also install more themes from here by browsing the featured themes or
searching for a specific theme.
2013-10-15 01:40:18 +04:00
## Installing Packages
You can install non-bundled packages by going to the `Packages` section on left
hand side of the Settings view (`cmd-,`). You will see several featured packages
and you can also search for packages from here. The packages listed here have
been published to [atom.io](http://atom.io/packages) which is the official
registry for Atom packages.
You can also install packages from the command line using `apm`.
Check that you have `apm` installed by running the following command in your
terminal:
```sh
apm help install
```
You should see a message print out with details about the `apm install` command.
If you do not, launch Atom and run the _Atom > Install Shell Commmands_ menu
to install the `apm` and `atom` commands.
2013-10-15 01:40:18 +04:00
You can also install packages by using the `apm install` command:
* `apm install <package_name>` to install the latest version.
* `apm install <package_name>@<package_version>` to install a specific version.
2013-12-07 00:26:52 +04:00
For example `apm install emmet@0.1.5` installs the `0.1.5` release of the
[Emmet](https://github.com/atom/emmet) package into `~/.atom/packages`.
You can also use `apm` to find new packages to install:
* `apm search coffee` to search for CoffeeScript packages.
* `apm view emmet` to see more information about a specific package.
2013-10-15 01:40:18 +04:00
## 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:
```coffee
2013-10-15 01:40:18 +04:00
'.editor':
'enter': 'editor:newline'
2013-10-28 20:23:18 +04:00
'body':
'ctrl-b': 'core:move-left'
'ctrl-f': 'core:move-right'
2013-10-15 01:40:18 +04:00
```
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.
2013-10-26 03:16:47 +04:00
By default, `~/.atom/keymap.cson` is loaded when Atom is started. It will always
be loaded last, giving you the chance to override bindings that are defined by
Atom's core keymaps or third-party packages.
2013-10-15 01:40:18 +04:00
2013-10-31 01:42:53 +04:00
You'll want to know all the commands available to you. Open the Settings panel
(`cmd-,`) and select the _Keybindings_ tab. It will show you all the keybindings
currently in use.
2013-10-15 01:40:18 +04:00
## Advanced Configuration
2013-04-25 00:34:23 +04:00
Atom loads configuration settings from the `config.cson` file in your _~/.atom_
directory, which contains CoffeeScript-style JSON:
```coffee
'core':
'excludeVcsIgnoredPaths': true
'editor':
'fontSize': 18
2013-04-25 00:34:23 +04:00
```
2013-10-15 01:40:18 +04:00
The configuration itself is grouped by the package name or one of the two core
namespaces: `core` and `editor`.
2013-04-25 00:34:23 +04:00
2013-10-15 01:40:18 +04:00
### Configuration Key Reference
2013-04-25 00:34:23 +04:00
- `core`
2013-10-15 01:40:18 +04:00
- `disabledPackages`: An array of package names to disable
- `excludeVcsIgnoredPaths`: Don't search within files specified by _.gitignore_
2013-10-16 03:50:15 +04:00
- `ignoredNames`: File names to ignore across all of Atom
2013-10-15 01:40:18 +04:00
- `projectHome`: The directory where projects are assumed to be located
2013-04-25 00:34:23 +04:00
- `themes`: An array of theme names to load, in cascading order
- `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`: The editor font size
- `fontFamily`: The editor font family
- `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
2013-10-15 01:40:18 +04:00
- `normalizeIndentOnPaste`: Enable/disable conversion of pasted tabs to spaces
2013-04-25 00:34:23 +04:00
- `preferredLineLength`: Identifies the length of a line (defaults to `80`)
- `showInvisibles`: Whether to render placeholders for invisible characters (defaults to `false`)
2013-10-15 01:40:18 +04:00
- `showIndentGuide`: Show/hide indent indicators within the editor
- `showLineNumbers`: Show/hide line numbers within the gutter
- `softWrap`: Enable/disable soft wrapping of text within the editor
- `softWrapAtPreferredLineLength`: Enable/disable soft line wrapping at `preferredLineLength`
- `tabLength`: Number of spaces within a tab (defaults to `2`)
2013-04-25 00:34:23 +04:00
- `fuzzyFinder`
- `ignoredNames`: Files to ignore *only* in the fuzzy-finder
- `whitespace`
- `ensureSingleTrailingNewline`: Whether to reduce multiple newlines to one at the end of files
2013-10-15 01:40:18 +04:00
- `removeTrailingWhitespace`: Enable/disable striping of whitespace at the end of lines (defaults to `true`)
2013-12-10 21:52:20 +04:00
- `wrap-guide`
2013-04-25 00:34:23 +04:00
- `columns`: Array of hashes with a `pattern` and `column` key to match the
the path of the current editor to a column position.
2013-04-25 00:34:23 +04:00
2013-10-15 01:40:18 +04:00
### Quick Personal Hacks
2013-04-25 00:34:23 +04:00
### init.coffee
2013-04-25 00:34:23 +04:00
When Atom finishes loading, it will evaluate _init.coffee_ in your _~/.atom_
2013-04-25 00:34:23 +04:00
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.
If customizations become extensive, consider [creating a package][create-a-package].
2013-04-25 00:34:23 +04:00
This file can also be named _init.js_ and contain JavaScript code.
### styles.css
2013-04-25 00:34:23 +04:00
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
_styles.css_ in your _~/.atom_ directory.
2013-04-25 00:34:23 +04:00
2013-10-15 04:00:16 +04:00
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 _styles.css_:
2013-08-21 21:09:30 +04:00
```css
.editor .cursor {
border-color: pink;
2013-04-25 00:34:23 +04:00
}
```
2013-10-15 01:40:18 +04:00
You can also name the file _styles.less_ if you want to style Atom using
[LESS][LESS].
2013-10-15 01:40:18 +04:00
[create-a-package]: creating-packages.md
[create-theme]: creating-a-theme.md
[LESS]: http://www.lesscss.org