[转]Source Insight使用小技巧小结
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宏功能就是可以注释、反注释代码
- macro MultiLineComment()
- {
- hwnd = GetCurrentWnd()
- selection = GetWndSel(hwnd)
- LnFirst = GetWndSelLnFirst(hwnd) //取首行行号
- LnLast = GetWndSelLnLast(hwnd) //取末行行号
- 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) //取Ln对应的行
- if(buf == ""){ //跳过空行
- Ln = Ln + 1
- continue
- }
- if(StrMid(buf, 0, 1) == "/") { //需要取消注释,防止只有单字符的行
- if(StrMid(buf, 1, 2) == "/"){
- PutBufLine(hbuf, Ln, StrMid(buf, 2, Strlen(buf)))
- }
- }
- if(StrMid(buf,0,1) != "/"){ //需要添加注释
- buf = Cat("//", buf)
- if(Ln == Lnfirst){
- buf = Cat(buf,"//removed by jhy")//注释作者信息
- }
- PutBufLine(hbuf, Ln, buf)
- }
- Ln = Ln + 1
- }
- SetWndSel(hwnd, selection)
- }
- macro MultiLineComment()
- {
- hwnd = GetCurrentWnd()
- selection = GetWndSel(hwnd)
- LnFirst = GetWndSelLnFirst(hwnd) //取首行行号
- LnLast = GetWndSelLnLast(hwnd) //取末行行号
- 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) //取Ln对应的行
- if(buf == ""){ //跳过空行
- Ln = Ln + 1
- continue
- }
- if(StrMid(buf, 0, 1) == "/") { //需要取消注释,防止只有单字符的行
- if(StrMid(buf, 1, 2) == "/"){
- PutBufLine(hbuf, Ln, StrMid(buf, 2, Strlen(buf)))
- }
- }
- if(StrMid(buf,0,1) != "/"){ //需要添加注释
- buf = Cat("//", buf)
- if(Ln == Lnfirst){
- buf = Cat(buf,"//removed by jhy")//注释作者信息
- }
- PutBufLine(hbuf, Ln, buf)
- }
- Ln = Ln + 1
- }
- SetWndSel(hwnd, selection)
- }
保存后,打开新的工程:options->key assignments(设置快捷键)
到此为止,我们在代码中使用ALT+X的快捷键看看,效果如下:
3、我们再来贴一个快速插入时间的宏,类似于UltraEdit中的F7快捷键功能
- 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@")
- }
- 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@"
转:
[转]Source Insight使用小技巧小结的更多相关文章
- Source Insight使用小技巧小结
Source Insight是一款强大的代码查看工具,本身支持扩展性很好.下面我们就介绍2个扩展用例. 1.快速打开当前文件所在的目录,这个功能类似于eclipse的easyshell插件,就是能快速 ...
- Source Insight的应用技巧、宏功能
目录 1 简介... 5 2 搭建我们的SI环境... 5 2.1 搭建步骤... 5 2.2 说明... 6 3 应用技巧... 6 3.1 初级应用技巧... 6 3.1.1 解决字体不等宽与对齐 ...
- Source Insight设置总结
在网上搜索了一些关于Source Insight的设置技巧,把这些结果给总结下来: 1. 背景色选择 要改变背景色Options->preference->windows backgrou ...
- source insight快捷键及使用技巧
source insight快捷键及使用技巧 退出程序 : Alt+F4 重画屏幕 ...
- Source Insight 技巧总结
以下文章转载自网络:http://blog.csdn.net/junjie319/article/details/6910992 http://www.cnblogs.com/bluestorm/ar ...
- [SourceInsight].source insight 使用技巧
转自:https://www.veryarm.com/140428.html 1 开胃菜-初级应用 1.1 选择美丽的界面享受工作 虽然不能以貌取人,但似乎从来没有人责备以貌取软件的.SI的华丽界 ...
- Source Insight使用技巧
1. source insight必设: option-->key assignments--> Edit: Delete Line ---- Assign New Key: Ctr ...
- source insight 支持verilog 及使用技巧
安装 1.首先到官网下载clf文件 http://www.sourceinsight.com/public/languages/ 2.配置source insight 以前有的先删除 Options ...
- source insight技巧
(1)在Source Insight中能不能设置永久Bookmark 可以从macro方面入手 (2)source insight中添加.S文件 (3)source insight里面怎么能不让它每次 ...
随机推荐
- OS X 在Cisco无线环境下丢包分析 part 2
part 1说到,单播的ARP请求最终都被网关丢弃了,从而造成了丢包.先说我最终怎么解决的吧,我最终把核心交换上针对无线VLAN的arp inspection和dhcp snooping删掉了,然后出 ...
- [js开源组件开发]-手机端照片预览组件
手机端照片预览组件 可怜的我用着华为3C手机,用别人现成的组件都好卡,为了适应我这种屌丝,于是自己简化写了一版的照片预览效果,暂时无缩放功能,以后可能有空再加吧,你也可以自己加下,这是个github上 ...
- osx的终端软件iterm2 之 修改外观 和 常用快捷键小结
1.修改外观:透明,自己配色,最好还有个透明的小背景,比如这样: 那么你就要这样修改: 2.快捷键小结 (1)⌘ + d 横着分屏 / ⌘ + shift + d 竖着分屏 : 适合多操作的时候 ( ...
- Thread.CurrentPrincipal & HttpContext.Current.User
据说要这样写才稳妥 // This principal will flow throughout the request.VoyagerPrincipal principal = new Voyage ...
- Sharepoint学习笔记—习题系列--70-573习题解析 -(Q111-Q114)
Question 111You create a custom page layout that contains the following code segment. (Line numbers ...
- UITableView删除添加和移动
#import "RootTableViewController.h" @interface RootTableViewController () @property (nonat ...
- 读书笔记-Autonomous Intelligent Vehicles(一)
Autonomous intelligent vehicles have to finish the basic procedures: perceiving and modeling environ ...
- 关于UI资源获取资源的好的网站
前言:和我一样喜欢UI的一定喜欢这里的内容. 下面是关于sketch资源获取网页,点击图片就能进入: 连接是:https://github.com/JakeLin 居然意外百度到Sketch中国,还提 ...
- Cocos2d入门--2--三角函数的应用
其实,三角函数的知识点是初中的数学基础.但是在编程里合理的利用的话,也会很好玩的,可以制作出很多有趣的动画特效. 首先要注意的是 角度 和 弧度 的转换. 360度 = 2×PI弧度 180度 = ...
- APP国际化
1.app本地内容国际化 ①在项目中新建一个New File ---> iOS Resource -> String File ---> 命名为Localizable(之所以命名为L ...