Re: block comment
Chris Allegretta <[email protected]>
| Newsgroups | gmane.editors.nano.general |
|---|---|
| Message-ID | <CAJqk+=NPQM+EfWWPO+QoiEaJv1u4+Gddt5UhYaxQ9b7v4m6mpg@mail.gmail.com> |
Hello higuita, I agree with Benno that this is something nano can't easily do but should do down the road. How I tend to do this when I need to is: - Move to the first line I want to start commenting - Hit Meta-R, Meta-E (to enable a regex search and replace) - Enter ^ (to match beginning of the line) and hit enter - Enter the comment identifier(e.g. // or #) and hit Enter Say Y for all the lines I want to comment out. Hit ^c when done Usually it gets me through what I need. Hope this helps! On Sun, Nov 1, 2015 at 6:15 AM, Benno Schulenberg <[email protected]> wrote: > > On Sat, Oct 31, 2015, at 06:04, higuita wrote: >> I would like to know if nano can do comment block operations, like >> selecting several lines and then "comment out" all those >> lines. > > Hm. You can do that by using a regex search-and-replace on > a selected piece of text. I know, that is a lot of keystrokes, > but what you're asking (prefixing lines with some character) > is quite specific -- indenting on the other hand is used in > any kind of text. > > What nano needs is the ability to define and execute macros, > so that you can assign the above long string of keystrokes > to a certain key combo. Lacking that, it would be nice if > nano could execute an external program on a selected piece > of text. It can already run a spell checker on such a piece > of text; maybe this can be generalized to be able to run any > kind of program... > > Hmmm. Maybe you can "abuse" the speller to do what you want. > Write a little sed script that prefixes a given file with the > required character, then add 'set speller "prefixit.sh"' to > your .nanorc, and then ^T should do what you want. > > Benno > > -- > http://www.fastmail.com - Or how I learned to stop worrying and > love email again > > > _______________________________________________ > Help-nano mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/help-nano