源码阅读SourceInsight
来源:互联网 发布:mac装win7未能启动 编辑:程序博客网 时间:2024/06/05 05:02
一、创建项目。
二、字体设置。
打开SourceInsight, 在菜单栏中点击Options-->Document Options
A、Screen fonts 设置字体为Times New Roman, 常规, 五号。
B、显示行号, 勾选右下角show line numbers。
三、注释相关宏定义
1、 Open project “base”, add the follow content to the file utiles.em
//add or remove "//" to each line; 定义快捷键为Ctrl+/:
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) != "/"){ //需要添加注释
PutBufLine(hbuf, Ln, Cat("//", buf))
}
Ln = Ln + 1
}
SetWndSel(hwnd, selection)
}
//add or remove "#if 0" to the begin and "#endif" to the end of content; 定义快捷键为Ctrl+#:
macro AddMacroComment()
{
hwnd=GetCurrentWnd()
sel=GetWndSel(hwnd)
lnFirst=GetWndSelLnFirst(hwnd)
lnLast=GetWndSelLnLast(hwnd)
hbuf=GetCurrentBuf()
if(LnFirst == 0) {
szIfStart = ""
}else{
szIfStart = GetBufLine(hbuf, LnFirst-1)
}
szIfEnd = GetBufLine(hbuf, lnLast+1)
if(szIfStart == "#if 0" && szIfEnd == "#endif") {
DelBufLine(hbuf, lnLast+1)
DelBufLine(hbuf, lnFirst-1)
sel.lnFirst = sel.lnFirst - 1
sel.lnLast = sel.lnLast - 1
}else{
InsBufLine(hbuf, lnFirst, "#if 0")
InsBufLine(hbuf, lnLast+2, "#endif")
sel.lnFirst = sel.lnFirst + 1
sel.lnLast = sel.lnLast + 1
}
SetWndSel( hwnd, sel )
}
// add or remove "/*" to the begin , "*/" to the end of the content; 定义快捷键为Ctrl+*:
macro CommentSelStr()
{
hwnd=GetCurrentWnd()
sel=GetWndSel(hwnd)
lnFirst=GetWndSelLnFirst(hwnd)
lnLast=GetWndSelLnLast(hwnd)
hbuf=GetCurrentBuf()
if(LnFirst == 0) {
szIfStart = ""
}else{
szIfStart = GetBufLine(hbuf, LnFirst-1)
}
szIfEnd = GetBufLine(hbuf, lnLast+1)
if(szIfStart == "/*" && szIfEnd == "*/") {
DelBufLine(hbuf, lnLast+1)
DelBufLine(hbuf, lnFirst-1)
sel.lnFirst = sel.lnFirst - 1
sel.lnLast = sel.lnLast - 1
}else{
InsBufLine(hbuf, lnFirst, "/*")
InsBufLine(hbuf, lnLast+2, "*/")
sel.lnFirst = sel.lnFirst + 1
sel.lnLast = sel.lnLast + 1
}
SetWndSel( hwnd, sel )
}
2、add fast key
Options-> key assignments->assign New Key…->OK
四、删除行快捷键。
五、搜索快捷键
Ctrl+f
F3、F4上下跳转
File…按钮可进入整个项目搜索,需要勾选project wide
六、快速跳转行
F5
七、代码排版
利用AStyle插件进行排版。
代码风格http://astyle.sourceforge.net/astyle.html#_default_bracket_style
AStyle工具下载,目前最新版为AStyle_2.06_windows.zip
下载网址http://astyle.sourceforge.net/
步骤
1、工具包解压后,找到AStyle.exe放到安装目录下
C:\Program Files\Source Insight 3
2、添加Option-》custom commands里面
命令名称AStyle
Run "C:\Program Files\Source Insight 3\AStyle.exe" --style=bsd %f
这里的--style=bsd可以换成--style=java
3、添加快捷键ctrl+shift+p
- 源码阅读SourceInsight
- 利用sourceInsight阅读TensorFlow源码
- 源码阅读SourceInsight与静态反汇编IDA Pro
- day05 UART实战、源码阅读工具(Sourceinsight/Ctags)、Makefile编写
- SourceInsight阅读Python
- sourceinsight阅读php代码
- 代码阅读工具SourceInsight
- sourceinsight阅读php代码
- sourceinsight阅读php代码
- 用SourceInsight阅读Python工程
- 使用SourceInsight阅读NS源代码
- 使用SourceInsight阅读NS源代码
- 用SourceInsight阅读Python工程
- 使用SourceInsight阅读NS源代码
- 使用SourceInsight阅读NS源代码
- 用SourceInsight阅读Python工程
- sourceinsight建立linux源码浏览
- 用sourceinsight查看ns2源码
- STC实现软复位
- Shiro身份验证
- Git 入门
- 二分查找
- Unity3D 之 console面板的停靠
- 源码阅读SourceInsight
- 原型模式
- linux 自定义全局环境变量设置
- 坑
- HDU 6105 Gameia【思维+博弈】
- CSU 1803: 2016 (省赛真题)
- 【c++】基本数据类型
- npoi导出超过65000行excel分sheet页。
- 【字符串入门专题1】【hdu4763】【未ac题】【扩展kmp exkmp】