Commenting and indenting code - hakakou/optiperl GitHub Wiki
About commenting blocks of code
Often while developing, you may want to comment blocks of code for testing purposes. OptiPerl provides a way to do so from the Edit menu:
- Comment in will add a # character in front of each line of the selected block.
- Comment out will remove the first # character from each line of the selected block.
- Toggle comment will add or remove the first # character of each line, depending if it's already present.
Commenting HTML code
If you try to comment in or out blocks of html code found in multiline q statements or here-documents, then the html comment standard is used.
Indenting blocks of code
The indent / unindent commands insert or remove spaces in front of the selected block, depending on the setting of the Options dialog / Tab handling / Block indent amount. These commands are on the Edit toolbar, and their default shortcut is Ctrl - or +. If you use these commands a lot, you may also want to move them to the edit menu using the customize menus dialog.
How indenting fills in lines
Depending on whether "Use tab character" is enabled in Options / Tab handling, the filling will be only spaces or a sequence of tabs and some needed spaces to increase indent according to the block indent amount.
If you are using tabs in your code, and want to convert a file that was indented using spaces to tabs, select the entire file, click once "increase indent" and then once "decrease indent". This will replace all starting sequences of spaces into tabs and a few spaces to match the previous indenting.
Included with OptiPerl is a user tool, to insert a tab character in front of each line.