Make the Matlab text editor wrap text at a given column width without implementing wrap comments

MATLABtext-editors

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.

Best Answer

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.