Tips for using source insight

Source: Internet
Author: User

Source insight is a powerful code viewing tool that supports excellent scalability. The following describes two extension cases.

1. Quickly open the directory where the current file is located. This function is similar to the easyshell plug-in of eclipse. It is able to quickly locate the directory where the file is located, which is very beneficial when viewing code.

First, choose option> Custom commands]

The key to customizing the command name for personal use is to enter assumer.exe % d,

Set the shortcut key Ctrl + T

You can also add custom commands to the menu.

After this setting, you can press Ctrl + T to directly open the directory where the current file is located.

2. Compared with the fast and convenient comments and reverse comments in eclipse, Si is a little rough and inconvenient. However, you can use custom macro blocks to improve this situation.

First, open projcet-> open project, select base, you can see the utils. Em file, add the following macros to the file.

 

The multilinecomment macro function can be used to comment out and uncomment code.

Macro multilinecomment () {hwnd = getcurrentwnd () Selection = getwndsel (hwnd) lnfirst = getwndsellnfirst (hwnd) // obtain the first line number lnlast = getwndsellnlast (hwnd) // obtain the row number hbuf = getcurrentbuf () if (getbufline (hbuf, 0) = "// magic-number: tph85666031 ") {stop} ln = lnfirst Buf = getbufline (hbuf, LN) Len = strlen (BUF) while (LN <= lnlast) {Buf = getbufline (hbuf, LN) // obtain the row if (BUF = "") {// skip the empty row Ln = ln + 1 contin UE} If (strmid (BUF, 0, 1) = "/") {// you need to cancel comments to prevent single-character rows if (strmid (BUF, 1, 2) = "/") {putbufline (hbuf, LN, strmid (BUF, 2, strlen (BUF)} If (strmid (BUF, 0, 1 )! = "/") {// Note Buf = CAT ("//", Buf) if (Ln = lnfirst) {Buf = CAT (BUF, "// removed by jhy") // Comment Author information} putbufline (hbuf, LN, Buf)} ln = ln + 1} setwndsel (hwnd, selection )}

After saving, open the new project: Options-> key assignments (set the shortcut key)


So far, we can use the Alt + x shortcut in the code to see the effect as follows:

3. We will paste a macro for the Quick insertion time, similar to the F7 shortcut function in ultraedit.

macro MonthToName(MonthNum){    if (MonthNum== 1)        return "Jan"    if (MonthNum== 2)        return "Feb"    if (MonthNum== 3)        return "Mar"    if (MonthNum== 4)        return "Apr"    if (MonthNum== 5)        return "May"    if (MonthNum== 6)        return "Jun"    if (MonthNum== 7)        return "Jul"    if (MonthNum== 8)        return "Aug"    if (MonthNum== 9)        return "Sep"    if (MonthNum== 10)        return "Oct"    if (MonthNum== 11)        return "Nov"    if (MonthNum== 12)        return "Dec"}macro DisplayDate(){    szTime = GetSysTime(1)    Day = szTime.Day    Month = szTime.Month    Year = szTime.Year    if (Day < 10)        szDay = "0@Day@"    else        szDay = Day    szMonth = MonthToName(Month)    hbuf = GetCurrentBuf()    SetBufSelText(hbuf, "@szMonth@ @szDay@, @Year@")}

Reference:

Http://blog.csdn.net/tlaff/article/details/6536610

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.