[Top][All Lists]

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

Re: [Help-nano] getting nicely justified comments in an easy way

From: Seb
Subject: Re: [Help-nano] getting nicely justified comments in an easy way
Date: Fri, 29 Mar 2019 22:50:45 +0100 (CET)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)

Hi Benno,

Thanks for the information!

Start nano with --quotestr="^(# |// )". When you want to write a comment, you enable automatic hard-wrapping with M-L and start your comment with either "# " or "// ", and then type away your text. When you've finished, you use <Shift+Up> to select the whole comment (but make sure the selection does not begin before the first comment line), and then type ^J. Et voilà: the comment is justified and all lines start with the same character sequence as the first.

Nice feature. Hopefully the upcoming new Debian stable will include a version of nano compatible with it.

The justify command will recognize any character (or character group) that is in quotestr as a comment-introducer. See man nanor(5). You can customize it if you want, like adding a mandatory trailing space, as done above.


Yes, you can toggle softwrap with: M-$. On an American keyboard this is somewhat awkward: Alt+Shift+$, but on a French keyboard it seems the $ is on the first, unshifted plane, next to the Enter key? So it should be easy to type. Or does the keystroke not work for you?

Thanks again.
(I am French indeed but I use a qwerty keyboard, which I find more convenient for typing code. Combinations with the Alt keys redefine the keyboard to produce latin1 symbols. In nano, I use Esc, eg Esc-L for long lines. Esc-$ is OK.)

* Oh, I almost forgot, pico had a nice feature within Pine (before
  Alpine): if I put a "*" at the beginning of a line, then a space and
  then some text, the following line would automagically start with
  two spaces, as in this paragraph. And it was compatible with ^J, too.

Any chance of reproducing this clean appearance, or is it in the same category as introducing a '#' after a \n?

Kind regards,

reply via email to

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