bugGNU nano - Bugs: bug #61947, [Wish] add support for...


You are not allowed to post comments on this tracker with your current authentication level.

bug #61947: [Wish] add support for editor-config files

Submitter:  Mike Frysinger <vapier>
Submitted:  Thu 27 Jan 2022 09:32:48 PM UTC
Votes: 1
Severity:  1 - Wish Status:  None
Assigned to:  None Open/Closed:  Open

Sat 29 Jan 2022 06:27:16 PM UTC, comment #4: 

kind of seems like editing files is the target area of nano.  it also doesn't seem unusual considering how many editors already support it, or have a framework for supporting it, or support embedding their own config settings in a file.  nano stands out as an inflexible editor here with literally no alternative.

adding another option to control the setting doesn't seem like a big deal.

Mike Frysinger <vapier>
Group Member
Sat 29 Jan 2022 02:35:18 PM UTC, comment #3: 

I understand that the feature is meant for allowing nano to be used interchangeably with other editors, for letting all those editors automagically treat and present the files of each project in the intended way.  But I don't see that as the target area of nano, and will not work on this.  And even if a complete patch set were supplied, I don't think I would want to apply it.

(Also, it would require an extra option to enable this behavior, because for most users of nano the searching for .editorconfig files would be a waste of time.)

Benno Schulenberg <bens>
Group administrator
Fri 28 Jan 2022 07:15:08 PM UTC, comment #2: 

the tab/indent options are actually the ones i had my eye on.  i work on many diff codebases that have very diff tab/indent styles, and it's a huge pita to constantly remember to specify the right -T option when flipping between them.  and yes, it means if i have a multibuffer session viewing diff files with diff styles, then it still doesn't work well, and i have to have different nano instances running.

the point of supporting this config file format isn't so much for nano users to do things locally in their own personal stuff, but to leverage the configs being checked in to projects that you contribute to.  if it were scoped narrowly like that ("this is just a way for nano users to write ~/.nanorc"), i'd agree that the format isn't worth the effort.  but when it's scoped to "projects are using this to export settings in an editor-independent way, and all contributors to the projects get the right setup for free", i think it takes on a different light.

Mike Frysinger <vapier>
Group Member
Fri 28 Jan 2022 04:40:54 PM UTC, comment #1: 

(I learned about editorconfig twelve months ago, when someone mentioned it on nano-devel.  I glanced at it, and thought it too much trouble and not worth the effort.)

Currently, editorconfig knows just seven keys.

  • The `charset` key nano cannot support, being fully geared to UTF-8 or plain Latin-1, determining what to do from the locale.  It doesn't handle any other character set.

  • Nano doesn't know how to `trim_trailing_whitespace` upon saving a file.  It would be fairly simple to implement, but it would require a new option, because reusing 'trimblanks' for this... I'm not sure that would be a good idea.

  • `insert_final_newline` is what nano calls 'nonewlines', with inverted logic.  But it is a global option, and would need to become per-buffer.

  • `end-of-line` is the only thing that nano already has on a per-buffer basis, and would be trivial to support.

  • `tabwidth` is what nano calls 'tabsize'.  In nano it is a global option, and would need to become per-buffer.

  • `indent_size` (`indent_step` would have been a better name) is something that nano does not know.  In nano the indent step is always a tab.

  • `indent_style` is what nano implements with 'tabtospaces', where 'unset' equals the style 'tab', and 'set' equals the style 'space'.  Nano's option is global, except when a syntax specifies 'tabgives', then it is per file type.

So, even just supporting the key-value pairs of editorconfig.org would require substantial changes in nano, in how it stores and applies some of its options.  And for supporting the actual .editorconfig files, a large additional piece of code would be required, to search through the directory tree and then parse each found file and see if it contains something for the current buffer, and then parse the options and translate them to nano's ones...  Pfff!

Also, I don't see on editorconfig.org what the editor is to do when `indent_size` is different from `tab_width`.  I would have expected there to be an indent style called 'mixed', where the indent step is half a tab -- the style that nano used to use, and that ncurses still uses -- and the regex files in gnulib use an indent step of a quarter tab.  Of course, these are awkward styles, but they exists in various places, and if the editor can handle styles, then it should handle these too.

So, in short: too much trouble, plus a whole new dependency, for vanishingly little gain.

Benno Schulenberg <bens>
Group administrator
Thu 27 Jan 2022 09:32:48 PM UTC, original submission:  

came across this today:

an editor-independent ini config file for declaring things like indent style & size on a per-file basis

thoughts on supporting it in nano ?

if you're looking for an iniparser library, i've used this one in C before and it's nice -- easy to use, and small.

Mike Frysinger <vapier>
Group Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by nl6720 (Voted in favor of this item)
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by vapier (Submitted the item)

    There is 1 vote so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-02-18 nl6720 Carbon-Copy- Added nl6720
    2022-01-28 bens Summarysupport for editor-config files [Wish] add support for editor-config files

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code