paazmaya.fi

The Website of Juga Paazmaya | Stories about Web Development, Japanese Martial Arts, Hardware prototyping and travelling

Taking EditorConfig in use with Atom, Brackets, NotePad++ and Sublime Text

EditorConfig is essentially a single configuration file to be used in the root of a project shared between developers and enables them to use the same code editor settings between different editors and development environments.

The configuration shared via .editorconfig file usually looks something similar to what is shown below. All available configuration properties are listed at the EditorConfig documentation, however not all plugins support them, hence there is a list of “supported properties” between different plugins and extensions.

# editorconfig.org
root: "true"

[*]
indent_style: space
indent_size: 2
end_of_line: lf
charset: utf-8
trim_trailing_whitespace: true
insert_final_newline: true

As can be seen from the above example, that the contents of the file are written in INI format.

Popular code editors, such as listed on this page, have plugins and extensions available from the open source community in order to support EditorConfig features. In most cases taking the plugin or extension in use, is simple as enabling it via the given editors configuration wizard.

Below are detailed instructions on how to do this with some of the trendy code editors, such as Atom, Brackets and Sublime Text. NotePad++ is included also, even though it is no longer being trendy during this era of bleeding edge developers (I am still using it for certain tasks).

Please note that in some cases the word Preferences can be Settings instead, depending of the operating system and its version, as well as English locale.

Also, throughout this tutorial, the proxy server address example proxy.domain.name:8888 is being used, in which 8888 is the port number, and the proxy.domain.name is the server address. Please substitute with the correct values of your possible proxy server if needed.

Atom

Atom has a graphical interface for installing packages from its package repository. The interface can be found from Preferences > Install. Search for “EditorConfig” and the EditoConfig plugin for Atom should appear in the packages list.

With Atom it is also possible to install and manage plugins via command line, for example:

apm install editorconfig

If needed, the proxy settings can be viewed and changed via command line as well:

# Read existing HTTP proxy value
apm config get proxy

# Set the HTTP proxy value
apm config set proxy "https://proxy.domain.name:8888"

In case the command apm is not available at the terminal for some reason, make sure to install them via main menu of Atom editor, Install Shell Commands.

The plugin for Atom adds the support for recognising the .editorconfig file and gives syntax highlighting for it. There are few options available in the Preferences > Packages > editorconfig page.

Brackets

For installing plugins, Brackets has the Extension Manager, found from the right sidebar or from the menu File > Extension Manager. The search field in the upper right area allows to quickly filter the appearing list of available extensions and to find the EditorConfig extension for Brackets. Installation is as easy as clicking the “install” button.

If needed, the proxy settings can be altered via preferences file, which can be opened via Debug > Open Preferences File. It is a JSON file which might be empty by default. Below is an example what to add there:

{
  "proxy": "https://proxy.domain.name:8888"
}

After a successful installation, the following row gets added to the Preferences File:

  "brackets-editorconfig.enabled": true

NotePad++

The plugin for NotePad++ certainly has well written instructions on how to install the given plugin, hence there is no reason for me to try to do anything better. Instead I suggest to visit the plugin GitHub page for reading them.

Sublime Text

Make sure that Package Control has been installed in the Sublime Text instance.

Setup proxy settings if needed, from Preferences > Package Settings > Package Control > Settings - User, which opens a JSON file to be edited.

  "http_proxy": "proxy.domain.name:8888"

Install the EditorConfig plugin. Once the Package Control has been installed, it can be accessed via Preferences > Package Control, or with a shortcut key combination shift + cmd + p and typing “install”

Once the available packages list has been downloaded, it will be shown as a drop down list that can be filtered by writing the package name. Start typing “EditorConfig” and the given plugin should appear in the list and be focused, hence pressing enter on the keyboard will select it for installation.

Once the plugin has been installed and the Sublime Text editor has been restarted, the plugin should find any .editorconfig in the opened directory and use it. No additional configuration needed.