• Blog
  • Info Support
  • Career
  • Training
  • International Group
  • Info Support
  • Blog
  • Career
  • Training
  • International Group
  • Search
logo InfoSupport
  • Latest blogs
  • Popular blogs
  • Experts
      • Alles
      • Bloggers
      • Speakers
  • Meet us
  • About us
    • nl
    • en
    • .NET
    • Advanced Analytics
    • Agile
    • Akka
    • Alexa
    • Algorithms
    • Api's
    • Architectuur
    • Artificial Intelligence
    • ATDD
    • Augmented Reality
    • AWS
    • Azure
    • Big Data
    • Blockchain
    • Business Intelligence
    • Cloud
    • Code Combat
    • Cognitive Services
    • Communicatie
    • Containers
    • Continuous Delivery
    • CQRS
    • Cyber Security
    • Dapr
    • Data
    • Data & Analystics
    • Data Science
    • Data Warehousing
    • Databricks
    • DevOps
    • Digital Days
    • Docker
    • eHealth
    • Enterprise Architecture
    • Hacking
    • Infrastructure & Hosting
    • Innovatie
    • Integration
    • Internet of Things
    • Java
    • Machine Learning
    • Microservices
    • Microsoft
    • Microsoft Bot Framework
    • Microsoft Data Platform
    • Mobile Development
    • Mutation Testing
    • Open source
    • Pepper
    • Power BI
    • Privacy & Ethiek
    • Python
    • Quality Assistance & Test
    • Quality Assurance & Test
    • Requirements Management
    • Scala
    • Scratch
    • Security
    • SharePoint
    • Software Architecture
    • Software development
    • Software Factory
    • SQL Server
    • SSL
    • Start-up
    • Startup thinking
    • Stryker
    • Test Quality
    • Testing
    • TLS
    • TypeScript
    • Various
    • Web Development
    • Web-scale IT
    • Xamarin
    • Alles
    • Bloggers
    • Speakers
Home » EditorConfig; Share your editor settings
  • EditorConfig; Share your editor settings

    • By Daan van Berkel
    • Various 7 years ago
    • Various 0 comments
    • Various Various
    EditorConfig; Share your editor settings

    Table of Contents

    • 1. EditorConfig
      • 1.1. Properties
      • 1.2. Glob patterns
      • 1.3. .editorconfig
      • 1.4. Plugins
    • 2. Conclusion

    Developers have strong opinions on all matters related to software
    development. It is not uncommon to hear heated discussions on the
    placement of braces or how to indent blocks of code.

    Responsible teams quickly settle these disputes. The particular
    choices hardly ever influence the code in a fundamental way. What is
    far more important is that a code is written in a consistent style.

    EditorConfig can help maintain a consistent style in a team, even when
    developers choose to use their favourite tools.

    1 EditorConfig

    EditorConfig is

    a file format for defining coding styles and a collection of text
    editor plugins that enable editors to read the file format and adhere
    to defined styles.

    EditorConfig uses a INI format to specify the properties of groups of
    files. An example .editorconfig file is given below.

    root = true
    
    [*]
    charset = utf-8
    end_of_line = lf
    insert_final_newline = true
    
    [*.js]
    indent_style = space
    indent_size = 4
    
    [*.html]
    indent_style = tab
    
    [src/{main,test}/java/**.java]
    indent_style = tab
    tab_width = 4
    

    1.1 Properties

    EditorConfig allows the following properties to be specified.

    indent_style “tab” or “space”
    indent_size a whole number
    tab_width a whole number
    end_of_line “lf”, “cr”, or “crlf”
    charset “latin1”, “utf-8”, “utf-8-bom”, “utf-16be” or “utf-16le”
    trim_trailing_whitespace “true” or “false”
    insert_final_newline “true” or “false”
    root special property that should be specified at the top of the file outside of any sections. Set to “true” to stop .editorconfig files search on current file.

    Let’s say you want to indent blocks with four spaces. This can be
    specified with the following properties

    indent_style = space
    indent_size = 4
    

    Although it may seems to be a meager set of properties, it prevents a
    lot of common inconsistencies when working with a team on the same
    code base.

    1.2 Glob patterns

    You specify to which files the properties should apply by providing a
    glob pattern. The glob patterns that EditorConf understands are

    * Matches any string of characters except path seperators (/)
    ** Matches any string of characters
    ? Matches a single character
    [name] Matches a single character in name
    [!name] Matches a single character not in name
    {s1,s2,s3} Matches any of the string given

    For example, to select all java files in any package under the
    standard maven directory structure, one could use the following
    pattern

    src/{main,test}/java/**.java
    

    1.3 .editorconfig

    The convention is to place the definitions in a .editorconfig
    file. When tools and plugins try to determine what settings hold for a
    certain file, they will look in the directory of the file and all the
    parent directories until either the root of the file system is
    reached, or a .editorconfig with the property root=true is
    found.

    All the .editorconfig files found are used. .editorconfig files
    closer to the file under inspection take precedence.

    1.4 Plugins

    It is one thing to be able to define the code style, it is an other
    thing to automatically enforce the definitions. Lucky there is a
    growing list of plugins that do just that.

    Chances are that you can find your favourite editor in the list of
    currently available plugins.

    1. Appcode
    2. Atom
    3. Brackets
    4. Code::Blocks
    5. Emacs
    6. Geany
    7. Gedit
    8. GitHub
    9. IntelliJ
    10. Jedit
    11. Notepad++
    12. PhpStorm
    13. PyCharm
    14. RubyMine
    15. SublimeText
    16. Textmate
    17. Vim
    18. Visual Studio
    19. WebStorm

    2 Conclusion

    Being able that automatically enforces the style definitions over a
    large range of editors is an indespensible tool for a modern day
    software development team. EditorConfig provides excellent support for
    that use case.

    Share this

Daan van Berkel

View profile

IT Training at Info Support

Which training fits you?

Consultancy

Consultancy

Related blogs

  • Video Conferencing en OBS Studio koppelen: online prese…

    Video Conferencing en OBS Studio koppelen: online prese… Maaike Brouwer - 1 year ago

  • Verantwoordelijkheid pakken in jouw eigen persoonlijke …

    Verantwoordelijkheid pakken in jouw eigen persoonlijke … Stephan Versteegh - 1 year ago

  • Tips voor als je gaat afstuderen

    Tips voor als je gaat afstuderen Bart Renders - 2 years ago

Related downloads

  • Beslisboom voor een rechtmatig ‘kopietje productie’

  • Klantreferentie: Remmicom zet wetgeving om in intellige…

  • Klantreferentie RDW: Samenwerken voor veilig en vertrou…

  • Klantreferentie BeFrank: Strategische IT voor een innov…

  • Wie durft te experimenteren met data in de zorg?

Related videos

  • mijnverzekeringenopeenrij.nl

    mijnverzekeringenopeenrij.nl

  • Winnaar | Innovation Projects 2017

    Winnaar | Innovation Projects 2017

  • Explore | Info Support & HAN & Poliskluis

    Explore | Info Support & HAN & Poliskluis

  • LifeApps bij HagaZiekenhuis

    LifeApps bij HagaZiekenhuis

  • Info Support | Bedrijfsfilm

    Info Support | Bedrijfsfilm

Nieuwsbrief

* verplichte velden

Contact

  • Head office NL
  • Kruisboog 42
  • 3905 TG Veenendaal
  • T +31 318 552020
  • Call
  • Mail
  • Directions
  • Head office BE
  • Generaal De Wittelaan 17
  • bus 30 2800 Mechelen
  • T +32 15 286370
  • Call
  • Mail
  • Directions

Follow us

  • Twitter
  • Facebook
  • Linkedin
  • Youtube

Newsletter

Sign in

Extra

  • Media Library
  • Disclaimer
  • Algemene voorwaarden
  • ISHBS Webmail
  • Extranet
Beheer cookie toestemming
Deze website maakt gebruik van Functionele en Analytische cookies voor website optimalisatie en statistieken.
Functioneel
Altijd actief
De technische opslag of toegang is strikt noodzakelijk voor het legitieme doel het gebruik mogelijk te maken van een specifieke dienst waarom de abonnee of gebruiker uitdrukkelijk heeft gevraagd, of met als enig doel de uitvoering van de transmissie van een communicatie over een elektronisch communicatienetwerk.
Voorkeuren
De technische opslag of toegang is noodzakelijk voor het legitieme doel voorkeuren op te slaan die niet door de abonnee of gebruiker zijn aangevraagd.
Statistieken
De technische opslag of toegang die uitsluitend voor statistische doeleinden wordt gebruikt. De technische opslag of toegang die uitsluitend wordt gebruikt voor anonieme statistische doeleinden. Zonder dagvaarding, vrijwillige naleving door uw Internet Service Provider, of aanvullende gegevens van een derde partij, kan informatie die alleen voor dit doel wordt opgeslagen of opgehaald gewoonlijk niet worden gebruikt om je te identificeren.
Marketing
De technische opslag of toegang is nodig om gebruikersprofielen op te stellen voor het verzenden van reclame, of om de gebruiker op een website of over verschillende websites te volgen voor soortgelijke marketingdoeleinden.
Beheer opties Beheer diensten Beheer leveranciers Lees meer over deze doeleinden
Voorkeuren
{title} {title} {title}