3.0版本_完美支持中文注释
- Project→Open Project,打开Base项目,将文中代码框中的所有内容函数复制到utils.em文件的最后;
- 重启SourceInsight;
- Options→Key Assignments,将下面宏依次与相应按键绑定:
- Marco: SuperBackspace绑定到BackSpace键;
- Marco: SuperCursorLeft绑定到<-键,
- Marco: SuperCursorRight绑定到->键,
- Marco: SuperShiftCursorLeft绑定到Shift+<-,
- Macro: SuperShiftCursorRight绑定到shift+->,
- Macro: SuperDelete绑定到del
Enjoy
/*======================================================================1、BackSpace后退键======================================================================*/macro SuperBackspace(){hwnd = GetCurrentWnd();hbuf = GetCurrentBuf();if(hbuf == 0)stop;// empty buffer//get current cursor postionipos = GetWndSelIchFirst(hwnd);//get current line numberln = GetBufLnCur(hbuf);if((GetBufSelText(hbuf)!="")||(GetWndSelLnFirst(hwnd)!= GetWndSelLnLast(hwnd))){// sth. was selected, del selectionSetBufSelText(hbuf," ");// stupid & buggy sourceinsight// del the " "SuperBackspace(1);stop;}// copy current linetext = GetBufLine(hbuf, ln);//getstring lengthlen = strlen(text);//if the cursor is at the start of line, combine with prev lineif(ipos == 0 || len == 0){if(ln <= 0)stop;// top of fileln = ln - 1;//donot use "ln--"for compatibility with older versionsprevline = GetBufLine(hbuf, ln);prevlen = strlen(prevline);// combine two linestext = cat(prevline, text);// del two linesDelBufLine(hbuf, ln);DelBufLine(hbuf, ln);// insert the combined oneInsBufLine(hbuf, ln, text);//set the cursor positionSetBufIns(hbuf, ln, prevlen);stop;}num = 1;// del one charif(ipos >= 1){// process Chinese characteri = ipos;count = 0;while(AsciiFromChar(text[i - 1])>= 160){i = i - 1;count = count + 1;if(i == 0)break;}if(count > 0){// I think it might be a two-byte characternum = 2;// This idiot does not support modand bitwise operatorsif((count / 2 * 2 != count)&&(ipos < len))ipos = ipos + 1;// adjust cursor position}}// keeping safeif(ipos - num < 0)num = ipos;// del char(s)text = cat(strmid(text, 0, ipos - num), strmid(text, ipos, len));DelBufLine(hbuf, ln);InsBufLine(hbuf, ln, text);SetBufIns(hbuf, ln, ipos - num);stop;}/*======================================================================2、删除键——SuperDelete.em======================================================================*/macro SuperDelete(){hwnd = GetCurrentWnd();hbuf = GetCurrentBuf();if(hbuf == 0)stop;// empty buffer//get current cursor postionipos = GetWndSelIchFirst(hwnd);//get current line numberln = GetBufLnCur(hbuf);if((GetBufSelText(hbuf)!="")||(GetWndSelLnFirst(hwnd)!= GetWndSelLnLast(hwnd))){// sth. was selected, del selectionSetBufSelText(hbuf," ");// stupid & buggy sourceinsight// del the " "SuperDelete(1);stop;}// copy current linetext = GetBufLine(hbuf, ln);//getstring lengthlen = strlen(text);if(ipos == len || len == 0){totalLn = GetBufLineCount (hbuf);lastText = GetBufLine(hBuf, totalLn-1);lastLen = strlen(lastText);if(ipos == lastLen)//end of filestop;ln = ln + 1;//donot use "ln--"for compatibility with older versionsnextline = GetBufLine(hbuf, ln);nextlen = strlen(nextline);// combine two linestext = cat(text, nextline);// del two linesDelBufLine(hbuf, ln-1);DelBufLine(hbuf, ln-1);// insert the combined oneInsBufLine(hbuf, ln-1, text);//set the cursor positionSetBufIns(hbuf, ln-1, len);stop;}num = 1;// del one charif(ipos > 0){// process Chinese characteri = ipos;count = 0;while(AsciiFromChar(text[i-1])>= 160){i = i - 1;count = count + 1;if(i == 0)break;}if(count > 0){// I think it might be a two-byte characternum = 2;// This idiot does not support modand bitwise operatorsif(((count / 2 * 2 != count)|| count == 0)&&(ipos < len-1))ipos = ipos + 1;// adjust cursor position}// keeping safeif(ipos - num < 0)num = ipos;}else{i = ipos;count = 0;while(AsciiFromChar(text)>= 160){i = i + 1;count = count + 1;if(i == len-1)break;}if(count > 0){num = 2;}}text = cat(strmid(text, 0, ipos), strmid(text, ipos+num, len));DelBufLine(hbuf, ln);InsBufLine(hbuf, ln, text);SetBufIns(hbuf, ln, ipos);stop;}/*======================================================================3、左移键——SuperCursorLeft.em======================================================================*/macro IsComplexCharacter(){hwnd = GetCurrentWnd();hbuf = GetCurrentBuf();if(hbuf == 0)return 0;//当前位置pos = GetWndSelIchFirst(hwnd);//当前行数ln = GetBufLnCur(hbuf);//得到当前行text = GetBufLine(hbuf, ln);//得到当前行长度len = strlen(text);//从头计算汉字字符的个数if(pos > 0){i=pos;count=0;while(AsciiFromChar(text[i-1])>= 160){i = i - 1;count = count+1;if(i == 0)break;}if((count/2)*2==count|| count==0)return 0;elsereturn 1;}return 0;}macro moveleft(){hwnd = GetCurrentWnd();hbuf = GetCurrentBuf();if(hbuf == 0)stop;// empty bufferln = GetBufLnCur(hbuf);ipos = GetWndSelIchFirst(hwnd);if(GetBufSelText(hbuf)!=""||(ipos == 0 && ln == 0))// 第0行或者是选中文字,则不移动{SetBufIns(hbuf, ln, ipos);stop;}if(ipos == 0){preLine = GetBufLine(hbuf, ln-1);SetBufIns(hBuf, ln-1, strlen(preLine)-1);}else{SetBufIns(hBuf, ln, ipos-1);}}macro SuperCursorLeft(){moveleft();if(IsComplexCharacter())moveleft();}/*======================================================================4、右移键——SuperCursorRight.em======================================================================*/macro moveRight(){hwnd = GetCurrentWnd();hbuf = GetCurrentBuf();if(hbuf == 0)stop;// empty bufferln = GetBufLnCur(hbuf);ipos = GetWndSelIchFirst(hwnd);totalLn = GetBufLineCount(hbuf);text = GetBufLine(hbuf, ln);if(GetBufSelText(hbuf)!="")//选中文字{ipos = GetWndSelIchLim(hwnd);ln = GetWndSelLnLast(hwnd);SetBufIns(hbuf, ln, ipos);stop;}if(ipos == strlen(text)-1 && ln == totalLn-1)// 末行stop;if(ipos == strlen(text)){SetBufIns(hBuf, ln+1, 0);}else{SetBufIns(hBuf, ln, ipos+1);}}macro SuperCursorRight(){moveRight();if(IsComplexCharacter())// defined in SuperCursorLeft.emmoveRight();}/*======================================================================5、shift+右移键——ShiftCursorRight.em======================================================================*/macro IsShiftRightComplexCharacter(){hwnd = GetCurrentWnd();hbuf = GetCurrentBuf();if(hbuf == 0)return 0;selRec = GetWndSel(hwnd);pos = selRec.ichLim;ln = selRec.lnLast;text = GetBufLine(hbuf, ln);len = strlen(text);if(len == 0 || len < pos)return 1;//Msg("@len@;@pos@;");if(pos > 0){i=pos;count=0;while(AsciiFromChar(text[i-1])>= 160){i = i - 1;count = count+1;if(i == 0)break;}if((count/2)*2==count|| count==0)return 0;elsereturn 1;}return 0;}macro shiftMoveRight(){hwnd = GetCurrentWnd();hbuf = GetCurrentBuf();if(hbuf == 0)stop;ln = GetBufLnCur(hbuf);ipos = GetWndSelIchFirst(hwnd);totalLn = GetBufLineCount(hbuf);text = GetBufLine(hbuf, ln);selRec = GetWndSel(hwnd);curLen = GetBufLineLength(hbuf, selRec.lnLast);if(selRec.ichLim == curLen+1 || curLen == 0){if(selRec.lnLast == totalLn -1)stop;selRec.lnLast = selRec.lnLast + 1;selRec.ichLim = 1;SetWndSel(hwnd, selRec);if(IsShiftRightComplexCharacter())shiftMoveRight();stop;}selRec.ichLim = selRec.ichLim+1;SetWndSel(hwnd, selRec);}macro SuperShiftCursorRight(){if(IsComplexCharacter())SuperCursorRight();shiftMoveRight();if(IsShiftRightComplexCharacter())shiftMoveRight();}/*======================================================================6、shift+左移键——ShiftCursorLeft.em======================================================================*/macro IsShiftLeftComplexCharacter(){hwnd = GetCurrentWnd();hbuf = GetCurrentBuf();if(hbuf == 0)return 0;selRec = GetWndSel(hwnd);pos = selRec.ichFirst;ln = selRec.lnFirst;text = GetBufLine(hbuf, ln);len = strlen(text);if(len == 0 || len < pos)return 1;//Msg("@len@;@pos@;");if(pos > 0){i=pos;count=0;while(AsciiFromChar(text[i-1])>= 160){i = i - 1;count = count+1;if(i == 0)break;}if((count/2)*2==count|| count==0)return 0;elsereturn 1;}return 0;}macro shiftMoveLeft(){hwnd = GetCurrentWnd();hbuf = GetCurrentBuf();if(hbuf == 0)stop;ln = GetBufLnCur(hbuf);ipos = GetWndSelIchFirst(hwnd);totalLn = GetBufLineCount(hbuf);text = GetBufLine(hbuf, ln);selRec = GetWndSel(hwnd);//curLen = GetBufLineLength(hbuf, selRec.lnFirst);//Msg("@curLen@;@selRec@");if(selRec.ichFirst == 0){if(selRec.lnFirst == 0)stop;selRec.lnFirst = selRec.lnFirst - 1;selRec.ichFirst = GetBufLineLength(hbuf, selRec.lnFirst)-1;SetWndSel(hwnd, selRec);if(IsShiftLeftComplexCharacter())shiftMoveLeft();stop;}selRec.ichFirst = selRec.ichFirst-1;SetWndSel(hwnd, selRec);}macro SuperShiftCursorLeft(){if(IsComplexCharacter())SuperCursorLeft();shiftMoveLeft();if(IsShiftLeftComplexCharacter())shiftMoveLeft();}/*---END---*/
注:解决source insight 中文间距的方法:默认情况下,往Source Insight里输入中文,字间距相当的大,要解决这个问题,具体设置如下:
Options->Style Properties在左边
Style Name下找到Comment Multi Line和Comment,在其右边对应的Font属性框下的 Font Name中选“Pick...” 设置为宋体、常规、小四。确定,退回Style Properties界面,Size设为10。最后设置Clolors框下Foreground,点“Pick...”选择一种自己喜欢的颜色就OK了。3.0版本_配置文件
2019.01.01SourceInsight_3.0配置文件.cf3.7z
4.0版本_配置文件
2019.01.01SourceInsight_4.0配置文件.xml
4.0版本_破解版下载地址
2020.01.26最新:https://www.onlinedown.net/soft/15056.htm
https://blog.csdn.net/biubiuibiu/article/details/78044232 解压密码:biu单行删除
字符等宽
点击
view- 点击
draft view
设置大括号缩进
设置步骤3:在【Auto Indent】设置页面中,中间一段如图,翻译过来就是图中的文字,即为智能缩进选项:开始处缩进,结束处缩进,分别对应前半个大括号{,和后半个大括号}。如果都不想要缩进,只需要去掉两个勾调,然后点击【OK】进行设置。
关闭上述的缩进
恢复 Ctrl+A 的全选功能
- 点击
Options - 点击
Key Assignments - 在快捷键列表中搜索关键词
save,找到save all(保存全部),将其快捷键更改为Ctrl + Shift + a 搜索关键词
select找到select all(选择全部),将其快捷键更改为Ctrl + a关闭 Folder Browser 的实时浏览
默认配置下
Folder Browser是会实时浏览的,也即当前查看的是哪个文件,Folder Browser便会自动切换到该文件目录,但有时我们可能并不需要这个功能,而是希望Folder Browser一直指向一个指定的目录。
取消流程:打开
Folder Browser窗口- 空白位置右键,打开
Project Folder Browser Options 取消
Options下的Select the folder and file entry of the current file标题栏路径显示完整路径
OptionsPreferencesDisplayTrim long path names with ellipses(把复选框的勾选去掉)
trim vt. 修剪;整理;装点 vi. 削减 n. 修剪;整齐;情形 adj. 整齐的 ellipses n. 椭圆(ellipse的复数);省略号(ellipsis的复数)
宏函数
添加方式
- 打开SI默认的Base项目
- 将下面的宏加入到类似
utils.em的文件中 - 搜索宏,设置快捷键,或者设置面板按键
宏函数代码
// 插入单行注释,设置按键为 ctrl + q,只在单行中有效,不选中任何字符的话就在光标处插入一对杠星注释符macro WCY_InsertOneLineComment(){hbuf = GetCurrentBuf() // 获取当前句柄str = GetBufSelText(hbuf) // 获取框选内str = cat("/* ",str)str = cat(str," */")SetBufSelText (hbuf, str) // 将当前框选内容用str替换}macro WCY_InsertSection(){hbuf = GetCurrentBuf()ln = GetBufLnCur(hbuf)InsBufLine(hbuf, ln+0, "/**************************************************************************************************************")InsBufLine(hbuf, ln+1, " xxx")InsBufLine(hbuf, ln+2, " **************************************************************************************************************/")}macro WCY_InsertFileHeader(){hbuf = GetCurrentBuf()ln = GetBufLnCur(hbuf)InsBufLine(hbuf, ln+0, "/*")InsBufLine(hbuf, ln+1, " Desc:")InsBufLine(hbuf, ln+2, " Date:")InsBufLine(hbuf, ln+3, " Author:")InsBufLine(hbuf, ln+4, " */")}macro WCY_InsertFunctionHeader(){hbuf = GetCurrentBuf()ln = GetBufLnCur(hbuf)InsBufLine(hbuf, ln+0, "/*****************************************************************")InsBufLine(hbuf, ln+1, " * DESCRIPTION:")InsBufLine(hbuf, ln+2, " * N")InsBufLine(hbuf, ln+3, " * INPUTS:")InsBufLine(hbuf, ln+4, " * N")InsBufLine(hbuf, ln+5, " * OUTPUTS:")InsBufLine(hbuf, ln+6, " * N")InsBufLine(hbuf, ln+7, " * RETURNS:")InsBufLine(hbuf, ln+8, " * N")InsBufLine(hbuf, ln+9, " * NOTES:")InsBufLine(hbuf, ln+10, " * N")InsBufLine(hbuf, ln+11, " *****************************************************************/")}
