Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the behavior of the commenting function so that the location of the % respect the indentation?

Tags:

matlab

When I comment the line 5 using ctrl+R or clicking on the "comment" icon:

enter image description here

I get: enter image description here

I would like to have instead: enter image description here

How to achieve that?

like image 815
Franck Dernoncourt Avatar asked Jan 26 '14 18:01

Franck Dernoncourt


1 Answers

This is not a full solution, but a workaround for low levels of indentation.

  1. Apply all your comments
  2. Use the auto indentation button

The comment will now be at the right place, but unfortunately the space after the comment stays intact. However, for something like the code below you may like it:

for t=1:10
%  t
end

After removing comments, you can simply use the auto indentation feature again and the code will look proper again.

like image 103
Dennis Jaheruddin Avatar answered Oct 02 '22 09:10

Dennis Jaheruddin