nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] snipping almost twenty lines out of the commenting code


From: Mike Scalora
Subject: Re: [Nano-devel] snipping almost twenty lines out of the commenting code
Date: Thu, 9 Jun 2016 19:09:24 -0600

>...
>> just last
>> night I was thinking that tabsize should be a per-file variable.
>
> Hm?  Why would you want that?
>...
> Benno

Right now tabsize is global (from the .nanorc) or overridable by
session (command line arg) but for me tabsize (and TABTOSPACES and
indent size) has been more file type and/or project related. CSS files
are sometimes two column indents with js files 4 column in the same
project. Some filetypes are tab-to-spaces while others are used with
tabs by convention.

I've spent a lot of time thinking about tabs and indents while I been
working on the code to make it more predictable and add undo support.

Proposal:

To allow filetype specific settings in .nanorc for tabsize, indentsize
& tab-to-spaces:

  # global defaults (and for legacy and COLORless support)
  set tabsize 8
  set indentsize 4
  set tabstospaces

  # syntax specific settings
  syntax "c" "\.[ch]$"
  tabsize 8
  indentsize 4

  # or
  extendsyntax "python" tabsize 2
  extendsyntax "python" indentsize 2

I'm not quite sure what the syntax should be for setting tabstospaces
on/off for a syntax without breaking compatibility.

  syntax "html" "\.html$"
  tabstospaces

  extendsyntax "css" notabstospaces

For the command line, I've implement a new --indentsize and added
support to --tabsize to optionally take two values with a comma for
tabsize,indentsize.

nano -T 8,4 src/text.c

FYI, if indentsize isn't set it defaults to tabsize.

With the other patch I'm working on for custom rcfile(s) on the
command line, you get a reasonable way to manage settings that are
project specific.

-Mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]