分享一下source insight 3.5的快捷配置及我的utils.em

这周重新装了一下系统,原来系统32位WIN7,实在是浪费了CPU和内存。

装完以后,简直是...虚拟机5秒就启动完成了,电脑也不会卡了。

重新配置source insight 3.5

分享一下整理的utils.em

修改了一些网上的函数。

使用上需要完成:

1. 配置电脑环境变量MYNAME=***

2.将文件替换原始原件(open project:base   Utils.em)

3.设置各种功能快捷


插入文件注释
    1.  Options菜单 Key assignments,通过关键词为macro InsertFileHeader,指定快捷键ctrl+shift+f。

    2. Options菜单Menu assignments,通过关键词为macro InsertFileHeader,  insert 到edit cut.

    3. 重启SourceInsight后,可以使用快捷键盘为文件自动生成注释


插入函数注释
1. Options菜单 Key assignments,为macro InsertHeader,指定快捷键ctrl+shift+h

2. Options菜单Menu assignments,通过关键词为macro InsertHeader,  insert 到edit cut.

3. 重启 SourceInsight后,可以使用快捷键盘为函数自动生成注释

 使用SupperBack完成中文操作
1. Options菜单 Key assignments,通过关键词为macro SuperBackspace, 指定快捷键:backspace
(这里会提示已经有相应功能,无视提示。后续对Utils.em的删除只能用delete键,或者shift+backspace)
2. 重启 SourceInsight后,可以自动操作中文,不会产生乱码问题。

使用InsertIfdef完成#ifdef宏块
    1. Options菜单 Key assignments,通过关键词为macro InsertIfdef,指定快捷键ctrl+d
    2. Options菜单Menu assignments, 通过关键词为macro InsertIfdef,  添加到edit cut.

选中代码多行注释功能
    1. Options菜单 Key assignments,通过关键词为macro CodeComment,指定快捷键ctrl+/
    2. Options菜单Menu assignments, 通过关键词为macro CodeComment,  添加到edit cut.

代码屏蔽#if 0
    1. Options菜单 Key assignments,通过关键词为macro MacroComment,指定快捷键ctrl+0
    2. Options菜单Menu assignments, 通过关键词为macro MacroComment,  添加到edit cut.

完成TAB和空格的替换
1. Options菜单 Key assignments,通过关键词为macro Save_Tabs_To_Spaces指定快捷键ctrl+shift+空格

2. Options菜单Menu assignments,通过关键词为macro InsertFileHeader,  insert 到edit cut.

3. 重启 SourceInsight后,使用快捷键可以替换选中文字中的TAB为空格,并保存。
 
程序的自动补全功能
1. Options菜单 Key assignments,通过关键词为macro AutoExpand指定快捷键ctrl+shift+a
2. 重启 SourceInsight后,在输入while、for、do、if等c++关键词后,使用快捷键可以自动生成区块框架。
恢复文本全选功能

         1. Options菜单Key assignments,通过关键词select找到select all, 更改为ctrl +a.(无视提示冲突)

关闭其他打开文件

         1. Options菜单Key assignments,通过关键词macro CloseOldWindows, 更改为ctrl+shift +w.(无视提示冲突)


/* 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)

    InsBufLine(hbuf, ln, "/************************************************************");
    ln = ln +1

    // 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
    } 
    InsBufLine(hbuf, ln, sz)
    ln = ln + 1

    InsBufLine(hbuf, ln, "** 功能描述: ")
    ln = ln + 1

    InsBufLine(hbuf, ln, "** 输入参数:")
    ln = ln + 1

    InsBufLine(hbuf, ln, "** 输出参数: ")
    ln = ln + 1

    InsBufLine(hbuf, ln, "** 返 回 值    :")
    ln = ln + 1

    /* if owner variable exists, insert Owner: name */
    if (strlen(szMyName) > 0)
    {
        InsBufLine(hbuf, ln, "** 作    者       :  @szMyName@")                 
    }
    else
    {
        InsBufLine(hbuf, ln, "** 作    者       :  ")                 
    }
    ln = ln + 1

    // Get current time
    szTime  = GetSysTime(1)
    Day      = szTime.Day
    Month   = szTime.Month
    Year     = szTime.Year
    if (Day < 10)
        szDay = "0@Day@"
    else
        szDay = Day  

    InsBufLine(hbuf, ln, "** 日    期       :  @Year@年@Month@月@szDay@日")
    ln = ln + 1

    InsBufLine(hbuf, ln, "** 版    本       :  1.0")
    ln = ln + 1

    InsBufLine(hbuf, ln, "** 修改日期  版本号   修改人  修改内容")
    ln = ln + 1

    InsBufLine(hbuf, ln, "**************************************************************/")
}


/* 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, "/***************************************************************************")
    InsBufLine(hbuf, 1, "** 版权所有:  Desay Copyright (c) 2010-2015  ********************             ")
    filename = GetBufName(hbuf)
    InsBufLine(hbuf, 2, "** 文件名称:  @filename@")
    InsBufLine(hbuf, 3, "** 文件标识: ")
    InsBufLine(hbuf, 4, "** 内容摘要:  ")
    InsBufLine(hbuf, 5, "** 当前版本:  v1.0")

    /* if owner variable exists, insert Owner: name */
    if (strlen(szMyName) > 0)
    {
        sz = "** 作      者     :  @szMyName@"
    }
    else
    {
        sz = "** 作      者     :"
    }

    InsBufLine(hbuf, 6, sz)

    // Get current time
    szTime  = GetSysTime(1)
    Day      = szTime.Day
    Month   = szTime.Month
    Year     = szTime.Year
    if (Day < 10)
        szDay = "0@Day@"
    else
        szDay = Day               

    InsBufLine(hbuf, 7,   "** 完成日期: @Year@年@Month@月@szDay@日")
    InsBufLine(hbuf, 8,   "** 修改记录: ")
    InsBufLine(hbuf, 9,   "** 修改记录: ")
    InsBufLine(hbuf, 10, "** 修改日期: ")
    InsBufLine(hbuf, 11, "** 版本号      : ")
    InsBufLine(hbuf, 12, "
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值