guia para atom

7
Getting Started 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 , theming , and extending Atom. The Command Palette If there's one key-command you remember in Atom, it should be cmd-shift-P. You can always press cmd-shift-P to bring up a list of commands (and key bindings) that are relevant to the currently focused interface element. This is a great way to explore the system and learn key bindings interactively. For information about adding or changing a key binding refer to the customizing key bindings section. The Basics Working With Files Atom windows are scoped to a single directory on disk. If you launch Atom from the command line via the atom command and don't specify a path, Atom opens a window for the current working directory. The current window's directory will be visible as the root of the tree view on the left, and also serve as the context for all file-related operations. Finding Files

Upload: r-moura-ribeiro

Post on 08-Aug-2015

96 views

Category:

Internet


0 download

TRANSCRIPT

Page 1: Guia para atom

Getting StartedWelcome to Atom! This guide provides a quick introduction so you can be productive as quickly as possible. There are also guides which cover configuring, theming, and extending Atom.

The Command PaletteIf there's one key-command you remember in Atom, it should be cmd-shift-P. You can always press cmd-shift-P to bring up a list of commands (and key bindings) that are relevant to the currently focused interface element. This is a great way to explore the system and learn key bindings interactively. For information about adding or changing a key binding refer to the customizing key bindings section.

The Basics

Working With Files

Atom windows are scoped to a single directory on disk. If you launch Atom from the command line via theatom command and don't specify a path, Atom opens a window for the current working directory. The current window's directory will be visible as the root of the tree view on the left, and also serve as the context for all file-related operations.

Finding Files

The fastest way to find a file is to use the fuzzy finder. Press cmd-t and begin typing the name of the file you're looking for. If you are looking for a file that is already open press cmd-b to bring up a searchable list of open files. If you are using Git you can use cmd-shift-b to search the list of files modified and untracked in your project's repository.You can also use the tree view to navigate to a file. To open and focus the the tree view, press  ctrl-0. The tree view can be toggled open and closed with cmd-\.

Page 2: Guia para atom

Adding, Moving, Deleting Files

You can add, move, and delete files and folders by right-clicking them in the tree view and selecting the desired operation from the context menu. You can also perform these operations from the keyboard by selecting a file or folder and using a to add, m to move, and delete to delete.

Searching

Find and Replace

To search within a buffer use cmd-f. To search the entire project use cmd-shift-f.

Navigating By Symbols

To jump to a symbol such as a method definition, press cmd-r. This opens a list of all symbols in the current file, which you can fuzzy filter similarly to cmd-t.To search for symbols across your project, use cmd-shift-r. First you'll need to make sure you have tags(or TAGS) file generated for your project. This can be done by installing ctags and running a command such as ctags -R src/ from the command line in your project's root directory. Using Homebrew? Just run brew install ctags.You can customize how tags are generated by creating your own .ctags file in your home directory (~/.ctags). Here is a good example to start from.

Split Panes

You can split any editor pane horizontally or vertically by using cmd-k right or cmd-k down. Once you have a split pane, you can move focus between them with cmd-k cmd-right or cmd-k cmd-down. To close a pane, close all its editors with cmd-w, then press cmd-w one more time to close the pane. You can configure panes to auto-close when empty in the Settings view.

Folding

You can fold blocks of code by clicking the arrows that appear when you hover your mouse cursor over the gutter. You can also fold and unfold from the keyboard with alt-cmd-[ and alt-cmd-]. To fold everything, use alt-cmd-shift-{ and to unfold everything use alt-cmd-shift-}. You can also fold at a specific indentation level with cmd-k cmd-N where N is the indentation depth.

Soft-Wrap

If you want to toggle soft wrap, trigger the command from the command palette. Press cmd-shift-P to open the palette, then type "wrap" to find the correct command. By default, lines will wrap based on the size of the editor. If you prefer to wrap at a specific line length, toggle "Wrap at preferred line length" in preferences.

ConfigurationPress cmd-, to open the Settings view. This is the place to change settings, install packages, and change the theme.

For more advanced configuration see the customization guide.

Customizing AtomTo change a setting, configure a theme, or install a package just open the Settings view in the

current window by pressing cmd-,.

Page 3: Guia para atom

Changing The Theme

Atom comes with both light and dark UI themes as well as several syntax themes. You are also

encouraged tocreate or fork your own theme.

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.

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 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: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 Commands menu to install

the apm and atomcommands.

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.

For example apm install [email protected] installs the 0.1.5 release of the 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.

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:

'.editor':

Page 4: Guia para atom

  'enter': 'editor:newline' '.mini.editor input':  'enter': 'core:confirm'

This keymap defines the meaning of enter in two different contexts. In a normal editor,

pressing enteremits 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, ~/.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.

You can open this file in an editor from the Atom > Open Your Keymap menu.

You'll want to know all the commands available to you. Open the Settings panel (cmd-,) and select

theKeybindings tab. It will show you all the keybindings currently in use.

Advanced Configuration

Atom loads configuration settings from the config.cson file in your ~/.atom directory, which

containsCoffeeScript-style JSON (CSON):'core':  'excludeVcsIgnoredPaths': true'editor':  'fontSize': 18

The configuration itself is grouped by the package name or one of the two core

namespaces: core andeditor.

You can open this file in an editor from the Atom > Open Your Config menu.

Configuration Key Reference

core

o disabledPackages: An array of package names to disable

o excludeVcsIgnoredPaths: Don't search within files specified by .gitignore

o ignoredNames: File names to ignore across all of Atom

o projectHome: The directory where projects are assumed to be located

o themes: An array of theme names to load, in cascading order

editor

o autoIndent: Enable/disable basic auto-indent (defaults to true)

o nonWordCharacters: A string of non-word characters to define word boundaries

o fontSize: The editor font size

Page 5: Guia para atom

o fontFamily: The editor font family

o 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

o normalizeIndentOnPaste: Enable/disable conversion of pasted tabs to spaces

o preferredLineLength: Identifies the length of a line (defaults to 80)

o showInvisibles: Whether to render placeholders for invisible characters (defaults to false)

o showIndentGuide: Show/hide indent indicators within the editor

o showLineNumbers: Show/hide line numbers within the gutter

o softWrap: Enable/disable soft wrapping of text within the editor

o softWrapAtPreferredLineLength: Enable/disable soft line wrapping at preferredLineLength

o tabLength: Number of spaces within a tab (defaults to 2)

fuzzyFinder

o ignoredNames: Files to ignore only in the fuzzy-finder

whitespace

o ensureSingleTrailingNewline: Whether to reduce multiple newlines to one at the end of files

o removeTrailingWhitespace: Enable/disable striping of whitespace at the end of lines (defaults totrue)

wrap-guide

o columns: Array of hashes with a pattern and column key to match the the path of the current editor to a

column position.

Quick Personal Hacks

init.coffee

When Atom finishes loading, it will evaluate init.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. If customizations become extensive, consider creating a

package.

You can open this file in an editor from the Atom > Open Your Init Script menu.

For example, if you have the Audio Beep configuration setting enabled, you could add the

following code to your ~/.atom/init.coffee file to have Atom greet you with an audio beep every

time it loads:

atom.beep()

Page 6: Guia para atom

This file can also be named init.js and contain JavaScript code.

styles.less

If you want to apply quick-and-dirty personal styling changes without creating an entire theme that

you intend to publish, you can add styles to the styles.less file in your ~/.atom directory.

You can open this file in an editor from the Atom > Open Your Stylesheet menu.

For example, to change the color of the cursor, you could add the following rule to

your ~/.atom/styles.less file:

.editor.is-focused .cursor {  border-color: pink;}

Unfamiliar with LESS? Read more about it here.

This file can also be named styles.css and contain CSS.