Go Source Insight Usage Tips Summary

Source: Internet
Author: User

Source Insight is a powerful code-viewing tool that natively supports good extensibility. Here we introduce 2 extension use cases.

1. Quickly open the directory where the current file is located, this feature is similar to eclipse's Easyshell plugin, which can quickly navigate to the directory where the file is located, which is useful when the code is viewed.

Follow these steps to first enter "option", "Custom Commands"

Custom command name, personal play, the key is to fill in Explorer.exe%d,

Set shortcut keys ctrl+t

You can also add a custom command to the menu

By this setting, you can directly open the directory where the current file is located by using the shortcut key ctrl+t.

2. Compared with the quick and convenient annotation counter-annotation in Eclipse, si is a bit old-fashioned and inconvenient. However, you can improve this situation by customizing the macro block.

First, open Projcet->open project, select Base, and you can see the Utils.em file and add the following macro to the file.

MULTILINECOMMENT macro function is to be able to comment, anti-comment code

[CPP]View Plaincopyprint?
  1. Macro Multilinecomment ()
  2. {
  3. hwnd = Getcurrentwnd ()
  4. Selection = Getwndsel (hwnd)
  5. Lnfirst = Getwndsellnfirst (hwnd) //Take the first line line number
  6. Lnlast = Getwndsellnlast (hwnd) //Fetch last line number
  7. Hbuf = Getcurrentbuf ()
  8. if (getbufline (hbuf, 0) = = "//magic-number:tph85666031") {
  9. Stop
  10. }
  11. Ln = Lnfirst
  12. BUF = Getbufline (Hbuf, Ln)
  13. Len = strlen (BUF)
  14. While (Ln <= lnlast) {
  15. BUF = Getbufline (hbuf, LN) //Take Ln corresponding to the row
  16. if (buf = = "") { //Skip blank line
  17. ln = ln + 1
  18. Continue
  19. }
  20. if (strmid (buf, 0, 1) = = "/") { //need to uncomment to prevent only single-character rows
  21. if (Strmid (buf, 1, 2) = = "/") {
  22. Putbufline (Hbuf, Ln, Strmid (buf, 2, Strlen (BUF)))
  23. }
  24. }
  25. if (Strmid (buf,0,1)! = "/") { //need to add a comment
  26. BUF = Cat ("//", BUF)
  27. if (Ln = = Lnfirst) {
  28. BUF = Cat (buf,"//removed by Jhy")//Comment Author information
  29. }
  30. Putbufline (Hbuf, Ln, buf)
  31. }
  32. ln = ln + 1
  33. }
  34. Setwndsel (hwnd, selection)
  35. }
[CPP]View Plaincopyprint?
  1. Macro Multilinecomment ()
  2. {
  3. hwnd = Getcurrentwnd ()
  4. Selection = Getwndsel (hwnd)
  5. Lnfirst = Getwndsellnfirst (hwnd) //Take the first line line number
  6. Lnlast = Getwndsellnlast (hwnd) //Fetch last line number
  7. Hbuf = Getcurrentbuf ()
  8. if (getbufline (hbuf, 0) = = "//magic-number:tph85666031") {
  9. Stop
  10. }
  11. Ln = Lnfirst
  12. BUF = Getbufline (Hbuf, Ln)
  13. Len = strlen (BUF)
  14. While (Ln <= lnlast) {
  15. BUF = Getbufline (hbuf, LN) //Take Ln corresponding to the row
  16. if (buf = = "") { //Skip blank line
  17. ln = ln + 1
  18. Continue
  19. }
  20. if (strmid (buf, 0, 1) = = "/") { //need to uncomment to prevent only single-character rows
  21. if (Strmid (buf, 1, 2) = = "/") {
  22. Putbufline (Hbuf, Ln, Strmid (buf, 2, Strlen (BUF)))
  23. }
  24. }
  25. if (Strmid (buf,0,1)! = "/") { //need to add a comment
  26. BUF = Cat ("//", BUF)
  27. if (Ln = = Lnfirst) {
  28. BUF = Cat (buf,"//removed by Jhy")//Comment Author information
  29. }
  30. Putbufline (Hbuf, Ln, buf)
  31. }
  32. ln = ln + 1
  33. }
  34. Setwndsel (hwnd, selection)
  35. }

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

To this end, we use Alt+x's shortcut keys in the code to see the effect:

3. We'll stick to a quick insert time macro, similar to the F7 shortcut key feature in UltraEdit

[CPP]View Plaincopyprint?
  1. Macro Monthtoname (Monthnum)
  2. {
  3. if (monthnum== 1)
  4. return "Jan"
  5. if (monthnum== 2)
  6. return "Feb"
  7. if (monthnum== 3)
  8. return "Mar"
  9. if (monthnum== 4)
  10. return "APR"
  11. if (monthnum== 5)
  12. return "may"
  13. if (monthnum== 6)
  14. return "June"
  15. if (monthnum== 7)
  16. return "Jul"
  17. if (monthnum== 8)
  18. return to "the "
  19. if (monthnum== 9)
  20. return "Sep"
  21. if (monthnum==)
  22. return "Oct"
  23. if (monthnum==)
  24. return "Nov"
  25. if (monthnum==)
  26. return "Dec"
  27. }
  28. Macro Displaydate ()
  29. {
  30. Sztime = Getsystime (1)
  31. Day = Sztime.day
  32. Month = Sztime.month
  33. Year = Sztime.year
  34. if (Day < ten)
  35. Szday = "[Email protected]@"
  36. Else
  37. Szday = Day
  38. Szmonth = Monthtoname (Month)
  39. Hbuf = Getcurrentbuf ()
  40. Setbufseltext (Hbuf, "@[email protected] @[email protected], @[email protected]")
  41. }
[CPP]View Plaincopyprint?
    1. Macro Monthtoname (Monthnum)
    2. {
    3. if (monthnum== 1)
    4. return "Jan"
    5. if (monthnum== 2)
    6. return "Feb"
    7. if (monthnum== 3)
    8. return "Mar"
    9. if (monthnum== 4)
    10. return "APR"
    11. if (monthnum== 5)
    12. return "may"
    13. if (monthnum== 6)
    14. return "June"
    15. if (monthnum== 7)
    16. return "Jul"
    17. if (monthnum== 8)
    18. return to "the "
    19. if (monthnum== 9)
    20. return "Sep"
    21. if (monthnum==)
    22. return "Oct"
    23. if (monthnum==)
    24. return "Nov"
    25. if (monthnum==)
    26. return "Dec"
    27. }
    28. Macro Displaydate ()
    29. {
    30. Sztime = Getsystime (1)
    31. Day = Sztime.day
    32. Month = Sztime.month
    33. Year = Sztime.year
    34. if (Day < ten)
    35. Szday = "[Email protected]@"
    36. Else
    37. Szday = Day
    38. Szmonth = Monthtoname (Month)
    39. Hbuf = Getcurrentbuf ()
    40. Setbufseltext (Hbuf, "@[email protected] @[email protected], @[email protected]"

Turn:

Go Source Insight Usage Tips Summary

Related Article

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.