📄 nedit.html
字号:
disturbed (the usual interpretation of a rectangular selection), but text tothe right of the selection is included in the operation and is pulled in tothe selected region. This method enables you to fill text to an arbitraryright margin, without going back and forth to the wrap-margin dialog, as wellas to exclude text to the left of the selection such as comment bars or othertext columns.<P><HR></P><P><A NAME="File_Format"></A><H2> File Format </H2></P><P>While plain-text is probably the simplest and most interchangeable fileformat in the computer world, there is still variation in what plain-textmeans from system to system. Plain-text files can differ in character set,line termination, and wrapping.</P><P>While character set differences are the most obvious and pose the mostchallenge to portability, they affect NEdit only indirectly via the same fontand localization mechanisms common to all X applications. If your system isset up properly, you will probably never see character-set related problemsin NEdit. NEdit can not display Unicode text files, or any multi-bytecharacter set.</P><P>The primary difference between an MS DOS format file and a Unix format file,is how the lines are terminated. Unix uses a single newline character. MSDOS uses a carriage-return and a newline. NEdit can read and write both fileformats, but internally, it uses the single character Unix standard. NEditauto-detects MS DOS format files based on the line termination at the startof the file. Files are judged to be DOS format if all of the first five lineterminators, within a maximum range, are DOS-style. To change the format inwhich NEdit writes a file from DOS to Unix or visa versa, use the Save As...command and check or un-check the MS DOS Format button.</P><P>Wrapping within text files can vary among individual users, as well as fromsystem to system. Both Windows and MacOS make frequent use of plain textfiles with no implicit right margin. In these files, wrapping is determinedby the tool which displays them. Files of this style also exist on Unixsystems, despite the fact that they are not supported by all Unix utilities. To display this kind of file properly in NEdit, you have to select the wrapstyle called Continuous. Wrapping modes are discussed in the sections:Customizing -> Preferences, and Basic Operation -> Shifting and Filling.</P><P>The last and most minute of format differences is the terminating newline. Some Unix compilers and utilities require a final terminating newline on allfiles they read and fail in various ways on files which do not have it. Viand approximately half of Unix editors enforce the terminating newline on allfiles that they write; Emacs does not enforce this rule. Users are dividedon which is best. NEdit makes the final terminating newline optional(Preferences -> Default Settings -> Terminate with Line Break on Save).<P><HR></P><P><A NAME="Features_for_Programming"></A><H1> Features for Programming </H1></P><P><A NAME="Programming_with_NEdit"></A><H2> Programming with NEdit </H2></P><P>Though general in appearance, NEdit has many features intended specificallyfor programmers. Major programming-related topics are listed in separatesections under the heading: "Features for Programming": <A HREF="#Syntax_Highlighting">Syntax Highlighting</A>,<A HREF="#Tabs/Emulated_Tabs">Tabs/Emulated Tabs</A>, <A HREF="#Finding_Declarations_(ctags)">Finding Declarations (ctags)</A>, <A HREF="#Calltips">Calltips</A>, and <A HREF="#Auto/Smart_Indent">Auto/Smart Indent</A>. Minor topics related to programming are discussed below:</P><P><H3>Language Modes</H3></P><P>When NEdit initially reads a file, it attempts to determine whether the fileis in one of the computer languages that it knows about. Knowing what languagea file is written in allows NEdit to assign highlight patterns and smart indentmacros, and to set language specific preferences like word delimiters, tabemulation, and auto-indent. Language mode can be recognized from both the filename and from the first 200 characters of content. Language mode recognitionand language-specific preferences are configured in: Preferences -> DefaultSettings -> Language Modes....</P><P>You can set the language mode manually for a window, by selecting it from themenu: Preferences -> Language Modes.</P><P><H3>Backlighting [EXPERIMENTAL]</H3></P><P>NEdit can be made to set the background color of particular classes ofcharacters to allow easy identification of those characters. This isparticularly useful if you need to be able to distiguish between tabsand spaces in a file where the difference is important. The colors usedfor backlighting are specified by a resource, "nedit*backlightCharTypes". You can turn backlighting on and off through thePreferences -> Apply Backlighting menu entry.</P><P>If you prefer to have backlighting turned on for all new windows, usethe Preferences -> Default Settings -> Apply Backlighting menu entry. This settings can be saved along with other preferences using Preferences -> Save Defaults.</P><P><B>Important:</B> In future versions of NEdit, the backlighting feature will beextended and reworked such that it becomes easier to configure. The currentway of controlling it through a resource is generally considered to be belowNEdit's usability standards. These future changes are likely to beincompatible with the current format of the "nedit*backlightCharTypes"resource, though. Therefore, it is expected that there will be no automaticmigration path for users who customize the resource.</P><P><H3>Line Numbers</H3></P><P>To find a particular line in a source file by line number, choose Goto Line#... from the Search menu. You can also directly select the line number textin the compiler message in the terminal emulator window (xterm, decterm,winterm, etc.) where you ran the compiler, and choose Goto Selected from theSearch menu.</P><P>To find out the line number of a particular line in your file, turn onStatistics Line in the Preferences menu and position the insertion pointanywhere on the line. The statistics line continuously updates the line numberof the line containing the cursor.</P><P>To go to a specific column on a given line, choose Goto Line #... from theSearch menu and enter a line number and a column number separated by a comma. (e.g. Enter "100,12" for line 100 column 12.) If you want to go toa column on the current line just leave out the line number. (e.g. Enter",45" to go the column 45 on the current line.)</P><P><H3>Matching Parentheses</H3></P><P>To help you inspect nested parentheses, brackets, braces, quotes, and othercharacters, NEdit has both an automatic parenthesis matching mode, and a GotoMatching command. Automatic parenthesis matching is activated when you type,or move the insertion cursor after a parenthesis, bracket, or brace. Itmomentarily highlights either the opposite character ('Delimiter') or theentire expression ('Range') when the opposite character is visible in thewindow. To find a matching character anywhere in the file, select it orposition the cursor after it, and choose Goto Matching from the Search menu. If the character matches itself, such as a quote or slash, select the firstcharacter of the pair. NEdit will match {, (, [, <, ", ', `, /, and \.Holding the Shift key while typing the accelerator key (Shift+Ctrl+M, bydefault), will select all of the text between the matching characters.</P><P>When syntax highlighting is enabled, the matching routines can optionallymake use of the syntax information for improved accuracy. In that case,a brace inside a highlighted string will not match a brace inside a comment,for instance.</P><P><H3>Opening Included Files</H3></P><P>The Open Selected command in the File menu understands the C preprocessor's#include syntax, so selecting an #include line and invoking Open Selected willgenerally find the file referred to, unless doing so depends on the settings ofcompiler switches or other information not available to NEdit.</P><P><H3>Interface to Programming Tools</H3></P><P>Integrated software development environments such as SGI's CaseVision andCenterline Software's Code Center, can be interfaced directly with NEdit viathe client server interface. These tools allow you to click directly oncompiler and runtime error messages and request NEdit to open files, and selectlines of interest. The easiest method is usually to use the tool's interfacefor character-based editors like vi, to invoke nc, but programmatic interfacescan also be derived using the source code for nc.</P><P>There are also some simple compile/review, grep, ctree, and ctags browsersavailable in the NEdit contrib directory on ftp.nedit.org.<P><HR></P><P><A NAME="Tabs/Emulated_Tabs"></A><H2> Tabs/Emulated Tabs </H2></P><P><H3>Changing the Tab Distance</H3></P><P>Tabs are important for programming in languages which use indentation to shownesting, as short-hand for producing white-space for leading indents. As aprogrammer, you have to decide how to use indentation, and how or whether tabcharacters map to your indentation scheme.</P><P>Ideally, tab characters map directly to the amount of indent that you use todistinguish nesting levels in your code. Unfortunately, the Unix standardfor interpretation of tab characters is eight characters (probably datingback to mechanical capabilities of the original teletype), which is usuallytoo coarse for a single indent.</P><P>Most text editors, NEdit included, allow you to change the interpretation ofthe tab character, and many programmers take advantage of this, and set theirtabs to 3 or 4 characters to match their programming style. In NEdit you setthe hardware tab distance in Preferences -> Tabs... for the current window,or Preferences -> Default Settings -> Tabs... (general), or Preferences ->Default Settings -> Language Modes... (language-specific) to change thedefaults for future windows.</P><P>Changing the meaning of the tab character makes programming much easier whileyou're in the editor, but can cause you headaches outside of the editor,because there is no way to pass along the tab setting as part of a plain-textfile. All of the other tools which display, print, and otherwise processyour source code have to be made aware of how the tabs are set, and must beable to handle the change. Non-standard tabs can also confuse otherprogrammers, or make editing your code difficult for them if their texteditors don't support changes in tab distance.</P><P><H3>Emulated Tabs</H3></P><P>An alternative to changing the interpretation of the tab character is tabemulation. In the Tabs... dialog(s), turning on Emulated Tabs causes the Tabkey to insert the correct number of spaces and/or tabs to bring the cursorthe next emulated tab stop, as if tabs were set at the emulated tab distancerather than the hardware tab distance. Backspacing immediately after enteringan emulated tab will delete the fictitious tab as a unit, but as soon as youmove the cursor away from the spot, NEdit will forget that the collection ofspaces and tabs is a tab, and will treat it as separate characters. To entera real tab character with "Emulate Tabs" turned on, use Ctrl+Tab.</P><P>It is also possible to tell NEdit not to insert ANY tab characters at all inthe course of processing emulated tabs, and in shifting and rectangularinsertion/deletion operations, for programmers who worry about themisinterpretation of tab characters on other systems.<P><HR></P><P><A NAME="Auto/Smart_Indent"></A><H2> Auto/Smart Indent </H2></P><P>Programmers who use structured languages usually require some form ofautomatic indent, so that they don't have to continually re-type thesequences of tabs and/or spaces needed to maintain lengthy running indents. NEdit therefore offers "smart" indent, in addition to the traditionalautomatic indent which simply lines up the cursor position with the previousline.</P><P><H3>Smart Indent</H3></P><P>Smart indent macros are only available by default for C and C++, and whilethese can easily be configured for different default indentation distances,they may not conform to everyone's exact C programming style. Smart indentis programmed in terms of macros in the NEdit macro language which can beentered in: Preferences -> Default Settings -> Indent -> Program SmartIndent. Hooks are provided for intervening at the point that a newline isentered, either via the user pressing the Enter key, or throughauto-wrapping; and for arbitrary type-in to act on specific characters typed.</P><P>To type a newline character without invoking smart-indent when operating insmart-indent mode, hold the Shift key while pressing the Return or Enter key.</P><P><H3>Auto-Indent</H3></P><P>With Indent set to Auto (the default), NEdit keeps a running indent. Whenyou press the Return or Enter key, spaces and tabs are inserted to line upthe insert point under the start of the previous line.</P><P>Regardless of indent-mode, Ctrl+Return always does the automatic indent;Shift+Return always does a return without indent.</P><P><H3>Block Indentation Adjustment</H3></P><P>The Shift Left and Shift Right commands as well as rectangular dragging canbe used to adjust the indentation for several lines at once. To shift ablock of text one character to the right, select the text, then choose ShiftRight from the Edit menu. Note that the accelerator keys for these menuitems are Ctrl+9 and Ctrl+0, which correspond to the right and leftparenthesis on most keyboards. Remember them as adjusting the text in thedirection pointed to by the parenthesis character. Holding the Shift keywhile selecting either Shift Left or Shift Right will shift the text by onetab stop (or by one emulated tab stop if tab emulation is turned on). Thehelp section "Shifting and Filling" under "Basic Operation" has details.<P><HR></P><P><A NAME="Syntax_Highlighting"></A><H2> Syntax Highlighting </H2></P><P>Syntax Highlighting means using colors and fonts to help distinguish languageelements in programming languages and other types of structured files. Programmers use syntax highlighting to understand code faster and better, andto spot many kinds of syntax errors more quickly.</P><P>To use syntax highlighting in NEdit, select Highlight Syntax in thePreferences menu. If NEdit recognizes the computer language that you areusing, and highlighting rules (patterns) are available for that language, itwill highlight your text, and maintain the highlighting, automatically, asyou type.</P><P>If NEdit doesn't correctly recognize the type of the file you are editing,you can manually select a language mode from Language Modes in thePreferences menu. You can also program the method that NEdit uses torecognize language modes in Preferences -> Default Settings -> LanguageModes....</P><P>If no highlighting patterns are available for the language that you want touse, you can create new patterns relatively quickly. The Help section"<A HREF="#Highlighting_Patterns">Highlighting Patterns</A>" under "Customizing", has details.</P><P>If you are satisfied with what NEdit is highlighting, but would like it to
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -