<commit_before># Configuring Atom

Atom provides a globally-available configuration database that both the core
system and extensions look to for user- and language-specific settings. A simple
use of the database is to set things like your font-size and whether you want
Atom to hide files ignored by Git. You can assign these settings by editing
`config.cson` in your `.atom` directory:

```coffeescript
core:
  hideGitIgnoredFiles: true
editor:
  fontSize: 18
```

NOTE: Currently, we only support the `.json` extension. CSON support is an
aspiration.

## Writing Config Settings

As shown above, the config database is automatically populated from `config.cson`
when Atom is started, but you can programmatically write to it in the following
way:

```coffeescript
# basic key update
config.set("editor.autosave", true)

config.get("fuzzyFinder.ignoredPaths").push "vendor"
config.update() # be sure to call `config.update` after the change
```

You can also use `setDefaults`, which will assign keys on the object at the given
only if they are currently undefined.

```coffeescript
config.setDefaults("editor", fontSize: 18, showInvisibles: true)
```

See the *configuration key reference* (todo) for information on specific keys you
can use to change Atom's behavior.

## Reading Config Settings

You can read a value from `config` with `config.get`:

```coffeescript
# read a value with `config.get`
@autosave() if config.get "editor.autosave"
```

Or you can use `observeConfig` to track changes from a view object.

```coffeescript
class MyView extends View
  initialize: ->
    @observeConfig 'editor.lineHeight', (lineHeight) =>
      @adjustLineHeight(lineHeight)
```

The `observeConfig` method will call the given callback immediately with the
current value for the specified key path, and it will also call it in the future
whenever the value of that key path changes.

Subscriptions made with `observeConfig` are automatically cancelled when the
view is removed. You can cancel config subscriptions manually via the
`unobserveConfig` method.

```coffeescript
view1.unobserveConfig() # unobserve all properties
```

You can add the ability to observe config values to non-view classes by
extending their prototype with the `ConfigObserver` mixin:

```coffeescript
ConfigObserver = require 'config-observer'
_.extend MyClass.prototype, ConfigObserver
```

## Scoped Config Settings (Not Yet Implemented)

Users and extension authors can provide language-specific behavior by employing
*scoped configuration keys*. By associating key values with a specific scope,
you can make Atom behave differently in different contexts. For example, if you
want Atom to auto-indent pasted text in some languages but not others, you can
give the `autoIndentPastedText` key a different value under a scope selector:

```coffeescript
# in config.cson
editor:
  autoIndentPastedText: true
scopes:
  ".source.coffee":
    editor:
      autoIndentPastedText: false
```

Scope selectors are placed under the `scope` key at the top-level of the
configuration file. The values you specify for keys under a selector will
override global values in that specific scope. Any basic CSS 3 selector is
permitted, but you should leave out element names to make your keys accessible
outside the view layer.

### Reading Scoped Config Settings

Use the `config.inScope` method to the read keys with the most specific selector
match:

```coffeescript
scope = [".source.coffee", ".meta.class.instance.constructor"]
config.inScope(scope).get "editor.lineComment"
```

Pass `.inScope` an array of scope descriptors, which describes a specific
element. This is frequently useful when you get the nested scopes for a position
in the buffer based on its syntax. You can also pass an actual DOM element
to use its nesting within the DOM as fodder for the scope selectors (†).

```coffeescript
config.inScope(fuzzyFinder.miniEditor).get("editor.fontSize")
```

`observeConfig` can take a scope as its first argument:

```
@observeConfig scope, "editor.autoIndentPastedText", -> # ...
```

†:  Matching DOM elements fits cleanly into this scheme, but I can't think of a
    use for it currently. Let's keep it in the back of our minds though.

# Themes (Not Yet Implemented)

## Selecting A Theme

Because Atom themes are based on CSS, it's possible to have multiple themes
active at the same time. For example, you might select a theme for the UI, and
another theme for syntax highlighting. You select your theme(s) in the core
preferences pane, by selecting themes from the available list and dragging them<commit_msg>Kill scoped config settings docs. This behavior is moved to `syntax`.<commit_after># Configuring Atom

Atom provides a globally-available configuration database that both the core
system and extensions look to for user- and language-specific settings. A simple
use of the database is to set things like your font-size and whether you want
Atom to hide files ignored by Git. You can assign these settings by editing
`config.cson` in your `.atom` directory:

```coffeescript
core:
  hideGitIgnoredFiles: true
editor:
  fontSize: 18
```

NOTE: Currently, we only support the `.json` extension. CSON support is an
aspiration.

## Writing Config Settings

As shown above, the config database is automatically populated from `config.cson`
when Atom is started, but you can programmatically write to it in the following
way:

```coffeescript
# basic key update
config.set("editor.autosave", true)

config.get("fuzzyFinder.ignoredPaths").push "vendor"
config.update() # be sure to call `config.update` after the change
```

You can also use `setDefaults`, which will assign keys on the object at the given
only if they are currently undefined.

```coffeescript
config.setDefaults("editor", fontSize: 18, showInvisibles: true)
```

See the *configuration key reference* (todo) for information on specific keys you
can use to change Atom's behavior.

## Reading Config Settings

You can read a value from `config` with `config.get`:

```coffeescript
# read a value with `config.get`
@autosave() if config.get "editor.autosave"
```

Or you can use `observeConfig` to track changes from a view object.

```coffeescript
class MyView extends View
  initialize: ->
    @observeConfig 'editor.lineHeight', (lineHeight) =>
      @adjustLineHeight(lineHeight)
```

The `observeConfig` method will call the given callback immediately with the
current value for the specified key path, and it will also call it in the future
whenever the value of that key path changes.

Subscriptions made with `observeConfig` are automatically cancelled when the
view is removed. You can cancel config subscriptions manually via the
`unobserveConfig` method.

```coffeescript
view1.unobserveConfig() # unobserve all properties
```

You can add the ability to observe config values to non-view classes by
extending their prototype with the `ConfigObserver` mixin:

```coffeescript
ConfigObserver = require 'config-observer'
_.extend MyClass.prototype, ConfigObserver
```

# Themes (Not Yet Implemented)

## Selecting A Theme

Because Atom themes are based on CSS, it's possible to have multiple themes
active at the same time. For example, you might select a theme for the UI, and
another theme for syntax highlighting. You select your theme(s) in the core
preferences pane, by selecting themes from the available list and dragging them
{'fraction_non_alphanumeric': 0.0713222357558533, 'fraction_numerical': 0.0014886994180538639, 'mean_word_length': 4.865079365079365, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7638614', 'n_tokens_mistral': 2047, 'n_tokens_neox': 1958, 'n_words': 987}