在Source Insight中添加自定义功能的步骤如下:
1.Source Insight中,Options->Custom Commands...->Add...,New Command name 随便写,我的是"Edit with Vim"
2.Run中写入: "C:/Program Files/Vim/vim63/gvim.exe" --remote-silent +%l %f
意思是在当前已经打开的gvim窗口里面打开当前的文件,并且跳转到指定行
%l为当前的行号,%f为文件名
使用 --remote-silent 的作用是,如果已经打开了对应文件,就不会打开第二次,而是在已经打开的文件里跳转到对应行
3.还是同一个对话框里面,选择Keys->Assign New Key...->按F12,如果你已经将F12设置给其他命令,选择其他的按键就行了
下面是一些常用自定义功能:( CUSTOM COMMANDS )
打开资源管理器并选中当前文件
ShellExecute open explorer /e,/select,%f
查看log
"C:/Program Files/TortoiseSVN/bin/TortoiseProc.exe" /command:log /path:%f /notempfile /closeonend
diff
"C:/Program Files/TortoiseSVN/bin/TortoiseProc.exe" /command:diff /path:%f /notempfile /closeonend
取得锁定(check out)
"C:/Program Files/TortoiseSVN/bin/TortoiseProc.exe" /command:lock /path:%f /notempfile /closeonend
提交(check in)
"C:/Program Files/TortoiseSVN/bin/TortoiseProc.exe" /command:commit /path:%f /notempfile /closeonend
更新(update)
"C:/Program Files/TortoiseSVN/bin/TortoiseProc.exe" /command:update /path:%f /notempfile /closeonend
更新整个目录(update all)
"C:/Program Files/TortoiseSVN/bin/TortoiseProc.exe" /command:update /path:*.* /notempfile /closeonend
取消锁定(undo check out)
"C:/Program Files/TortoiseSVN/bin/TortoiseProc.exe" /command:revert /path:%f /notempfile /closeonend
在ultriEdit中编辑
"C:/Program Files/UltraEdit-32/uedit32" %f
在vim中编辑并定位到当前行
"C:/Program Files/Vim/vim63/gvim.exe" --remote-silent +%l %f
汇总其他小技巧:
让{ 和 } 不缩进:
Options->Document Options->Auto Indent->Indent Open Brace/Indent Close Brace
hao space: SourceInsight 小技巧
1、按住"ctrl", 再用鼠标指向某个变量,点击一下,就能进入这个变量的定义。
2、今天把一个用sourceinsight排版整齐的C文件,偶然用VC打开一看,全乱了。研究了半天,发现SI对每个字符的宽度不太一致。
请教同事发现选上"view --> draft view", 就可以让每个字符的宽度一致了。快捷键是 "Alt + F12"
3、"shift+F8" 标亮所有文本中光标所在位置的单词
4、跳到某一行:"ctrl + g"
Source Insight是阅读和编写代码的好东东,基本上也算得上是经典之作了,虽然还有一点点小bug,不过对于我们这些C程序员来说可是一旦拥有别无所求。下 列小技巧是在工作中同事整理总结的,对提高工作效率多少有点帮助,其中有些是对应于SVN的,没有使用SVN做版本管理的人就不要白费力气了。
ShellExecute open explorer /e,/select,%f
/*作用是在资源管理器中打开当前编辑文件并选中*/
/*可以设置快捷键如ctrl+e,这样能很方便的在资源管理器打开对应的文件,并进行tortoiseSVN的相关操作*/
X:/Progra~1/TortoiseSVN/bin/TortoiseProc.exe /command:log /path:% /notempfile /closeonend
/*使用前注意更改对应的bin安装路径*/
/*作用是直接查看当前文件的svn log*/
/*可以设置快捷键如ctrl+l*/
X:/Progra~1/TortoiseSVN/bin/TortoiseProc.exe /command:diff /path:% /notempfile /closeonend
/*使用前注意更改对应的bin安装路径*/
/*作用是直接查看当前文件和基准版本的比较*/
/*可以设置快捷键如ctrl+d*/
在Source Insight中快速添加注释
将以下代码保存成Utils.em,详细使用说明看文章结尾
/* Utils.em - a small collection of useful editing macros */
/*-------------------------------------------------------------------------
I N S E R T H E A D E R
Inserts a comment header block at the top of the current function.
This actually works on any type of symbol, not just functions.
To use this, define an environment variable "MYNAME" and set it
to your email name. eg. set MYNAME=raygr
-------------------------------------------------------------------------*/
macro InsertHeader()
{
// Get the owner's name from the environment variable: MYNAME.
// If the variable doesn't exist, then the owner field is skipped.
szMyName = getenv(MYNAME)
// Get a handle to the current file buffer and the name
// and location of the current symbol where the cursor is.
hbuf = GetCurrentBuf()
szFunc = GetCurSymbol()
ln = GetSymbolLine(szFunc)
// begin assembling the title string
sz = "/* "
/* convert symbol name to T E X T L I K E T H I S */
cch = strlen(szFunc)
ich = 0
while (ich < cch)
{
ch = szFunc[ich]
if (ich > 0)
if (isupper(ch))
sz = cat(sz, " ")
else
sz = cat(sz, " ")
sz = Cat(sz, toupper(ch))
ich = ich + 1
}
sz = Cat(sz, " */")
InsBufLine(hbuf, ln, sz)
InsBufLine(hbuf, ln+1, "/*-------------------------------------------------------------------------")
/* if owner variable exists, insert Owner: name */
if (strlen(szMyName) > 0)
{
InsBufLine(hbuf, ln+2, " Owner: @szMyName@")
InsBufLine(hbuf, ln+3, " ")
ln = ln + 4
}
else
ln = ln + 2
InsBufLine(hbuf, ln, " ") // provide an indent already
InsBufLine(hbuf, ln+1, "-------------------------------------------------------------------------*/")
// put the insertion point inside the header comment
SetBufIns(hbuf, ln, 4)
}
/* InsertFileHeader:
Inserts a comment header block at the top of the current function.
This actually works on any type of symbol, not just functions.
To use this, define an environment variable "MYNAME" and set it
to your email name. eg. set MYNAME=raygr
*/
macro InsertFileHeader()
{
szMyName = getenv(MYNAME)
hbuf = GetCurrentBuf()
InsBufLine(hbuf, 0, "/*-------------------------------------------------------------------------")
/* if owner variable exists, insert Owner: name */
InsBufLine(hbuf, 1, " ")
if (strlen(szMyName) > 0)
{
sz = " Owner: @szMyName@"
InsBufLine(hbuf, 2, " ")
InsBufLine(hbuf, 3, sz)
ln = 4
}
else
ln = 2
InsBufLine(hbuf, ln, "-------------------------------------------------------------------------*/")
}
// Inserts "Returns True .. or False..." at the current line
macro ReturnTrueOrFalse()
{
hbuf = GetCurrentBuf()
ln = GetBufLineCur(hbuf)
InsBufLine(hbuf, ln, " Returns True if successful or False if errors.")
}
/* Inserts ifdef REVIEW around the selection */
macro IfdefReview()
{
IfdefSz("REVIEW");
}
/* Inserts ifdef BOGUS around the selection */
macro IfdefBogus()
{
IfdefSz("BOGUS");
}
/* Inserts ifdef NEVER around the selection */
macro IfdefNever()
{
IfdefSz("NEVER");
}
// Ask user for ifdef condition and wrap it around current
// selection.
macro InsertIfdef()
{
sz = Ask("Enter ifdef condition:")
if (sz != "")
IfdefSz(sz);
}
macro InsertCPlusPlus()
{
IfdefSz("__cplusplus");
}
// Wrap ifdef <sz> .. endif around the current selection
macro IfdefSz(sz)
{
hwnd = GetCurrentWnd()
lnFirst = GetWndSelLnFirst(hwnd)
lnLast = GetWndSelLnLast(hwnd)
hbuf = GetCurrentBuf()
InsBufLine(hbuf, lnFirst, "#ifdef @sz@")
InsBufLine(hbuf, lnLast+2, "#endif /* @sz@ */")
}
// Delete the current line and appends it to the clipboard buffer
macro KillLine()
{
hbufCur = GetCurrentBuf();
lnCur = GetBufLnCur(hbufCur)
hbufClip = GetBufHandle("Clipboard")
AppendBufLine(hbufClip, GetBufLine(hbufCur, lnCur))
DelBufLine(hbufCur, lnCur)
}
// Paste lines killed with KillLine (clipboard is emptied)
macro PasteKillLine()
{
Paste
EmptyBuf(GetBufHandle("Clipboard"))
}
// delete all lines in the buffer
macro EmptyBuf(hbuf)
{
lnMax = GetBufLineCount(hbuf)
while (lnMax > 0)
{
DelBufLine(hbuf, 0)
lnMax = lnMax - 1
}
}
// Ask the user for a symbol name, then jump to its declaration
macro JumpAnywhere()
{
symbol = Ask("What declaration would you like to see?")
JumpToSymbolDef(symbol)
}
// list all siblings of a user specified symbol
// A sibling is any other symbol declared in the same file.
macro OutputSiblingSymbols()
{
symbol = Ask("What symbol would you like to list siblings for?")
hbuf = ListAllSiblings(symbol)
SetCurrentBuf(hbuf)
}
// Given a symbol name, open the file its declared in and
// create a new output buffer listing all of the symbols declared
// in that file. Returns the new buffer handle.
macro ListAllSiblings(symbol)
{
loc = GetSymbolLocation(symbol)
if (loc == "")
{
msg ("@symbol@ not found.")
stop
}
hbufOutput = NewBuf("Results")
hbuf = OpenBuf(loc.file)
if (hbuf == 0)
{
msg ("Can't open file.")
stop
}
isymMax = GetBufSymCount(hbuf)
isym = 0;
while (isym < isymMax)
{
AppendBufLine(hbufOutput, GetBufSymName(hbuf, isym))
isym = isym + 1
}
CloseBuf(hbuf)
return hbufOutput
}
/*
written by yubind
*/
macro SingleLineComment()
{
szMyName = "chenjsa"
// Get a handle to the current file buffer and the name
// and location of the current symbol where the cursor is.
hbuf = GetCurrentBuf()
ln = GetBufLnCur(hbuf)
// Get current time
szTime = GetSysTime(1)
Hour = szTime.Hour
Minute = szTime.Minute
Second = szTime.Second
Day = szTime.Day
Month = szTime.Month
Year = szTime.Year
if (Day < 10)
szDay = "0@Day@"
else
szDay = Day
//szMonth = NumToName(Month)
if (Month < 10)
szMonth = "0@Month@"
else
szMonth = Month
szDescription = Ask("请输入修改原因")
// begin assembling the title string
InsBufLine(hbuf, ln+1, "/*@szDescription@ @szMyName@.xmyanfa @Year@-@szMonth@-@szDay@*/")
}
macro MultiLineCommentHeader()
{
szMyName = "chenjsa"
// Get a handle to the current file buffer and the name
// and location of the current symbol where the cursor is.
hbuf = GetCurrentBuf()
ln = GetBufLnCur(hbuf)
// Get current time
szTime = GetSysTime(1)
Hour = szTime.Hour
Minute = szTime.Minute
Second = szTime.Second
Day = szTime.Day
Month = szTime.Month
Year = szTime.Year
if (Day < 10)
szDay = "0@Day@"
else
szDay = Day
//szMonth = NumToName(Month)
if (Month < 10)
szMonth = "0@Month@"
else
szMonth = Month
szDescription = Ask("请输入修改原因:")
// begin assembling the title string
InsBufLine(hbuf, ln + 1, "/*@szDescription@ @szMyName@.xmyanfa @Year@-@szMonth@-@szDay@ begin*/")
}
macro MultiLineCommentEnd()
{
szMyName = "chenjsa"
// Get a handle to the current file buffer and the name
// and location of the current symbol where the cursor is.
hbuf = GetCurrentBuf()
ln = GetBufLnCur(hbuf)
// Get current time
szTime = GetSysTime(1)
Hour = szTime.Hour
Minute = szTime.Minute
Second = szTime.Second
Day = szTime.Day
Month = szTime.Month
Year = szTime.Year
if (Day < 10)
szDay = "0@Day@"
else
szDay = Day
//szMonth = NumToName(Month)
if (Month < 10)
szMonth = "0@Month@"
else
szMonth = Month
InsBufLine(hbuf, ln + 1, "/*@szMyName@.xmyanfa @Year@-@szMonth@-@szDay@ end*/")
}
使用说明:可以实现在sourceinsight中快速添加修改注释。
1. Project->Open Project... 打开Base工程(该工程一般在我的文档//Source Insight//Projects//Base中);
2. 搜索utils.em 里的字串"chenjsa" 改成自己的姓名
3. Project->Add and Remove Project Files... 加入宏文件(即utils.em);
4. Options->Menu Assignments 打开Menu Assignments窗口, 在Command中输入Macro, 选中要使用的宏(SingleLineComment ,MultiLineCommentHeader,MultiLineCommentEnd), 添加到合适的菜单中.
分享到:
相关推荐
自己编写的SourceInsight宏函数(增加了很多实用的功能,欢饮交流指正^_^) ****************************************************************************** * 函数列表 * * 1. AutoExp if、for、switch、...
[博客资源]Source Insight 自定义快捷键宏函数编写用例程序
Source Insight工具是开发人员经常使用的一款代码编辑工具,它自带一种脚本宏,可以自定义开发一些宏命令,辅助编程,比如根据输入的代码关键字for,switch等一键补齐后面的通用代码,一键添加函数注释,一键添加...
source insight常用macro语言脚本,加速你的代码编写。很多功能都是很实用的,比如快速注解、取消注解多行代码功能
source Insight快捷键及使用技巧大全
Source Insight是一个面向项目开发的程序编辑器和代码浏览器,它拥有内置的对C/C++, C#和Java等程序的分析。SourceInsight能分析你的源代码并在你工作的同时动态维护它自己的符号数据库,并自动为你显示有用的上下文...
sourceinsight常用文件头 函数头 注释 自动 宏
Source Insight集成Astyle常用指令汇总
source insight 个人配置宏 东西等
Source Insight使用技巧Source Insight使用技巧Source Insight使用技巧Source Insight使用技巧Source Insight使用技巧Source Insight使用技巧Source Insight使用技巧Source Insight使用技巧Source Insight使用技巧...
source insight 3.5和source insight4.0(带破解文件),安装和破解方便,一键导入破解
SourceInsight 4.0 主题
sourceinsight支持SQL语言;在sourceinsight中查看SQL,很好的插件工具哦!!!!!
护眼、黑暗、仿vscode
为加快开发效率,sourceinsight常用宏
Source Insight 小技巧 背景色选择 解决字符等宽对齐问题 解决TAB键缩进问题 SI中的自动对齐设置 向项目中添加文件时,只添加特定类型的文件(文件类型过滤器) 自定义添加文件类型 恢复ctrl+a的全选功能 ...
现在升级为SourceInsight4.0的配置环境 0. 此为C/C++的SourceInsight配置文件,其他语言的为默认。(字体颜色在其他编程语言有效) 1. 主要就是给那些习惯于等宽字体编程的人们。采用微软Vista自带的等宽字体:...
Source Insight 常用设置和最佳配色
Source Insight 是一个功能十分强大、 使用也很方便的程序编辑器。 它内置对 C/C++ 、 Java 甚至 x86 汇编语言程序的解析,在你编程时提供有用的函数、宏、参数等提示,因而, Source Insight 正在国际、国内众多的 ...
SourceInsight4.0编辑宏命令的步骤.pdf 简述通过sourceinsight中如何编辑和使用自定义的宏来快速添加注释