Using macro implementation in UltraEdit to set selected code as a comment

Source: Internet
Author: User
Tags comments first row ultraedit
Selected
Recently because of machine problems, began to use UltraEdit, used a few times, now carefully pondering a handful, only to find this editor true too good, powerful, really is the coding of the weapon, currently UE has been published to V11, has been supported by the default C # The coloring of the language (which is one of the important reasons why I choose UE). In the evening when debugging a C # applet, found that the UE has a code for debug is not the area, is the lack of code block or line of code comment function, especially the UE is not a complete development IDE, the lack of such a feature really makes debugging is not convenient, so I have to manually at the beginning of the line to add "//", or to some specific blocks of code to add the end of "*" and "* *", unlike in VB or vs.net directly select the line you want to become a comment, click on the toolbar button on OK, unfortunately AH.

Fortunately, the UE support macros, so k UE macro syntax, small make a bit, the effect is good, hehe

The following is a macro statement that is set to comment on the code block, before use, you need to select the code block that you want to annotate, and the top and bottom positions can be anywhere in the first row, here with "*" and "* *", which would have been expected to be done on each line plus This is like vs.net, unfortunately the UE macro does not support variables, so did not think of a good way to achieve.

Insertmode
Columnmodeoff
Hexoff
Unixreoff
Ifsel
Startselect
Key End
Cut-and
Key Home
Ifcolnum 1
Key End
EndIf
"/* "
Timedate
"
"
Key End
Paste
Key End
"
"
Timedate
" */"
EndIf

Here is the macro code that uncomment the code, and you also need to select the code block that you want to uncomment, and the selected head and tail position can be anywhere in the first row.

Insertmode
Columnmodeoff
Hexoff
Unixreon
Ifsel
Cut-and
"~@#"
Paste
Deleteline
"~@@#"
Top
Find "~@#"
Deleteline
Find "~@@#"
Delete
EndIf

Here is the macro code that adds "//" comments to a single line of code, which is much simpler.:-)

Insertmode
Columnmodeoff
Hexoff
Unixreoff
"~@#"
Key Home
Ifcolnum 1
Else
Key Home
EndIf
"//"
Find "~@#"
Delete

The last is the macro code that unlocks the line annotation:

Insertmode
Columnmodeoff
Hexoff
Unixreoff
"~@#"
Key Home
Ifcharis "/"
Delete
Ifcharis "/"
Delete
Else
"/"
EndIf
EndIf
Find "~@#"
Delete

You do not need to select rows for comments and comments on rows, only the cursor falls on this row. To mention here, a macro that would otherwise be annotated for a row would be written in the following form:

Insertmode
Columnmodeoff
Hexoff
Unixreoff
"~@#"
Key Home
Ifcharis "/"
Key Right Arrow
Ifcharis "/"
Key Right Arrow
Deletetostartofline
EndIf
EndIf
Find "~@#"
Delete

This is a better readability, realize logic is also reasonable, let people faint is that I use the Chinese version of UEV11, does not support key right arrow, if you use the macro recording function, you get the key arrow →, but if you manually write key right arrow →, the system on the error, said no this command, Really let a person not its solution ~ ~ ~ Here because there are some logic, so can not record, only handwriting.



Reference:
Ultraedit Offical Forum:http://www.ultraedit.com/index.php?name=forums&file=index&c=1ultraedit Help Document. Http://manni-heumann.de/macro_ref_chm.zip


P.s. For a long time did not get so late, fortunately, no one in the dormitory tonight, outside rain is still under, the weather also cool some.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.