Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a text file with a long comment that would normally extend off-screen to the right. Is there a way to configure the Matlab Editor to wrap this text when it extends beyond the current window size other than the automatic wrap comments feature?

There are two reasons I don't want the editor automatically inserting newlines whenever I type too long of a comment:

  • Wrap comments fixes the wrap at a given column width, but I work on various screens and change my text editor window sized based on context, so the width of my window isn't constant. A fixed wrap width for one situation means it will be too wide or narrow for another.
  • I like to use newlines in comments to indicate a new paragraph or thought, not just because I've run out of space. This means my SLOC count isn't as inflated by verbose comments. Each separate comment idea counts as 1, even if it's longer than X characters.

I've found a way to do this in Sublime Text 2 (and I'm sure lots of other text editors support it as well), but once I'm in debugging mode I use the Matlab Editor because of it's IDE functionality (and because I have it and won't have to fight IT to install something else). So I'm not looking for recommendations for better text editors, just a way to make this one work the way I want.

share|improve this question
Maybe some of the techniques for integrating Matlab with emacs will help make it work with another editor:… – Jonas Sep 13 '11 at 23:44
@Jonas. I suppose the eventual appearance of an EMACS will work answer was inevitable, but for me, given that I rarely program, the learning curve for EMACS isn't worth the trouble. – Adam Wuerl Sep 17 '11 at 0:41
up vote 1 down vote accepted

I guess it is not what you are hoping for, but at the moment there is no possibility to configure the matlab editor to wrap comments based on the screen size.

To achieve this effect, you can use an alternate editor as @Jonas described in his comment.

However, it was mentioned on Undocumented Matlab that the matlab editor is Java based. In light of this, I imagine that it must be possible to define a shortcut as follows:

  1. Get the current width of the editor window
  2. Calculate the desired character limit
  3. Update the relevant setting

Unfortunately, I can only help with the second step which won't get you very far on its own. Once created, this would basically make it work with the click of a button.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .