3.0版本_完美支持中文注释

  1. Project→Open Project,打开Base项目,将文中代码框中的所有内容函数复制到utils.em文件的最后;
  2. 重启SourceInsight;
  3. Options→Key Assignments,将下面宏依次与相应按键绑定:
    • Marco: SuperBackspace绑定到BackSpace键;
    • Marco: SuperCursorLeft绑定到<-键,
    • Marco: SuperCursorRight绑定到->键,
    • Marco: SuperShiftCursorLeft绑定到Shift+<-,
    • Macro: SuperShiftCursorRight绑定到shift+->,
    • Macro: SuperDelete绑定到del
  4. Enjoy

    1. /*======================================================================
    2. 1、BackSpace后退键
    3. ======================================================================*/
    4. macro SuperBackspace()
    5. {
    6. hwnd = GetCurrentWnd();
    7. hbuf = GetCurrentBuf();
    8. if(hbuf == 0)
    9. stop;// empty buffer
    10. //get current cursor postion
    11. ipos = GetWndSelIchFirst(hwnd);
    12. //get current line number
    13. ln = GetBufLnCur(hbuf);
    14. if((GetBufSelText(hbuf)!="")||(GetWndSelLnFirst(hwnd)!= GetWndSelLnLast(hwnd))){
    15. // sth. was selected, del selection
    16. SetBufSelText(hbuf," ");// stupid & buggy sourceinsight
    17. // del the " "
    18. SuperBackspace(1);
    19. stop;
    20. }
    21. // copy current line
    22. text = GetBufLine(hbuf, ln);
    23. //getstring length
    24. len = strlen(text);
    25. //if the cursor is at the start of line, combine with prev line
    26. if(ipos == 0 || len == 0){
    27. if(ln <= 0)
    28. stop;// top of file
    29. ln = ln - 1;//donot use "ln--"for compatibility with older versions
    30. prevline = GetBufLine(hbuf, ln);
    31. prevlen = strlen(prevline);
    32. // combine two lines
    33. text = cat(prevline, text);
    34. // del two lines
    35. DelBufLine(hbuf, ln);
    36. DelBufLine(hbuf, ln);
    37. // insert the combined one
    38. InsBufLine(hbuf, ln, text);
    39. //set the cursor position
    40. SetBufIns(hbuf, ln, prevlen);
    41. stop;
    42. }
    43. num = 1;// del one char
    44. if(ipos >= 1){
    45. // process Chinese character
    46. i = ipos;
    47. count = 0;
    48. while(AsciiFromChar(text[i - 1])>= 160){
    49. i = i - 1;
    50. count = count + 1;
    51. if(i == 0)
    52. break;
    53. }
    54. if(count > 0){
    55. // I think it might be a two-byte character
    56. num = 2;
    57. // This idiot does not support modand bitwise operators
    58. if((count / 2 * 2 != count)&&(ipos < len))
    59. ipos = ipos + 1;// adjust cursor position
    60. }
    61. }
    62. // keeping safe
    63. if(ipos - num < 0)
    64. num = ipos;
    65. // del char(s)
    66. text = cat(strmid(text, 0, ipos - num), strmid(text, ipos, len));
    67. DelBufLine(hbuf, ln);
    68. InsBufLine(hbuf, ln, text);
    69. SetBufIns(hbuf, ln, ipos - num);
    70. stop;
    71. }
    72. /*======================================================================
    73. 2、删除键——SuperDelete.em
    74. ======================================================================*/
    75. macro SuperDelete()
    76. {
    77. hwnd = GetCurrentWnd();
    78. hbuf = GetCurrentBuf();
    79. if(hbuf == 0)
    80. stop;// empty buffer
    81. //get current cursor postion
    82. ipos = GetWndSelIchFirst(hwnd);
    83. //get current line number
    84. ln = GetBufLnCur(hbuf);
    85. if((GetBufSelText(hbuf)!="")||(GetWndSelLnFirst(hwnd)!= GetWndSelLnLast(hwnd))){
    86. // sth. was selected, del selection
    87. SetBufSelText(hbuf," ");// stupid & buggy sourceinsight
    88. // del the " "
    89. SuperDelete(1);
    90. stop;
    91. }
    92. // copy current line
    93. text = GetBufLine(hbuf, ln);
    94. //getstring length
    95. len = strlen(text);
    96. if(ipos == len || len == 0){
    97. totalLn = GetBufLineCount (hbuf);
    98. lastText = GetBufLine(hBuf, totalLn-1);
    99. lastLen = strlen(lastText);
    100. if(ipos == lastLen)//end of file
    101. stop;
    102. ln = ln + 1;//donot use "ln--"for compatibility with older versions
    103. nextline = GetBufLine(hbuf, ln);
    104. nextlen = strlen(nextline);
    105. // combine two lines
    106. text = cat(text, nextline);
    107. // del two lines
    108. DelBufLine(hbuf, ln-1);
    109. DelBufLine(hbuf, ln-1);
    110. // insert the combined one
    111. InsBufLine(hbuf, ln-1, text);
    112. //set the cursor position
    113. SetBufIns(hbuf, ln-1, len);
    114. stop;
    115. }
    116. num = 1;// del one char
    117. if(ipos > 0){
    118. // process Chinese character
    119. i = ipos;
    120. count = 0;
    121. while(AsciiFromChar(text[i-1])>= 160){
    122. i = i - 1;
    123. count = count + 1;
    124. if(i == 0)
    125. break;
    126. }
    127. if(count > 0){
    128. // I think it might be a two-byte character
    129. num = 2;
    130. // This idiot does not support modand bitwise operators
    131. if(((count / 2 * 2 != count)|| count == 0)&&(ipos < len-1))
    132. ipos = ipos + 1;// adjust cursor position
    133. }
    134. // keeping safe
    135. if(ipos - num < 0)
    136. num = ipos;
    137. }
    138. else{
    139. i = ipos;
    140. count = 0;
    141. while(AsciiFromChar(text)>= 160){
    142. i = i + 1;
    143. count = count + 1;
    144. if(i == len-1)
    145. break;
    146. }
    147. if(count > 0){
    148. num = 2;
    149. }
    150. }
    151. text = cat(strmid(text, 0, ipos), strmid(text, ipos+num, len));
    152. DelBufLine(hbuf, ln);
    153. InsBufLine(hbuf, ln, text);
    154. SetBufIns(hbuf, ln, ipos);
    155. stop;
    156. }
    157. /*======================================================================
    158. 3、左移键——SuperCursorLeft.em
    159. ======================================================================*/
    160. macro IsComplexCharacter()
    161. {
    162. hwnd = GetCurrentWnd();
    163. hbuf = GetCurrentBuf();
    164. if(hbuf == 0)
    165. return 0;
    166. //当前位置
    167. pos = GetWndSelIchFirst(hwnd);
    168. //当前行数
    169. ln = GetBufLnCur(hbuf);
    170. //得到当前行
    171. text = GetBufLine(hbuf, ln);
    172. //得到当前行长度
    173. len = strlen(text);
    174. //从头计算汉字字符的个数
    175. if(pos > 0)
    176. {
    177. i=pos;
    178. count=0;
    179. while(AsciiFromChar(text[i-1])>= 160)
    180. {
    181. i = i - 1;
    182. count = count+1;
    183. if(i == 0)
    184. break;
    185. }
    186. if((count/2)*2==count|| count==0)
    187. return 0;
    188. else
    189. return 1;
    190. }
    191. return 0;
    192. }
    193. macro moveleft()
    194. {
    195. hwnd = GetCurrentWnd();
    196. hbuf = GetCurrentBuf();
    197. if(hbuf == 0)
    198. stop;// empty buffer
    199. ln = GetBufLnCur(hbuf);
    200. ipos = GetWndSelIchFirst(hwnd);
    201. if(GetBufSelText(hbuf)!=""||(ipos == 0 && ln == 0))// 第0行或者是选中文字,则不移动
    202. {
    203. SetBufIns(hbuf, ln, ipos);
    204. stop;
    205. }
    206. if(ipos == 0)
    207. {
    208. preLine = GetBufLine(hbuf, ln-1);
    209. SetBufIns(hBuf, ln-1, strlen(preLine)-1);
    210. }
    211. else
    212. {
    213. SetBufIns(hBuf, ln, ipos-1);
    214. }
    215. }
    216. macro SuperCursorLeft()
    217. {
    218. moveleft();
    219. if(IsComplexCharacter())
    220. moveleft();
    221. }
    222. /*======================================================================
    223. 4、右移键——SuperCursorRight.em
    224. ======================================================================*/
    225. macro moveRight()
    226. {
    227. hwnd = GetCurrentWnd();
    228. hbuf = GetCurrentBuf();
    229. if(hbuf == 0)
    230. stop;// empty buffer
    231. ln = GetBufLnCur(hbuf);
    232. ipos = GetWndSelIchFirst(hwnd);
    233. totalLn = GetBufLineCount(hbuf);
    234. text = GetBufLine(hbuf, ln);
    235. if(GetBufSelText(hbuf)!="")//选中文字
    236. {
    237. ipos = GetWndSelIchLim(hwnd);
    238. ln = GetWndSelLnLast(hwnd);
    239. SetBufIns(hbuf, ln, ipos);
    240. stop;
    241. }
    242. if(ipos == strlen(text)-1 && ln == totalLn-1)// 末行
    243. stop;
    244. if(ipos == strlen(text))
    245. {
    246. SetBufIns(hBuf, ln+1, 0);
    247. }
    248. else
    249. {
    250. SetBufIns(hBuf, ln, ipos+1);
    251. }
    252. }
    253. macro SuperCursorRight()
    254. {
    255. moveRight();
    256. if(IsComplexCharacter())// defined in SuperCursorLeft.em
    257. moveRight();
    258. }
    259. /*======================================================================
    260. 5、shift+右移键——ShiftCursorRight.em
    261. ======================================================================*/
    262. macro IsShiftRightComplexCharacter()
    263. {
    264. hwnd = GetCurrentWnd();
    265. hbuf = GetCurrentBuf();
    266. if(hbuf == 0)
    267. return 0;
    268. selRec = GetWndSel(hwnd);
    269. pos = selRec.ichLim;
    270. ln = selRec.lnLast;
    271. text = GetBufLine(hbuf, ln);
    272. len = strlen(text);
    273. if(len == 0 || len < pos)
    274. return 1;
    275. //Msg("@len@;@pos@;");
    276. if(pos > 0)
    277. {
    278. i=pos;
    279. count=0;
    280. while(AsciiFromChar(text[i-1])>= 160)
    281. {
    282. i = i - 1;
    283. count = count+1;
    284. if(i == 0)
    285. break;
    286. }
    287. if((count/2)*2==count|| count==0)
    288. return 0;
    289. else
    290. return 1;
    291. }
    292. return 0;
    293. }
    294. macro shiftMoveRight()
    295. {
    296. hwnd = GetCurrentWnd();
    297. hbuf = GetCurrentBuf();
    298. if(hbuf == 0)
    299. stop;
    300. ln = GetBufLnCur(hbuf);
    301. ipos = GetWndSelIchFirst(hwnd);
    302. totalLn = GetBufLineCount(hbuf);
    303. text = GetBufLine(hbuf, ln);
    304. selRec = GetWndSel(hwnd);
    305. curLen = GetBufLineLength(hbuf, selRec.lnLast);
    306. if(selRec.ichLim == curLen+1 || curLen == 0)
    307. {
    308. if(selRec.lnLast == totalLn -1)
    309. stop;
    310. selRec.lnLast = selRec.lnLast + 1;
    311. selRec.ichLim = 1;
    312. SetWndSel(hwnd, selRec);
    313. if(IsShiftRightComplexCharacter())
    314. shiftMoveRight();
    315. stop;
    316. }
    317. selRec.ichLim = selRec.ichLim+1;
    318. SetWndSel(hwnd, selRec);
    319. }
    320. macro SuperShiftCursorRight()
    321. {
    322. if(IsComplexCharacter())
    323. SuperCursorRight();
    324. shiftMoveRight();
    325. if(IsShiftRightComplexCharacter())
    326. shiftMoveRight();
    327. }
    328. /*======================================================================
    329. 6、shift+左移键——ShiftCursorLeft.em
    330. ======================================================================*/
    331. macro IsShiftLeftComplexCharacter()
    332. {
    333. hwnd = GetCurrentWnd();
    334. hbuf = GetCurrentBuf();
    335. if(hbuf == 0)
    336. return 0;
    337. selRec = GetWndSel(hwnd);
    338. pos = selRec.ichFirst;
    339. ln = selRec.lnFirst;
    340. text = GetBufLine(hbuf, ln);
    341. len = strlen(text);
    342. if(len == 0 || len < pos)
    343. return 1;
    344. //Msg("@len@;@pos@;");
    345. if(pos > 0)
    346. {
    347. i=pos;
    348. count=0;
    349. while(AsciiFromChar(text[i-1])>= 160)
    350. {
    351. i = i - 1;
    352. count = count+1;
    353. if(i == 0)
    354. break;
    355. }
    356. if((count/2)*2==count|| count==0)
    357. return 0;
    358. else
    359. return 1;
    360. }
    361. return 0;
    362. }
    363. macro shiftMoveLeft()
    364. {
    365. hwnd = GetCurrentWnd();
    366. hbuf = GetCurrentBuf();
    367. if(hbuf == 0)
    368. stop;
    369. ln = GetBufLnCur(hbuf);
    370. ipos = GetWndSelIchFirst(hwnd);
    371. totalLn = GetBufLineCount(hbuf);
    372. text = GetBufLine(hbuf, ln);
    373. selRec = GetWndSel(hwnd);
    374. //curLen = GetBufLineLength(hbuf, selRec.lnFirst);
    375. //Msg("@curLen@;@selRec@");
    376. if(selRec.ichFirst == 0)
    377. {
    378. if(selRec.lnFirst == 0)
    379. stop;
    380. selRec.lnFirst = selRec.lnFirst - 1;
    381. selRec.ichFirst = GetBufLineLength(hbuf, selRec.lnFirst)-1;
    382. SetWndSel(hwnd, selRec);
    383. if(IsShiftLeftComplexCharacter())
    384. shiftMoveLeft();
    385. stop;
    386. }
    387. selRec.ichFirst = selRec.ichFirst-1;
    388. SetWndSel(hwnd, selRec);
    389. }
    390. macro SuperShiftCursorLeft()
    391. {
    392. if(IsComplexCharacter())
    393. SuperCursorLeft();
    394. shiftMoveLeft();
    395. if(IsShiftLeftComplexCharacter())
    396. shiftMoveLeft();
    397. }
    398. /*---END---*/

    注:解决source insight 中文间距的方法:默认情况下,往Source Insight里输入中文,字间距相当的大,要解决这个问题,具体设置如下:

  5. Options->Style Properties

  6. 在左边Style Name下找到Comment Multi LineComment,在其右边对应的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

    单行删除

    找到对应宏,设置快捷键为 ctrl + D
    image.png

    字符等宽

  7. 点击view

  8. 点击draft view

或者使用快捷键:Alt + F12

设置大括号缩进

设置步骤3:在【Auto Indent】设置页面中,中间一段如图,翻译过来就是图中的文字,即为智能缩进选项:开始处缩进,结束处缩进,分别对应前半个大括号{,和后半个大括号}。如果都不想要缩进,只需要去掉两个勾调,然后点击【OK】进行设置。
image.png
关闭上述的缩进

恢复 Ctrl+A 的全选功能

  1. 点击Options
  2. 点击Key Assignments
  3. 在快捷键列表中搜索关键词save,找到save all(保存全部),将其快捷键更改为Ctrl + Shift + a
  4. 搜索关键词select找到select all(选择全部),将其快捷键更改为Ctrl + a

    关闭 Folder Browser 的实时浏览

    默认配置下Folder Browser是会实时浏览的,也即当前查看的是哪个文件,Folder Browser便会自动切换到该文件目录,但有时我们可能并不需要这个功能,而是希望Folder Browser一直指向一个指定的目录。
    取消流程:

  5. 打开Folder Browser窗口

  6. 空白位置右键,打开Project Folder Browser Options
  7. 取消Options下的Select the folder and file entry of the current file

    标题栏路径显示完整路径

  8. Options

  9. Preferences
  10. Display
  11. Trim long path names with ellipses(把复选框的勾选去掉)

trim vt. 修剪;整理;装点 vi. 削减 n. 修剪;整齐;情形 adj. 整齐的 ellipses n. 椭圆(ellipse的复数);省略号(ellipsis的复数)

宏函数

添加方式

  1. 打开SI默认的Base项目
  2. 将下面的宏加入到类似 utils.em 的文件中
  3. 搜索宏,设置快捷键,或者设置面板按键

image.png

宏函数代码

  1. // 插入单行注释,设置按键为 ctrl + q,只在单行中有效,不选中任何字符的话就在光标处插入一对杠星注释符
  2. macro WCY_InsertOneLineComment()
  3. {
  4. hbuf = GetCurrentBuf() // 获取当前句柄
  5. str = GetBufSelText(hbuf) // 获取框选内
  6. str = cat("/* ",str)
  7. str = cat(str," */")
  8. SetBufSelText (hbuf, str) // 将当前框选内容用str替换
  9. }
  10. macro WCY_InsertSection()
  11. {
  12. hbuf = GetCurrentBuf()
  13. ln = GetBufLnCur(hbuf)
  14. InsBufLine(hbuf, ln+0, "/**************************************************************************************************************")
  15. InsBufLine(hbuf, ln+1, " xxx")
  16. InsBufLine(hbuf, ln+2, " **************************************************************************************************************/")
  17. }
  18. macro WCY_InsertFileHeader()
  19. {
  20. hbuf = GetCurrentBuf()
  21. ln = GetBufLnCur(hbuf)
  22. InsBufLine(hbuf, ln+0, "/*")
  23. InsBufLine(hbuf, ln+1, " Desc:")
  24. InsBufLine(hbuf, ln+2, " Date:")
  25. InsBufLine(hbuf, ln+3, " Author:")
  26. InsBufLine(hbuf, ln+4, " */")
  27. }
  28. macro WCY_InsertFunctionHeader()
  29. {
  30. hbuf = GetCurrentBuf()
  31. ln = GetBufLnCur(hbuf)
  32. InsBufLine(hbuf, ln+0, "/*****************************************************************")
  33. InsBufLine(hbuf, ln+1, " * DESCRIPTION:")
  34. InsBufLine(hbuf, ln+2, " * N")
  35. InsBufLine(hbuf, ln+3, " * INPUTS:")
  36. InsBufLine(hbuf, ln+4, " * N")
  37. InsBufLine(hbuf, ln+5, " * OUTPUTS:")
  38. InsBufLine(hbuf, ln+6, " * N")
  39. InsBufLine(hbuf, ln+7, " * RETURNS:")
  40. InsBufLine(hbuf, ln+8, " * N")
  41. InsBufLine(hbuf, ln+9, " * NOTES:")
  42. InsBufLine(hbuf, ln+10, " * N")
  43. InsBufLine(hbuf, ln+11, " *****************************************************************/")
  44. }