📄 smart_indent.html
字号:
<HTML><HEAD><TITLE> Customizing </TITLE></HEAD><BODY><A NAME="Smart_Indent_Macros"></A><H2> Smart Indent Macros </H2><P>Smart indent macros can be written for any language, but are usually moredifficult to write than highlighting patterns. A good place to start, ofcourse, is to look at the existing macros for C and C++.</P><P>Smart indent macros for a language mode consist of standard NEdit macrolanguage code attached to any or all of the following three activationconditions: 1) When smart indent is first turned on for a text windowcontaining code of the language, 2) When a newline is typed and smart indentis expected, 3) after any character is typed. To attach macro code to any ofthese code "hooks", enter it in the appropriate section in the Preferences ->Default Settings -> Auto Indent -> Program Smart Indent dialog.</P><P>Typically most of the code should go in the initialization section, becausethat is the appropriate place for subroutine definitions, and smart indentmacros are complicated enough that you are not likely to want to write themas one monolithic run of code. You may also put code in the Common/SharedInitialization section (accessible through the button in the upper leftcorner of the dialog). Unfortunately, since the C/C++ macros also reside inthe common/shared section, when you add code there, you run some risk ofmissing out on future upgrades to these macros, because your changes willoverride the built-in defaults.</P><P>The newline macro is invoked after the user types a newline, but before thenewline is entered in the buffer. It takes a single argument ($1) which isthe position at which the newline will be inserted. It must return thenumber of characters of indentation the line should have, or -1. A returnvalue of -1 means to do a standard auto-indent. You must supply a newlinemacro, but the code: "return -1" (auto-indent), or "return 0" (no indent) issufficient.</P><P>The type-in macro takes two arguments. $1 is the insert position, and $2 isthe character just inserted, and does not return a value. You can do justabout anything here, but keep in mind that this macro is executed for everykeystroke typed, so if you try to get too fancy, you may degrade performance.<P><HR></P><P></P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -