nirix / atom-editor-settings

Atom package to add support for editor settings per-language, file extension and directory.
https://atom.io/packages/editor-settings
MIT License
21 stars 10 forks source link

editor-settings package

Adds support for per-language, file extension and directory editor settings.

How to use it

Global configuration

Open a file you'd like to configure the settings for, ensure that its grammar is correctly detected (look at the grammar selector in the bottom right corner of Atom or press ⌃⇧L) and open the command palette (⌘⇧P or ⌃⇧P). Type Editor Settings: Open Grammar Config and press ⏎.

A new .cson file for the grammar of the file you had open should show with the current editor settings for the given grammar. Edit it and save.

The language/grammar settings files are saved in the grammar-config directory located in the main Atom configuration directory with a lower-case file name format.

For example, the config file for CoffeeScript would be coffeescript.cson.

Local configuration

For a per directory based configuration, you can create a .editor-settings file in the concerned directories.

Supported settings

The API for setting editor settings currently only supports:

Example configuration

The following example is for CoffeeScript, it sets the tab length to 2, but if the file extension is .cson it sets it to 4.

tabLength: 2
extensionConfig:
  cson:
    tabLength: 4

Experimental settings:

fontFamily: 'Source Code Pro'
grammarConfig:
  'GitHub Markdown':
    fontFamily: 'monospace'

Example project and directory configuration

All options not nested under a specific grammar are used for all grammar and extensions.

tabLength: 2
themes: ['atom-light-ui', 'atom-light-syntax']
grammarConfig:
  'PHP':
    tabLength: 4
    softTabs: true
    extensionConfig:
      phtml:
        softTabs: false

Features

Planned

If there is a feature you'd like added simply create an issue or fork and implement it and send a pull request.