UltraEdit 紧密匹配大括号

UltraEdit close matching brace

在大多数文本编辑器中,如果您输入 {"(您懂的),编辑器会自动输入相反的字符,并将光标放在两者之间。我注意到 UltraEdit 不会这样做。有什么方法可以设置 UltraEdit 以关闭匹配的括号?

UltraEdit for Windows v23.20 引入了智能插入大括号和引号的功能 Brace 自动完成String 自动完成.

Brace auto-completion

  • Brace pairs defined in wordfile are auto-closed when opening brace is typed
  • If no braces in wordfile, or if file is not syntax highlighted, "()", "{}", and "[]" are used as defaults
  • Pressing Enter will reposition close brace on separate line while maintaining proper indent levels
  • Pressing Backspace immediately following auto-completion will remove both opening and closing brace
  • Typing close brace skips over auto-completed close brace without inserting second brace
  • Can be disabled for non-highlighted (plain text) files
  • Can be disabled for comments and strings

String auto-completion

  • Can be disabled for non-highlighted (plain text) files
  • Can be disabled for comments

可以在 Editor - Braces / strings.

的配置中找到用于自定义这两个功能的设置

UEStudio v16.20 引入了与 Windows v23.20 的 UltraEdit 相同的功能和相同的配置设置。

UEStudio 的早期版本,IDE 以 UltraEdit 作为核心编辑引擎,从一开始就具有这些功能,可以在 IDE 的配置中自定义 - IntelliTips - 杂项 通过从菜单 Advanced 打开并单击菜单项 Configuration 或单击功能区选项卡 Advanced 在项目 设置上 .

但是 Windows v23.20 之前的 UltraEdit 版本没有这些功能。

但是,{} 之间设置插入符号的非智能插入可以通过按下键插入 { 分配给宏的宏轻松实现作为热键。

我在

上的回答中解释了如何创建一个或多个新的 UltraEdit 宏一起保存到一个宏文件中,该宏文件被配置为在 UltraEdit 启动时自动加载

{ 的 UltraEdit 宏代码是:

InsertMode
"{}"
Key LEFT ARROW

相同的概念可用于:

双引号

InsertMode
""""
Key LEFT ARROW

左方括号

InsertMode
"[]"
Key LEFT ARROW

和左圆括号

InsertMode
"()"
Key LEFT ARROW

也可以为某些文件类型自定义宏,例如:

IfExtIs "c"
InsertMode
"{}"
Key LEFT ARROW
ExitMacro
EndIf
IfExtIs "cpp"
InsertMode
"{}"
Key LEFT ARROW
ExitMacro
EndIf
IfExtIs "h"
InsertMode
"{}"
Key LEFT ARROW
ExitMacro
EndIf
"{"

只有当活动文件的文件扩展名是 c 时,此宏才会在按下 { 的键时将 } 添加到 {cpph(无论如何)。对于所有其他文件,在活动模式(插入或重写模式)下按下宏的热键只需输入 {

我建议插入 () 一个更智能的宏代码:

InsertMode
"("
IfCharIs 13
")"
Key LEFT ARROW
ExitMacro
EndIf
IfCharIs 10
")"
Key LEFT ARROW
ExitMacro
EndIf
IfEof
")"
Key LEFT ARROW
EndIf

这个宏先插入才(。如果下一个字符是回车符 return(十进制值 13)或换行符(十进制值 10)或插入符号位于文件末尾,则另外插入 ) 并且插入符号位于括号之间.在所有其他情况下,只有 ( 被插入到活动文件中。

此增强功能可以修改像

这样的条件
if(iVar == 1 || iVar == 3)

if((iVar == 1) || (iVar == 3))

暂时没有得到

if(()iVar == 1 || iVar == 3)

if((iVar == 1) || ()iVar == 3)

在这种情况下需要按 DEL 键来删除插入的内容,但在中间某处插入 ( 之后不需要的 ) 是很烦人的一行。