Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Unix text editor issues (was: st: mulitple comments using // and #d;)

From   "Michael S. Hanson" <>
Subject   Unix text editor issues (was: st: mulitple comments using // and #d;)
Date   Sat, 2 Sep 2006 12:06:06 -0400

Comments on two related messages, regarding the editing of Stata files on Unix, follow:

On Sep 1, 2006, at 5:07 PM, SamL wrote:


Second, those who write code on a unix box with few bells and whistles
(e.g., color) are seriously advantaged by being able to specify their own
I write code on a Unix box, and I'm afraid I don't follow your logic. There exist Unix editors that offer syntax highlighting -- see the Text Editors with Stata FAQ:


Even the lowly nano editor -- which I must confess I use frequently in Unix -- offers syntax highlighting:


If you haven't yet tried a text editor with syntax highlighting, I think you'll be pleasantly surprised by the productivity boost.

Beyond that, I personally do not find it easier to recognize that a line is continuing by the absence of ; than by the presence of /// -- but of course, YMMV. I find that aligning all /// code in the far right-hand column, along with indenting continuing lines, makes it very easy to skim my code and see exactly which commands are on multiple lines -- whether or not syntax highlighting is enabled.

On Sep 1, 2006, at 5:46 PM, Dimitriy V. Masterov wrote:

The reason that I care about this issue that I reserve "/*...*/"
comments for substantive comments, and use a Vim text editor script to
comment out parts of code using "//". This is why using ";" at the end
of the last line is not an option: it makes toggling comments
impossible. For this purpose, however,

* comment;
* comment;

works like a charm. The "//" behavior is still a mystery.
As I hinted above, I am not a vim (nor emacs) connoisseur / evangelist. However, I suspect it should be possible, through some clever use of regexp (interacting with ruby, perl, etc.?) to create a command that toggles in the way you need with the // notation. Someone with much more experience with vim will have to help you there.

But I still would aver that it is easier to avoid using -delimit- altogether, and toggle all your comments with // -- including those in the middle of a line. One additional advantage of using /// for line continuations is that it also serves as a comment delimiter for any text placed after it on a line. I use this approach to place comments in the midst of 10 - 15 line graph commands, in order to later remind myself (or my RAs) why a particular graph option is specified the way it is. Hope this helps.

-- Mike

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index