Source Insight是一款强大的代码查看工具,本身支持扩展性很好。下面我们就介绍2个扩展用例。

1、快速打开当前文件所在的目录,这个功能类似于eclipse的easyshell插件,就是能快速定位到文件所在的目录,这个在代码查看的时候是很有好处的。

按照以下步骤,首先进入【option】->【Custom Commands】

自定的命令名,个人发挥,关键是填入 explorer.exe %d,

设置快捷键CTRL+T

也可以将自定义命令加入Menu菜单中

到此设置完毕,可以通过快捷键CTRL+T,直接打开当前文件所在的目录。

2、与eclipse中快捷方便的注释反注释相比较,sI是有点古板和不方便额。但是可以通过自定义的宏块来改善这个情况。

首先,打开Projcet->Open project,选择base,可以看到utils.em文件,将下列宏添加到该文件中。

MultiLineComment宏功能就是可以注释、反注释代码

  1. macro MultiLineComment()
  2. {
  3. hwnd = GetCurrentWnd()
  4. selection = GetWndSel(hwnd)
  5. LnFirst = GetWndSelLnFirst(hwnd)      //取首行行号
  6. LnLast = GetWndSelLnLast(hwnd)      //取末行行号
  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)  //取Ln对应的行
  16. if(buf == ""){                    //跳过空行
  17. Ln = Ln + 1
  18. continue
  19. }
  20. if(StrMid(buf, 0, 1) == "/") {       //需要取消注释,防止只有单字符的行
  21. if(StrMid(buf, 1, 2) == "/"){
  22. PutBufLine(hbuf, Ln, StrMid(buf, 2, Strlen(buf)))
  23. }
  24. }
  25. if(StrMid(buf,0,1) != "/"){          //需要添加注释
  26. buf = Cat("//", buf)
  27. if(Ln == Lnfirst){
  28. buf = Cat(buf,"//removed by jhy")//注释作者信息
  29. }
  30. PutBufLine(hbuf, Ln, buf)
  31. }
  32. Ln = Ln + 1
  33. }
  34. SetWndSel(hwnd, selection)
  35. }
  1. macro MultiLineComment()
  2. {
  3. hwnd = GetCurrentWnd()
  4. selection = GetWndSel(hwnd)
  5. LnFirst = GetWndSelLnFirst(hwnd)      //取首行行号
  6. LnLast = GetWndSelLnLast(hwnd)      //取末行行号
  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)  //取Ln对应的行
  16. if(buf == ""){                    //跳过空行
  17. Ln = Ln + 1
  18. continue
  19. }
  20. if(StrMid(buf, 0, 1) == "/") {       //需要取消注释,防止只有单字符的行
  21. if(StrMid(buf, 1, 2) == "/"){
  22. PutBufLine(hbuf, Ln, StrMid(buf, 2, Strlen(buf)))
  23. }
  24. }
  25. if(StrMid(buf,0,1) != "/"){          //需要添加注释
  26. buf = Cat("//", buf)
  27. if(Ln == Lnfirst){
  28. buf = Cat(buf,"//removed by jhy")//注释作者信息
  29. }
  30. PutBufLine(hbuf, Ln, buf)
  31. }
  32. Ln = Ln + 1
  33. }
  34. SetWndSel(hwnd, selection)
  35. }

保存后,打开新的工程:options->key assignments(设置快捷键)

到此为止,我们在代码中使用ALT+X的快捷键看看,效果如下:

3、我们再来贴一个快速插入时间的宏,类似于UltraEdit中的F7快捷键功能

  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 "Jun"
  15. if (MonthNum== 7)
  16. return "Jul"
  17. if (MonthNum== 8)
  18. return "Aug"
  19. if (MonthNum== 9)
  20. return "Sep"
  21. if (MonthNum== 10)
  22. return "Oct"
  23. if (MonthNum== 11)
  24. return "Nov"
  25. if (MonthNum== 12)
  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 < 10)
  35. szDay = "0@Day@"
  36. else
  37. szDay = Day
  38. szMonth = MonthToName(Month)
  39. hbuf = GetCurrentBuf()
  40. SetBufSelText(hbuf, "@szMonth@ @szDay@, @Year@")
  41. }
    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 "Jun"
    15. if (MonthNum== 7)
    16. return "Jul"
    17. if (MonthNum== 8)
    18. return "Aug"
    19. if (MonthNum== 9)
    20. return "Sep"
    21. if (MonthNum== 10)
    22. return "Oct"
    23. if (MonthNum== 11)
    24. return "Nov"
    25. if (MonthNum== 12)
    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 < 10)
    35. szDay = "0@Day@"
    36. else
    37. szDay = Day
    38. szMonth = MonthToName(Month)
    39. hbuf = GetCurrentBuf()
    40. SetBufSelText(hbuf, "@szMonth@ @szDay@, @Year@"

转:

[转]Source Insight使用小技巧小结的更多相关文章

  1. Source Insight使用小技巧小结

    Source Insight是一款强大的代码查看工具,本身支持扩展性很好.下面我们就介绍2个扩展用例. 1.快速打开当前文件所在的目录,这个功能类似于eclipse的easyshell插件,就是能快速 ...

  2. Source Insight的应用技巧、宏功能

    目录 1 简介... 5 2 搭建我们的SI环境... 5 2.1 搭建步骤... 5 2.2 说明... 6 3 应用技巧... 6 3.1 初级应用技巧... 6 3.1.1 解决字体不等宽与对齐 ...

  3. Source Insight设置总结

    在网上搜索了一些关于Source Insight的设置技巧,把这些结果给总结下来: 1. 背景色选择 要改变背景色Options->preference->windows backgrou ...

  4. source insight快捷键及使用技巧

      source insight快捷键及使用技巧 退出程序                             : Alt+F4 重画屏幕                             ...

  5. Source Insight 技巧总结

    以下文章转载自网络:http://blog.csdn.net/junjie319/article/details/6910992 http://www.cnblogs.com/bluestorm/ar ...

  6. [SourceInsight].source insight 使用技巧

    转自:https://www.veryarm.com/140428.html 1  开胃菜-初级应用 1.1  选择美丽的界面享受工作 虽然不能以貌取人,但似乎从来没有人责备以貌取软件的.SI的华丽界 ...

  7. Source Insight使用技巧

    1. source insight必设: option-->key assignments-->    Edit: Delete Line ---- Assign New Key: Ctr ...

  8. source insight 支持verilog 及使用技巧

    安装 1.首先到官网下载clf文件 http://www.sourceinsight.com/public/languages/ 2.配置source insight 以前有的先删除 Options ...

  9. source insight技巧

    (1)在Source Insight中能不能设置永久Bookmark 可以从macro方面入手 (2)source insight中添加.S文件 (3)source insight里面怎么能不让它每次 ...

随机推荐

  1. OS X 在Cisco无线环境下丢包分析 part 2

    part 1说到,单播的ARP请求最终都被网关丢弃了,从而造成了丢包.先说我最终怎么解决的吧,我最终把核心交换上针对无线VLAN的arp inspection和dhcp snooping删掉了,然后出 ...

  2. [js开源组件开发]-手机端照片预览组件

    手机端照片预览组件 可怜的我用着华为3C手机,用别人现成的组件都好卡,为了适应我这种屌丝,于是自己简化写了一版的照片预览效果,暂时无缩放功能,以后可能有空再加吧,你也可以自己加下,这是个github上 ...

  3. osx的终端软件iterm2 之 修改外观 和 常用快捷键小结

    1.修改外观:透明,自己配色,最好还有个透明的小背景,比如这样: 那么你就要这样修改: 2.快捷键小结 (1)⌘ + d 横着分屏 / ⌘ + shift + d 竖着分屏  : 适合多操作的时候 ( ...

  4. Thread.CurrentPrincipal & HttpContext.Current.User

    据说要这样写才稳妥 // This principal will flow throughout the request.VoyagerPrincipal principal = new Voyage ...

  5. Sharepoint学习笔记—习题系列--70-573习题解析 -(Q111-Q114)

    Question 111You create a custom page layout that contains the following code segment. (Line numbers ...

  6. UITableView删除添加和移动

    #import "RootTableViewController.h" @interface RootTableViewController () @property (nonat ...

  7. 读书笔记-Autonomous Intelligent Vehicles(一)

    Autonomous intelligent vehicles have to finish the basic procedures: perceiving and modeling environ ...

  8. 关于UI资源获取资源的好的网站

    前言:和我一样喜欢UI的一定喜欢这里的内容. 下面是关于sketch资源获取网页,点击图片就能进入: 连接是:https://github.com/JakeLin 居然意外百度到Sketch中国,还提 ...

  9. Cocos2d入门--2--三角函数的应用

    其实,三角函数的知识点是初中的数学基础.但是在编程里合理的利用的话,也会很好玩的,可以制作出很多有趣的动画特效. 首先要注意的是 角度 和 弧度 的转换. 360度 = 2×PI弧度 180度 =   ...

  10. APP国际化

    1.app本地内容国际化 ①在项目中新建一个New File ---> iOS Resource -> String File ---> 命名为Localizable(之所以命名为L ...