I believe that anyone who has read large source code knows source insight.
Today, I spent some time organizing two macros and using the shortcut key to generate code comments. Very convenient.
Go to the topic!
① Open source insight> Project> open project> base> OK
② Open the utils. Em macro file
③ Add the following macros (similar to C functions)
// Multi-line code comment macro multilinecomment () {hwnd = getcurrentwnd () // obtain the text window selection = getwndsel (hwnd) // obtain the selected object lnfirst = getwndsellnfirst (hwnd) // obtain the first line number lnlast = getwndsellnlast (hwnd) // obtain the last line number hbuf = getcurrentbuf () // obtain the current window text Ln = lnfirst while (LN <= lnlast) {// retrieve the row Buf = getbufline (hbuf, LN) corresponding to ln // skip the empty row if (BUF = "") {Ln = ln + 1 continue} // If commented out, uncomment if (strmid (BUF, 0, 1) = "/") {If (strmid (BUF, 1, 2) = "/" ) {Putbufline (hbuf, LN, strmid (BUF, 2, strlen (BUF) // adjust the cursor position selection. ichfirst = selection. ichfirst-2; selection. ichlim = selection. ichlim-2 ;}} if (strmid (BUF, 0, 1 )! = "/") {// Add comments putbufline (hbuf, LN, CAT ("//", Buf) // adjust the cursor position selection. ichfirst = selection. ichfirst + 2; selection. ichlim = selection. ichlim + 2;} ln = ln + 1} // the final result is setwndsel (hwnd, selection )}
// Generate a single row comment macro singlelinecomment () {hwnd = getcurrentwnd () // obtain the text window selection = getwndsel (hwnd) // obtain the selected object lnfirst = getwndsellnfirst (hwnd) // obtain the row number hbuf = getcurrentbuf () // obtain the current window text // obtain the current time sztime = getpolicime (1) hour = sztime. hourminute = sztime. minutesecond = sztime. secondday = sztime. daymonth = sztime. monthYear = sztime. yearif (day <10) szday = "0 @ day @" elseszday = dayif (month <10) szmonth = "0 @ month @" elseszmonth = month // name szmyname = "yarkey" Buf = getbufline (hbuf, lnfirst) // yarkey @ 20130321 remark: commentadd = "// @ szmyname \@year @ szmonth @ szday @ remark:" commentaddlen = strlen (commentadd) putbufline (hbuf, lnfirst, CAT (BUF, commentadd) selection. ichfirst = selection. ichfirst + commentaddlen; selection. ichlim = selection. ichlim + commentaddlen; setwndsel (hwnd, selection )}
④ After adding the file, press Ctrl + S to save the file.
⑤ Open your project> Option> key assignments to find:
MACRO: multilinecomment
MACRO: singlelinecomment
6. Click assign new key...
Now, set the shortcut keys you are used! ^
It can be a combination of ALT, Ctrl, and so on.