1:打开Source Insight,打开项目,选择基本
2:打开右边文件Utils.em,它是Source Insight启动时候执行的文件,里面都是宏,有兴趣的朋友可以自己添加一些宏命令进去,这里我们要添加一个宏,就是让Backspace删除一个字,在Utils.em末尾添加宏:
macro SuperBackspace() { hwnd = GetCurrentWnd(); hbuf = GetCurrentBuf(); if (hbuf == 0) stop; // empty buffer // get current cursor postion ipos = GetWndSelIchFirst(hwnd); // get current line number ln = GetBufLnCur(hbuf); if ((GetBufSelText(hbuf) != "") || (GetWndSelLnFirst(hwnd) != GetWndSelLnLast(hwnd))) { // sth. was selected, del selection SetBufSelText(hbuf, " "); // stupid & buggy sourceinsight :( // del the " " SuperBackspace(1); stop; } // copy current line text = GetBufLine(hbuf, ln); // get string length len = strlen(text); // if the cursor is at the start of line, combine with prev line if (ipos == 0 || len == 0) { if (ln <= 0) stop; // top of file ln = ln - 1; // do not use "ln--" for compatibility with older versions prevline = GetBufLine(hbuf, ln); prevlen = strlen(prevline); // combine two lines text = cat(prevline, text); // del two lines DelBufLine(hbuf, ln); DelBufLine(hbuf, ln); // insert the combined one InsBufLine(hbuf, ln, text); // set the cursor position SetBufIns(hbuf, ln, prevlen); stop; } num = 1; // del one char if (ipos >= 1) { // process Chinese character i = 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 character num = 2; // This idiot does not support mod and bitwise operators if ((count / 2 * 2 != count) && (ipos < len)) ipos = ipos + 1; // adjust cursor position } } // keeping safe if (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; }
3:关闭Source Insight,再打开,选择选项->键关联,把宏关联到BackSpace上,然后重启,就搞定了