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?
- Macro Multilinecomment ()
- {
- hwnd = Getcurrentwnd ()
- Selection = Getwndsel (hwnd)
- Lnfirst = Getwndsellnfirst (hwnd) //Take the first line line number
- Lnlast = Getwndsellnlast (hwnd) //Fetch last line 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) //Take Ln corresponding to the row
- if (buf = = "") { //Skip blank line
- ln = ln + 1
- Continue
- }
- if (strmid (buf, 0, 1) = = "/") { //need to uncomment to prevent only single-character rows
- if (Strmid (buf, 1, 2) = = "/") {
- Putbufline (Hbuf, Ln, Strmid (buf, 2, Strlen (BUF)))
- }
- }
- if (Strmid (buf,0,1)! = "/") { //need to add a comment
- 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)
- }
[CPP]View Plaincopyprint?
- Macro Multilinecomment ()
- {
- hwnd = Getcurrentwnd ()
- Selection = Getwndsel (hwnd)
- Lnfirst = Getwndsellnfirst (hwnd) //Take the first line line number
- Lnlast = Getwndsellnlast (hwnd) //Fetch last line 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) //Take Ln corresponding to the row
- if (buf = = "") { //Skip blank line
- ln = ln + 1
- Continue
- }
- if (strmid (buf, 0, 1) = = "/") { //need to uncomment to prevent only single-character rows
- if (Strmid (buf, 1, 2) = = "/") {
- Putbufline (Hbuf, Ln, Strmid (buf, 2, Strlen (BUF)))
- }
- }
- if (Strmid (buf,0,1)! = "/") { //need to add a comment
- 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 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?
- 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 "June"
- if (monthnum== 7)
- return "Jul"
- if (monthnum== 8)
- return to "the "
- if (monthnum== 9)
- return "Sep"
- if (monthnum==)
- return "Oct"
- if (monthnum==)
- return "Nov"
- if (monthnum==)
- return "Dec"
- }
- Macro Displaydate ()
- {
- Sztime = Getsystime (1)
- Day = Sztime.day
- Month = Sztime.month
- Year = Sztime.year
- if (Day < ten)
- Szday = "[Email protected]@"
- Else
- Szday = Day
- Szmonth = Monthtoname (Month)
- Hbuf = Getcurrentbuf ()
- Setbufseltext (Hbuf, "@[email protected] @[email protected], @[email protected]")
- }
[CPP]View Plaincopyprint?
- 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 "June"
- if (monthnum== 7)
- return "Jul"
- if (monthnum== 8)
- return to "the "
- if (monthnum== 9)
- return "Sep"
- if (monthnum==)
- return "Oct"
- if (monthnum==)
- return "Nov"
- if (monthnum==)
- return "Dec"
- }
- Macro Displaydate ()
- {
- Sztime = Getsystime (1)
- Day = Sztime.day
- Month = Sztime.month
- Year = Sztime.year
- if (Day < ten)
- Szday = "[Email protected]@"
- Else
- Szday = Day
- Szmonth = Monthtoname (Month)
- Hbuf = Getcurrentbuf ()
- Setbufseltext (Hbuf, "@[email protected] @[email protected], @[email protected]"
Turn:
Go Source Insight Usage Tips Summary