Fix typo in last commit (replace * with @*)
[nedit.git] / doc / nedit.html
blob8664fc12df01478cbb2b56d2dfdb6070719f2258
1 <HTML>
2 <HEAD>
3 <TITLE>Nirvana Editor (NEdit) Help Documentation</TITLE>
4 </HEAD>
5 <BODY>
6 <P>
7 <A NAME="Nirvana_Editor_(NEdit)_Help_Documentation"</A>
8 <H1> Nirvana Editor (NEdit) Help Documentation </H1>
9 <P>
10 <A NAME="Table_of_Contents"</A>
11 <H2> Table of Contents </H2>
12 <P>
13 <PRE>
14 <A HREF="#Getting_Started">Getting Started</A>
15 </PRE>
16 <P>
17 <PRE>
18 Basic Operation Macro/Shell Extensions
19 <A HREF="#Selecting_Text">Selecting Text</A> <A HREF="#Shell_Commands_and_Filters">Shell Commands and Filters</A>
20 <A HREF="#Finding_and_Replacing_Text">Finding and Replacing Text</A> <A HREF="#Learn/Replay">Learn/Replay</A>
21 <A HREF="#Cut_and_Paste">Cut and Paste</A> <A HREF="#Macro_Language">Macro Language</A>
22 <A HREF="#Using_the_Mouse">Using the Mouse</A> <A HREF="#Macro_Subroutines">Macro Subroutines</A>
23 <A HREF="#Keyboard_Shortcuts">Keyboard Shortcuts</A> <A HREF="#Action_Routines">Action Routines</A>
24 <A HREF="#Shifting_and_Filling">Shifting and Filling</A>
25 <A HREF="#File_Format">File Format</A>
26 Customizing
27 Features for Programming <A HREF="#Customizing_NEdit">Customizing NEdit</A>
28 <A HREF="#Programming_with_NEdit">Programming with NEdit</A> <A HREF="#Preferences">Preferences</A>
29 <A HREF="#Tabs/Emulated_Tabs">Tabs/Emulated Tabs</A> <A HREF="#X_Resources">X Resources</A>
30 <A HREF="#Auto/Smart_Indent">Auto/Smart Indent</A> <A HREF="#Key_Binding">Key Binding</A>
31 <A HREF="#Syntax_Highlighting">Syntax Highlighting</A> <A HREF="#Highlighting_Patterns">Highlighting Patterns</A>
32 <A HREF="#Finding_Declarations_(ctags)">Finding Declarations (ctags)</A> <A HREF="#Smart_Indent_Macros">Smart Indent Macros</A>
33 <A HREF="#Calltips">Calltips</A>
34 </PRE>
35 <P>
36 <PRE>
37 Regular Expressions <A HREF="#NEdit_Command_Line">NEdit Command Line</A>
38 <A HREF="#Basic_Regular_Expression_Syntax">Basic Regular Expression Syntax</A> <A HREF="#Client/Server_Mode">Client/Server Mode</A>
39 <A HREF="#Metacharacters">Metacharacters</A> <A HREF="#Crash_Recovery">Crash Recovery</A>
40 <A HREF="#Parenthetical_Constructs">Parenthetical Constructs</A> <A HREF="#Version">Version</A>
41 <A HREF="#Advanced_Topics">Advanced Topics</A> <A HREF="#Distribution_Policy">Distribution Policy</A>
42 <A HREF="#Example_Regular_Expressions">Example Regular Expressions</A> <A HREF="#Mailing_Lists">Mailing Lists</A>
43 <A HREF="#Problems/Defects">Problems/Defects</A>
44 </PRE>
45 <P>
46 <A NAME="Getting_Started"</A>
47 <H2> Getting Started </H2>
48 <P>
49 Welcome to NEdit!
50 <P>
51 NEdit is a standard GUI (Graphical User Interface) style text editor for
52 programs and plain-text files. Users of Macintosh and MS Windows based text
53 editors should find NEdit a familiar and comfortable environment. NEdit
54 provides all of the standard menu, dialog, editing, and mouse support, as
55 well as all of the standard shortcuts to which the users of modern GUI based
56 environments are accustomed. For users of older style Unix editors, welcome
57 to the world of mouse-based editing!
58 <P>
59 Help sections of interest to new users are listed under the "Basic Operation"
60 heading in the top-level Help menu:
61 <P>
62 <UL>
63 <LI> <A HREF="#Selecting_Text">Selecting Text</A>
64 <LI> <A HREF="#Finding_and_Replacing_Text">Finding and Replacing Text</A>
65 <LI> <A HREF="#Cut_and_Paste">Cut and Paste</A>
66 <LI> <A HREF="#Using_the_Mouse">Using the Mouse</A>
67 <LI> <A HREF="#Keyboard_Shortcuts">Keyboard Shortcuts</A>
68 <LI> <A HREF="#Shifting_and_Filling">Shifting and Filling</A>
69 </UL>
70 <P>
71 Programmers should also read the introductory section under the "Features for
72 Programming" section:
73 <P>
74 <PRE>
75 <A HREF="#Programming_with_NEdit">Programming with NEdit</A>
76 </PRE>
77 <P>
78 If you get into trouble, the Undo command in the Edit menu can reverse any
79 modifications that you make. NEdit does not change the file you are editing
80 until you tell it to Save.
81 <P>
82 <H3>Editing an Existing File</H3>
83 <P>
84 To open an existing file, choose Open... from the file menu. Select the file
85 that you want to open in the pop-up dialog that appears and click on OK. You
86 may open any number of files at the same time. Each file will appear in its
87 own editor window. Using Open... rather than re-typing the NEdit command and
88 running additional copies of NEdit, will give you quick access to all of the
89 files you have open via the Windows menu, and ensure that you don't
90 accidentally open the same file twice. NEdit has no "main" window. It
91 remains running as long as at least one editor window is open.
92 <P>
93 <H3>Creating a New File</H3>
94 <P>
95 If you already have an empty (Untitled) window displayed, just begin typing
96 in the window. To create a new Untitled window, choose New from the File
97 menu. To give the file a name and save its contents to the disk, choose Save
98 or Save As... from the File menu.
99 <P>
100 <H3>Backup Files</H3>
102 NEdit maintains periodic backups of the file you are editing so that you can
103 recover the file in the event of a problem such as a system crash, network
104 failure, or X server crash. These files are saved under the name `~filename`
105 (on Unix) or `_filename` (on VMS), where filename is the name of the file you
106 were editing. If an NEdit process is killed, some of these backup files may
107 remain in your directory. (To remove one of these files on Unix, you may
108 have to prefix the `~' (tilde) character with a (backslash) to prevent the
109 shell from interpreting it as a special character.)
111 <H3>Shortcuts</H3>
113 As you become more familiar with NEdit, substitute the control and function
114 keys shown on the right side of the menus for pulling down menus with the
115 mouse.
117 Dialogs are also streamlined so you can enter information quickly and without
118 using the mouse*. To move the keyboard focus around a dialog, use the tab
119 and arrow keys. One of the buttons in a dialog is usually drawn with a
120 thick, indented, outline. This button can be activated by pressing Return or
121 Enter. The Cancel or Dismiss button can be activated by pressing escape.
122 For example, to replace the string "thing" with "things" type:
124 <PRE>
125 &#60;ctrl-r&#62;thing&#60;tab&#62;things&#60;return&#62;
126 </PRE>
128 To open a file named "whole_earth.c", type:
130 <PRE>
131 &#60;ctrl-o&#62;who&#60;return&#62;
132 </PRE>
134 (how much of the filename you need to type depends on the other files in the
135 directory). See the section called "<A HREF="#Keyboard_Shortcuts">Keyboard Shortcuts</A>" for more details.
137 * Users who have set their keyboard focus mode to "pointer" should set
138 "Popups Under Pointer" in the Default Settings menu to avoid the additional
139 step of moving the mouse into the dialog.
140 <P><HR>
142 <A NAME="Basic_Operation"</A>
143 <H1> Basic Operation </H1>
145 <A NAME="Selecting_Text"</A>
146 <H2> Selecting Text </H2>
148 NEdit has two general types of selections, primary (highlighted text), and
149 secondary (underlined text). Selections can cover either a simple range of
150 text between two points in the file, or they can cover a rectangular area of
151 the file. Rectangular selections are only useful with non-proportional (fixed
152 spacing) fonts.
154 To select text for copying, deleting, or replacing, press the left mouse
155 button with the pointer at one end of the text you want to select, and drag
156 it to the other end. The text will become highlighted. To select a whole
157 word, double click (click twice quickly in succession). Double clicking and
158 then dragging the mouse will select a number of words. Similarly, you can
159 select a whole line or a number of lines by triple clicking or triple
160 clicking and dragging. Quadruple clicking selects the whole file. After
161 releasing the mouse button, you can still adjust a selection by holding down
162 the shift key and dragging on either end of the selection. To delete the
163 selected text, press delete or backspace. To replace it, begin typing.
165 To select a rectangle or column of text, hold the Ctrl key while dragging the
166 mouse. Rectangular selections can be used in any context that normal
167 selections can be used, including cutting and pasting, filling, shifting,
168 dragging, and searching. Operations on rectangular selections automatically
169 fill in tabs and spaces to maintain alignment of text within and to the right
170 of the selection. Note that the interpretation of rectangular selections by
171 Fill Paragraph is slightly different from that of other commands, the section
172 titled "<A HREF="#Shifting_and_Filling">Shifting and Filling</A>" has details.
174 The middle mouse button can be used to make an additional selection (called
175 the secondary selection). As soon as the button is released, the contents of
176 this selection will be copied to the insert position of the window where the
177 mouse was last clicked (the destination window). This position is marked by a
178 caret shaped cursor when the mouse is outside of the destination window. If
179 there is a (primary) selection, adjacent to the cursor in the window, the new
180 text will replace the selected text. Holding the shift key while making the
181 secondary selection will move the text, deleting it at the site of the
182 secondary selection, rather than copying it.
184 Selected text can also be dragged to a new location in the file using the
185 middle mouse button. Holding the shift key while dragging the text will copy
186 the selected text, leaving the original text in place. Holding the control
187 key will drag the text in overlay mode.
189 Normally, dragging moves text by removing it from the selected position at
190 the start of the drag, and inserting it at a new position relative to to the
191 mouse. Dragging a block of text over existing characters, displaces the
192 characters to the end of the selection. In overlay mode, characters which are
193 occluded by blocks of text being dragged are simply removed. When dragging
194 non-rectangular selections, overlay mode also converts the selection to
195 rectangular form, allowing it to be dragged outside of the bounds of the
196 existing text.
198 The section "<A HREF="#Using_the_Mouse">Using the Mouse</A>" sumarizes the mouse commands for making primary
199 and secondary selections. Primary selections can also be made via keyboard
200 commands, see "<A HREF="#Keyboard_Shortcuts">Keyboard Shortcuts</A>".
201 <P><HR>
203 <A NAME="Finding_and_Replacing_Text"</A>
204 <H2> Finding and Replacing Text </H2>
206 The Search menu contains a number of commands for finding and replacing text.
208 The Find... and Replace... commands present dialogs for entering text for
209 searching and replacing. These dialogs also allow you to choose whether you
210 want the search to be sensitive to upper and lower case, or whether to use
211 the standard Unix pattern matching characters (regular expressions).
212 Searches begin at the current text insertion position.
214 Find Again and Replace Again repeat the last find or replace command without
215 prompting for search strings. To selectively replace text, use the two
216 commands in combination: Find Again, then Replace Again if the highlighted
217 string should be replaced, or Find Again again to go to the next string.
219 Find Selection searches for the text contained in the current primary
220 selection (see <A HREF="#Selecting_Text">Selecting Text</A>). The selected text does not have to be in the
221 current editor window, it may even be in another program. For example, if
222 the word dog appears somewhere in a window on your screen, and you want to
223 find it in the file you are editing, select the word dog by dragging the
224 mouse across it, switch to your NEdit window and choose Find Selection from
225 the Search menu.
227 Find Incremental is yet another variation on searching, where every character
228 typed triggers a new search. Incremental searching is generally the quickest
229 way to find something in a file, because it gives you the immediate feedback
230 of seeing how your search is progressing, so you never need to type more than
231 the minimally sufficient search string to reach your target.
233 <H3>Searching Backwards</H3>
235 Holding down the shift key while choosing any of the search or replace
236 commands from the menu (or using the keyboard shortcut), will search in the
237 reverse direction. Users who have set the search direction using the buttons
238 in the search dialog, may find it a bit confusing that Find Again and Replace
239 Again don't continue in the same direction as the original search (for
240 experienced users, consistency of the direction implied by the shift key is
241 more important).
243 <H3>Selective Replacement</H3>
245 To replace only some occurrences of a string within a file, choose Replace...
246 from the Search menu, enter the string to search for and the string to
247 substitute, and finish by pressing the Find button. When the first
248 occurrence is highlighted, use either Replace Again (^T) to replace it, or
249 Find Again (^G) to move to the next occurrence without replacing it, and
250 continue in such a manner through all occurrences of interest.
252 To replace all occurrences of a string within some range of text, select the
253 range (see <A HREF="#Selecting_Text">Selecting Text</A>), choose Replace... from the Search menu, type the
254 string to search for and the string to substitute, and press the "R. in
255 Selection" button in the dialog. Note that selecting text in the Replace...
256 dialog will unselect the text in the window.
257 <P><HR>
259 <A NAME="Cut_and_Paste"</A>
260 <H2> Cut and Paste </H2>
262 The easiest way to copy and move text around in your file or between windows,
263 is to use the clipboard, an imaginary area that temporarily stores text and
264 data. The Cut command removes the selected text (see <A HREF="#Selecting_Text">Selecting Text</A>) from
265 your file and places it in the clipboard. Once text is in the clipboard, the
266 Paste command will copy it to the insert position in the current window. For
267 example, to move some text from one place to another, select it by dragging
268 the mouse over it, choose Cut to remove it, click the pointer to move the
269 insert point where you want the text inserted, then choose Paste to insert
270 it. Copy copies text to the clipboard without deleting it from your file.
271 You can also use the clipboard to transfer text to and from other Motif
272 programs and X programs which make proper use of the clipboard.
274 There are many other methods for copying and moving text within NEdit windows
275 and between NEdit and other programs. The most common such method is
276 clicking the middle mouse button to copy the primary selection (to the
277 clicked position). Copying the selection by clicking the middle mouse button
278 in many cases is the only way to transfer data to and from many X programs.
279 Holding the Shift key while clicking the middle mouse button moves the text,
280 deleting it from its original position, rather than copying it. Other
281 methods for transferring text include secondary selections, primary selection
282 dragging, keyboard-based selection copying, and drag and drop. These are
283 described in detail in the sections: "<A HREF="#Selecting_Text">Selecting Text</A>", "<A HREF="#Using_the_Mouse">Using the Mouse</A>",
284 and "<A HREF="#Keyboard_Shortcuts">Keyboard Shortcuts</A>".
285 <P><HR>
287 <A NAME="Using_the_Mouse"</A>
288 <H2> Using the Mouse </H2>
290 Mouse-based editing is what NEdit is all about, and learning to use the more
291 advanced features like secondary selections and primary selection dragging
292 will be well worth your while.
294 If you don't have time to learn everything, you can get by adequately with
295 just the left mouse button: Clicking the left button moves the cursor.
296 Dragging with the left button makes a selection. Holding the shift key while
297 clicking extends the existing selection, or begins a selection between the
298 cursor and the mouse. Double or triple clicking selects a whole word or a
299 whole line.
301 This section will make more sense if you also read the section called,
302 "<A HREF="#Selecting_Text">Selecting Text</A>", which explains the terminology of selections, that is,
303 what is meant by primary, secondary, rectangular, etc.
305 <H3>Button and Modifier Key Summary</H3>
307 General meaning of mouse buttons and modifier keys:
309 <H4> Buttons</H4>
311 <PRE>
312 Button 1 (left) Cursor position and primary selection
313 </PRE>
315 <PRE>
316 Button 2 (middle) Secondary selections, and dragging and
317 copying the primary selection
318 </PRE>
320 <PRE>
321 Button 3 (right) Quick-access programmable menu and pan
322 scrolling
323 </PRE>
325 <H4> Modifier keys</H4>
327 <PRE>
328 Shift On primary selections, (left mouse button):
329 Extends selection to the mouse pointer
330 On secondary and copy operations, (middle):
331 Toggles between move and copy
332 </PRE>
334 <PRE>
335 Ctrl Makes selection rectangular or insertion
336 columnar
337 </PRE>
339 <PRE>
340 Alt* (on release) Exchange primary and secondary
341 selections.
342 </PRE>
344 <H3>Left Mouse Button</H3>
346 The left mouse button is used to position the cursor and to make primary
347 selections.
349 <PRE>
350 Click Moves the cursor
351 </PRE>
353 <PRE>
354 Double Click Selects a whole word
355 </PRE>
357 <PRE>
358 Triple Click Selects a whole line
359 </PRE>
361 <PRE>
362 Quad Click Selects the whole file
363 </PRE>
365 <PRE>
366 Shift Click Adjusts (extends or shrinks) the
367 selection, or if there is no existing
368 selection, begins a new selection
369 between the cursor and the mouse.
370 </PRE>
372 <PRE>
373 Ctrl+Shift+ Adjusts (extends or shrinks) the
374 Click selection rectangularly.
375 </PRE>
377 <PRE>
378 Drag Selects text between where the mouse
379 was pressed and where it was released.
380 </PRE>
382 <PRE>
383 Ctrl+Drag Selects rectangle between where the
384 mouse was pressed and where it was
385 released.
386 </PRE>
388 <H3>Right Mouse Button</H3>
390 The right mouse button posts a programmable menu for frequently used commands.
392 <PRE>
393 Click/Drag Pops up the background menu (programmed
394 from Preferences -&#62; Default Settings -&#62;
395 Customize Menus -&#62; Window Background).
396 </PRE>
398 <PRE>
399 Ctrl+Drag Pan scrolling. Scrolls the window
400 both vertically and horizontally, as if
401 you had grabbed it with your mouse.
402 </PRE>
404 <H3>Middle Mouse Button</H3>
406 The middle mouse button is for making secondary selections, and copying and
407 dragging the primary selection.
409 <PRE>
410 Click Copies the primary selection to the
411 clicked position.
412 </PRE>
414 <PRE>
415 Shift+Click Moves the primary selection to the
416 clicked position, deleting it from its
417 original position.
418 </PRE>
420 <PRE>
421 Drag 1) Outside of the primary selection:
422 Begins a secondary selection.
423 2) Inside of the primary selection:
424 Moves the selection by dragging.
425 </PRE>
427 <PRE>
428 Ctrl+Drag 1) Outside of the primary selection:
429 Begins a rectangular secondary
430 selection.
431 2) Inside of the primary selection:
432 Drags the selection in overlay
433 mode (see below).
434 </PRE>
436 When the mouse button is released after creating a secondary selection:
438 <PRE>
439 No Modifiers If there is a primary selection,
440 replaces it with the secondary
441 selection. Otherwise, inserts the
442 secondary selection at the cursor
443 position.
444 </PRE>
446 <PRE>
447 Shift Move the secondary selection, deleting
448 it from its original position. If
449 there is a primary selection, the move
450 will replace the primary selection
451 with the secondary selection.
452 Otherwise, moves the secondary
453 selection to to the cursor position.
454 </PRE>
456 <PRE>
457 Alt* Exchange the primary and secondary
458 selections.
459 </PRE>
461 While moving the primary selection by dragging with the middle mouse button:
463 <PRE>
464 Shift Leaves a copy of the original
465 selection in place rather than
466 removing it or blanking the area.
467 </PRE>
469 <PRE>
470 Ctrl Changes from insert mode to overlay
471 mode (see below).
472 </PRE>
474 <PRE>
475 Escape Cancels drag in progress.
476 </PRE>
478 Overlay Mode: Normally, dragging moves text by removing it from the selected
479 position at the start of the drag, and inserting it at a new position
480 relative to to the mouse. When you drag a block of text over existing
481 characters, the existing characters are displaced to the end of the
482 selection. In overlay mode, characters which are occluded by blocks of text
483 being dragged are simply removed. When dragging non-rectangular selections,
484 overlay mode also converts the selection to rectangular form, allowing it to
485 be dragged outside of the bounds of the existing text.
487 Mouse buttons 4 and 5 are usually represented by a mouse wheel nowadays.
488 They are used to scroll up or down in the text window.
490 * The Alt key may be labeled Meta or Compose-Character on some keyboards.
491 Some window managers, including default configurations of mwm, bind
492 combinations of the Alt key and mouse buttons to window manager operations.
493 In NEdit, Alt is only used on button release, so regardless of the window
494 manager bindings for Alt-modified mouse buttons, you can still do the
495 corresponding NEdit operation by using the Alt key AFTER the initial mouse
496 press, so that Alt is held while you release the mouse button. If you find
497 this difficult or annoying, you can re-configure most window managers to skip
498 this binding, or you can re-configure NEdit to use a different key
499 combination.
500 <P><HR>
502 <A NAME="Keyboard_Shortcuts"</A>
503 <H2> Keyboard Shortcuts </H2>
505 Most of the keyboard shortcuts in NEdit are shown on the right hand sides of
506 the pull-down menus. However, there are more which are not as obvious. These
507 include; dialog button shortcuts; menu and dialog mnemonics; labeled keyboard
508 keys, such as the arrows, page-up, page-down, and home; and optional Shift
509 modifiers on accelerator keys, like [Shift]Ctrl+F.
511 <H3>Menu Accelerators</H3>
513 Pressing the key combinations shown on the right of the menu items is a
514 shortcut for selecting the menu item with the mouse. Some items have the shift
515 key enclosed in brackets, such as [Shift]Ctrl+F. This indicates that the shift
516 key is optional. In search commands, including the shift key reverses the
517 direction of the search. In Shift commands, it makes the command shift the
518 selected text by a whole tab stop rather than by single characters.
520 <H3>Menu Mnemonics</H3>
522 Pressing the Alt key in combination with one of the underlined characters in
523 the menu bar pulls down that menu. Once the menu is pulled down, typing the
524 underlined characters in a menu item (without the Alt key) activates that
525 item. With a menu pulled down, you can also use the arrow keys to select menu
526 items, and the Space or Enter keys to activate them.
528 <H3>Keyboard Shortcuts within Dialogs</H3>
530 One button in a dialog is usually marked with a thick indented outline.
531 Pressing the Return or Enter key activates this button.
533 All dialogs have either a Cancel or Dismiss button. This button can be
534 activated by pressing the Escape (or Esc) key.
536 Pressing the tab key moves the keyboard focus to the next item in a dialog.
537 Within an associated group of buttons, the arrow keys move the focus among the
538 buttons. Shift+Tab moves backward through the items.
540 Most items in dialogs have an underline under one character in their name.
541 Pressing the Alt key along with this character, activates a button as if you
542 had pressed it with the mouse, or moves the keyboard focus to the associated
543 text field or list.
545 You can select items from a list by using the arrow keys to move the
546 selection and space to select.
548 In file selection dialogs, you can type the beginning characters of the file
549 name or directory in the list to select files
551 <H3>Labeled Function Keys</H3>
553 The labeled function keys on standard workstation and PC keyboards, like the
554 arrows, and page-up and page-down, are active in NEdit, though not shown in the
555 pull-down menus.
557 Holding down the control key while pressing a named key extends the scope of
558 the action that it performs. For example, Home normally moves the insert
559 cursor the beginning of a line. Ctrl+Home moves it to the beginning of the
560 file. Backspace deletes one character, Ctrl+Backspace deletes one word.
562 Holding down the shift key while pressing a named key begins or extends a
563 selection. Combining the shift and control keys combines their actions. For
564 example, to select a word without using the mouse, position the cursor at the
565 beginning of the word and press Ctrl+Shift+RightArrow. The Alt key modifies
566 selection commands to make the selection rectangular.
568 Under X and Motif, there are several levels of translation between keyboard
569 keys and the actions they perform in a program. The "<A HREF="#Customizing_NEdit">Customizing NEdit</A>", and
570 "<A HREF="#X_Resources">X Resources</A>" sections of the Help menu have more information on this subject.
571 Because of all of this configurability, and since keyboards and standards for
572 the meaning of some keys vary from machine to machine, the mappings may be
573 changed from the defaults listed below.
575 <H3>Modifier Keys (in general)</H3>
577 <PRE>
578 Ctrl Extends the scope of the action that the key
579 would otherwise perform. For example, Home
580 normally moves the insert cursor to the beginning
581 of a line. Ctrl+Home moves it to the beginning of
582 the file. Backspace deletes one character, Ctrl+
583 Backspace deletes one word.
584 </PRE>
586 <PRE>
587 Shift Extends the selection to the cursor position. If
588 there's no selection, begins one between the old
589 and new cursor positions.
590 </PRE>
592 <PRE>
593 Alt When modifying a selection, makes the selection
594 rectangular.
595 </PRE>
597 (For the effects of modifier keys on mouse button presses, see the section
598 titled "<A HREF="#Using_the_Mouse">Using the Mouse</A>")
600 <H3>All Keyboards</H3>
602 <PRE>
603 Escape Cancels operation in progress: menu
604 selection, drag, selection, etc. Also
605 equivalent to cancel button in dialogs.
606 </PRE>
608 <PRE>
609 Backspace Delete the character before the cursor
610 </PRE>
612 <PRE>
613 Ctrl+BS Delete the word before the cursor
614 </PRE>
616 <PRE>
617 Arrows --
618 </PRE>
620 <PRE>
621 Left Move the cursor to the left one character
622 </PRE>
624 <PRE>
625 Ctrl+Left Move the cursor backward one word
626 (Word delimiters are settable, see
627 "<A HREF="#Customizing_NEdit">Customizing NEdit</A>", and "<A HREF="#X_Resources">X Resources</A>")
628 </PRE>
630 <PRE>
631 Right Move the cursor to the right one character
632 </PRE>
634 <PRE>
635 Ctrl+Right Move the cursor forward one word
636 </PRE>
638 <PRE>
639 Up Move the cursor up one line
640 </PRE>
642 <PRE>
643 Ctrl+Up Move the cursor up one paragraph.
644 (Paragraphs are delimited by blank lines)
645 </PRE>
647 <PRE>
648 Down Move the cursor down one line.
649 </PRE>
651 <PRE>
652 Ctrl+Down Move the cursor down one paragraph.
653 </PRE>
655 <PRE>
656 Ctrl+Return Return with automatic indent, regardless
657 of the setting of Auto Indent.
658 </PRE>
660 <PRE>
661 Shift+Return Return without automatic indent,
662 regardless of the setting of Auto Indent.
663 </PRE>
665 <PRE>
666 Ctrl+Tab Insert an ASCII tab character, without
667 processing emulated tabs.
668 </PRE>
670 <PRE>
671 Alt+Ctrl+&#60;c&#62; Insert the control-code equivalent of
672 a key &#60;c&#62;
673 </PRE>
675 <PRE>
676 Ctrl+/ Select everything (same as Select
677 All menu item or ^A)
678 </PRE>
680 <PRE>
681 Ctrl+\ Unselect
682 </PRE>
684 <PRE>
685 Ctrl+U Delete to start of line
686 </PRE>
688 <H3>PC Standard Keyboard</H3>
690 <PRE>
691 Ctrl+Insert Copy the primary selection to the
692 clipboard (same as Copy menu item or ^C)
693 for compatibility with Motif standard key
694 binding
695 Shift+Ctrl+
696 Insert Copy the primary selection to the cursor
697 location.
698 </PRE>
700 <PRE>
701 Delete Delete the character before the cursor.
702 (Can be configured to delete the character
703 after the cursor, see "<A HREF="#Customizing_NEdit">Customizing NEdit</A>",
704 and "<A HREF="#X_Resources">X Resources</A>")
705 </PRE>
707 <PRE>
708 Ctrl+Delete Delete to end of line.
709 </PRE>
711 <PRE>
712 Shift+Delete Cut, remove the currently selected text
713 and place it in the clipboard. (same as
714 Cut menu item or ^X) for compatibility
715 with Motif standard key binding
716 Shift+Ctrl+
717 Delete Cut the primary selection to the cursor
718 location.
719 </PRE>
721 <PRE>
722 Home Move the cursor to the beginning of the
723 line
724 </PRE>
726 <PRE>
727 Ctrl+Home Move the cursor to the beginning of the
728 file
729 </PRE>
731 <PRE>
732 End Move the cursor to the end of the line
733 </PRE>
735 <PRE>
736 Ctrl+End Move the cursor to the end of the file
737 </PRE>
739 <PRE>
740 PageUp Scroll and move the cursor up by one page.
741 </PRE>
743 <PRE>
744 Ctrl+PageUp Scroll and move the cursor left by one
745 page.
746 PageDown Scroll and move the cursor down by one
747 page.
748 </PRE>
750 <PRE>
751 Ctrl+PageDown Scroll and move the cursor right by one
752 page.
753 </PRE>
755 <PRE>
756 F10 Make the menu bar active for keyboard
757 input (Arrow Keys, Return, Escape,
758 and the Space Bar)
759 </PRE>
761 <H3>Specialty Keyboards </H3>
763 On machines with different styles of keyboards, generally, text editing
764 actions are properly matched to the labeled keys, such as Remove,
765 Next-screen, etc.. If you prefer different key bindings, see the section
766 titled "<A HREF="#Key_Binding">Key Binding</A>" under the Customizing heading in the Help menu.
767 <P><HR>
769 <A NAME="Shifting_and_Filling"</A>
770 <H2> Shifting and Filling </H2>
772 <H3>Shift Left, Shift Right</H3>
774 While shifting blocks of text is most important for programmers (See Features
775 for Programming), it is also useful for other tasks, such as creating
776 indented paragraphs.
778 To shift a block of text one tab stop to the right, select the text, then
779 choose Shift Right from the Edit menu. Note that the accelerator keys for
780 these menu items are Ctrl+9 and Ctrl+0, which correspond to the right and
781 left parenthesis on most keyboards. Remember them as adjusting the text in
782 the direction pointed to by the parenthesis character. Holding the Shift key
783 while selecting either Shift Left or Shift Right will shift the text by one
784 character.
786 It is also possible to shift blocks of text by selecting the text
787 rectangularly, and dragging it left or right (and up or down as well). Using
788 a rectangular selection also causes tabs within the selection to be
789 recalculated and substituted, such that the non-whitespace characters remain
790 stationary with respect to the selection.
792 <H3>Filling </H3>
794 Text filling using the Fill Paragraph command in the Edit menu is one of the
795 most important concepts in NEdit. And it will be well worth your while to
796 understand how to use it properly.
798 In plain text files, unlike word-processor files, there is no way to tell
799 which lines are continuations of other lines, and which lines are meant to be
800 separate, because there is no distinction in meaning between newline
801 characters which separate lines in a paragraph, and ones which separate
802 paragraphs from other text. This makes it impossible for a text editor like
803 NEdit to tell parts of the text which belong together as a paragraph from
804 carefully arranged individual lines.
806 In continuous wrap mode (Preferences -&#62; Wrap -&#62; Continuous), lines
807 automatically wrap and unwrap themselves to line up properly at the right
808 margin. In this mode, you simply omit the newlines within paragraphs and let
809 NEdit make the line breaks as needed. Unfortunately, continuous wrap mode is
810 not appropriate in the majority of situations, because files with extremely
811 long lines are not common under Unix and may not be compatible with all
812 tools, and because you can't achieve effects like indented sections, columns,
813 or program comments, and still take advantage of the automatic wrapping.
815 Without continuous wrapping, paragraph filling is not entirely automatic.
816 Auto-Newline wrapping keeps paragraphs lined up as you type, but once
817 entered, NEdit can no longer distinguish newlines which join wrapped text,
818 and newlines which must be preserved. Therefore, editing in the middle of a
819 paragraph will often leave the right margin messy and uneven.
821 Since NEdit can't act automatically to keep your text lined up, you need to
822 tell it explicitly where to operate, and that is what Fill Paragraph is for.
823 It arranges lines to fill the space between two margins, wrapping the lines
824 neatly at word boundaries. Normally, the left margin for filling is inferred
825 from the text being filled. The first line of each paragraph is considered
826 special, and its left indentation is maintained separately from the remaining
827 lines (for leading indents, bullet points, numbered paragraphs, etc.).
828 Otherwise, the left margin is determined by the furthest left non-whitespace
829 character. The right margin is either the Wrap Margin, set in the
830 preferences menu (by default, the right edge of the window), or can also be
831 chosen on the fly by using a rectangular selection (see below).
833 There are three ways to use Fill Paragraph. The simplest is, while you are
834 typing text, and there is no selection, simply select Fill Paragraph (or type
835 Ctrl+J), and NEdit will arrange the text in the paragraph adjacent to the
836 cursor. A paragraph, in this case, means an area of text delimited by blank
837 lines.
839 The second way to use Fill Paragraph is with a selection. If you select a
840 range of text and then chose Fill Paragraph, all of the text in the selection
841 will be filled. Again, continuous text between blank lines is interpreted as
842 paragraphs and filled individually, respecting leading indents and blank
843 lines.
845 The third, and most versatile, way to use Fill Paragraph is with a
846 rectangular selection. Fill Paragraph treats rectangular selections
847 differently from other commands. Instead of simply filling the text inside
848 the rectangular selection, NEdit interprets the right edge of the selection
849 as the requested wrap margin. Text to the left of the selection is not
850 disturbed (the usual interpretation of a rectangular selection), but text to
851 the right of the selection is included in the operation and is pulled in to
852 the selected region. This method enables you to fill text to an arbitrary
853 right margin, without going back and forth to the wrap-margin dialog, as well
854 as to exclude text to the left of the selection such as comment bars or other
855 text columns.
856 <P><HR>
858 <A NAME="File_Format"</A>
859 <H2> File Format </H2>
861 While plain-text is probably the simplest and most interchangeable file
862 format in the computer world, there is still variation in what plain-text
863 means from system to system. Plain-text files can differ in character set,
864 line termination, and wrapping.
866 While character set differences are the most obvious and pose the most
867 challenge to portability, they affect NEdit only indirectly via the same font
868 and localization mechanisms common to all X applications. If your system is
869 set up properly, you will probably never see character-set related problems
870 in NEdit. NEdit can not display Unicode text files, or any multi-byte
871 character set.
873 The primary difference between an MS DOS format file and a Unix format file,
874 is how the lines are terminated. Unix uses a single newline character. MS
875 DOS uses a carriage-return and a newline. NEdit can read and write both file
876 formats, but internally, it uses the single character Unix standard. NEdit
877 auto-detects MS DOS format files based on the line termination at the start
878 of the file. Files are judged to be DOS format if all of the first five line
879 terminators, within a maximum range, are DOS-style. To change the format in
880 which NEdit writes a file from DOS to Unix or visa versa, use the Save As...
881 command and check or un-check the MS DOS Format button.
883 Wrapping within text files can vary among individual users, as well as from
884 system to system. Both Windows and MacOS make frequent use of plain text
885 files with no implicit right margin. In these files, wrapping is determined
886 by the tool which displays them. Files of this style also exist on Unix
887 systems, despite the fact that they are not supported by all Unix utilities.
888 To display this kind of file properly in NEdit, you have to select the wrap
889 style called Continuous. Wrapping modes are discussed in the sections:
890 Customizing -&#62; Preferences, and Basic Operation -&#62; Shifting and Filling.
892 The last and most minute of format differences is the terminating newline.
893 Some Unix compilers and utilities require a final terminating newline on all
894 files they read and fail in various ways on files which do not have it. Vi
895 and approximately half of Unix editors enforce the terminating newline on all
896 files that they write; Emacs does not enforce this rule. Users are divided
897 on which is best. NEdit makes the final terminating newline optional
898 (Preferences -&#62; Default Settings -&#62; Append Line Feed on Save).
899 <P><HR>
901 <A NAME="Features_for_Programming"</A>
902 <H1> Features for Programming </H1>
904 <A NAME="Programming_with_NEdit"</A>
905 <H2> Programming with NEdit </H2>
907 Though general in appearance, NEdit has many features intended specifically
908 for programmers. Major programming-related topics are listed in separate
909 sections under the heading: "Features for Programming": <A HREF="#Syntax_Highlighting">Syntax Highlighting</A>,
910 <A HREF="#Tabs/Emulated_Tabs">Tabs/Emulated Tabs</A>, <A HREF="#Finding_Declarations_(ctags)">Finding Declarations (ctags)</A>, <A HREF="#Calltips">Calltips</A>, and
911 <A HREF="#Auto/Smart_Indent">Auto/Smart Indent</A>. Minor topics related to programming are discussed below:
913 <H3>Language Modes</H3>
915 When NEdit initially reads a file, it attempts to determine whether the file
916 is in one of the computer languages that it knows about. Knowing what language
917 a file is written in allows NEdit to assign highlight patterns and smart indent
918 macros, and to set language specific preferences like word delimiters, tab
919 emulation, and auto-indent. Language mode can be recognized from both the file
920 name and from the first 200 characters of content. Language mode recognition
921 and language-specific preferences are configured in: Preferences -&#62; Default
922 Settings -&#62; Language Modes....
924 You can set the language mode manually for a window, by selecting it from the
925 menu: Preferences -&#62; Language Modes.
927 <H3>Line Numbers</H3>
929 To find a particular line in a source file by line number, choose Goto Line
930 #... from the Search menu. You can also directly select the line number text
931 in the compiler message in the terminal emulator window (xterm, decterm,
932 winterm, etc.) where you ran the compiler, and choose Goto Selected from the
933 Search menu.
935 To find out the line number of a particular line in your file, turn on
936 Statistics Line in the Preferences menu and position the insertion point
937 anywhere on the line. The statistics line continuously updates the line number
938 of the line containing the cursor.
940 <H3>Matching Parentheses</H3>
942 To help you inspect nested parentheses, brackets, braces, quotes, and other
943 characters, NEdit has both an automatic parenthesis matching mode, and a Goto
944 Matching command. Automatic parenthesis matching is activated when you type,
945 or move the insertion cursor after a parenthesis, bracket, or brace. It
946 momentarily highlights either the opposite character ('Delimiter') or the
947 entire expression ('Range') when the opposite character is visible in the
948 window. To find a matching character anywhere in the file, select it or
949 position the cursor after it, and choose Goto Matching from the Search menu.
950 If the character matches itself, such as a quote or slash, select the first
951 character of the pair. NEdit will match {, (, [, &#60;, ", ', `, /, and \.
952 Holding the Shift key while typing the accelerator key (Shift+Ctrl+M, by
953 default), will select all of the text between the matching characters.
955 When syntax highlighting is enabled, the matching routines can optionally
956 make use of the syntax information for improved accuracy. In that case,
957 a brace inside a highlighted string will not match a brace inside a comment,
958 for instance.
960 <H3>Opening Included Files</H3>
962 The Open Selected command in the File menu understands the C preprocessor's
963 #include syntax, so selecting an #include line and invoking Open Selected will
964 generally find the file referred to, unless doing so depends on the settings of
965 compiler switches or other information not available to NEdit.
967 <H3>Interface to Programming Tools</H3>
969 Integrated software development environments such as SGI's CaseVision and
970 Centerline Software's Code Center, can be interfaced directly with NEdit via
971 the client server interface. These tools allow you to click directly on
972 compiler and runtime error messages and request NEdit to open files, and select
973 lines of interest. The easiest method is usually to use the tool's interface
974 for character-based editors like vi, to invoke nc, but programmatic interfaces
975 can also be derived using the source code for nc.
977 There are also some simple compile/review, grep, ctree, and ctags browsers
978 available in the NEdit contrib directory on ftp.nedit.org.
979 <P><HR>
981 <A NAME="Tabs/Emulated_Tabs"</A>
982 <H2> Tabs/Emulated Tabs </H2>
984 <H3>Changing the Tab Distance</H3>
986 Tabs are important for programming in languages which use indentation to show
987 nesting, as short-hand for producing white-space for leading indents. As a
988 programmer, you have to decide how to use indentation, and how or whether tab
989 characters map to your indentation scheme.
991 Ideally, tab characters map directly to the amount of indent that you use to
992 distinguish nesting levels in your code. Unfortunately, the Unix standard
993 for interpretation of tab characters is eight characters (probably dating
994 back to mechanical capabilities of the original teletype), which is usually
995 too coarse for a single indent.
997 Most text editors, NEdit included, allow you to change the interpretation of
998 the tab character, and many programmers take advantage of this, and set their
999 tabs to 3 or 4 characters to match their programming style. In NEdit you set
1000 the hardware tab distance in Preferences -&#62; Tabs... for the current window,
1001 or Preferences -&#62; Default Settings -&#62; Tabs... (general), or Preferences -&#62;
1002 Default Settings -&#62; Language Modes... (language-specific) to change the
1003 defaults for future windows.
1005 Changing the meaning of the tab character makes programming much easier while
1006 you're in the editor, but can cause you headaches outside of the editor,
1007 because there is no way to pass along the tab setting as part of a plain-text
1008 file. All of the other tools which display, print, and otherwise process
1009 your source code have to be made aware of how the tabs are set, and must be
1010 able to handle the change. Non-standard tabs can also confuse other
1011 programmers, or make editing your code difficult for them if their text
1012 editors don't support changes in tab distance.
1014 <H3>Emulated Tabs</H3>
1016 An alternative to changing the interpretation of the tab character is tab
1017 emulation. In the Tabs... dialog(s), turning on Emulated Tabs causes the Tab
1018 key to insert the correct number of spaces and/or tabs to bring the cursor
1019 the next emulated tab stop, as if tabs were set at the emulated tab distance
1020 rather than the hardware tab distance. Backspacing immediately after entering
1021 an emulated tab will delete the fictitious tab as a unit, but as soon as you
1022 move the cursor away from the spot, NEdit will forget that the collection of
1023 spaces and tabs is a tab, and will treat it as separate characters. To enter
1024 a real tab character with "Emulate Tabs" turned on, use Ctrl+Tab.
1026 It is also possible to tell NEdit not to insert ANY tab characters at all in
1027 the course of processing emulated tabs, and in shifting and rectangular
1028 insertion/deletion operations, for programmers who worry about the
1029 misinterpretation of tab characters on other systems.
1030 <P><HR>
1032 <A NAME="Auto/Smart_Indent"</A>
1033 <H2> Auto/Smart Indent </H2>
1035 Programmers who use structured languages usually require some form of
1036 automatic indent, so that they don't have to continually re-type the
1037 sequences of tabs and/or spaces needed to maintain lengthy running indents.
1038 Version 5.0 of NEdit is the first release of NEdit to offer "smart" indent,
1039 at least experimentally, in addition to the traditional automatic indent
1040 which simply lines up the cursor position with the previous line.
1042 <H3>Smart Indent</H3>
1044 Smart Indent in this release must still be considered somewhat experimental.
1045 Smart indent macros are only available by default for C and C++, and while
1046 these can easily be configured for different default indentation distances,
1047 they may not conform to everyone's exact C programming style. Smart indent
1048 is programmed in terms of macros in the NEdit macro language which can be
1049 entered in: Preferences -&#62; Default Settings -&#62; Indent -&#62; Program Smart
1050 Indent. Hooks are provided for intervening at the point that a newline is
1051 entered, either via the user pressing the Enter key, or through
1052 auto-wrapping; and for arbitrary type-in to act on specific characters typed.
1054 To type a newline character without invoking smart-indent when operating in
1055 smart-indent mode, hold the Ctrl key while pressing the Return or Enter key.
1057 <H3>Auto-Indent</H3>
1059 With Indent set to Auto (the default), NEdit keeps a running indent. When
1060 you press the Return or Enter key, spaces and tabs are inserted to line up
1061 the insert point under the start of the previous line. Ctrl+Return in
1062 auto-indent mode acts like a normal Return, With auto-indent turned off,
1063 Ctrl+Return does indentation.
1065 <H3>Block Indentation Adjustment</H3>
1067 The Shift Left and Shift Right commands as well as rectangular dragging can
1068 be used to adjust the indentation for several lines at once. To shift a
1069 block of text one character to the right, select the text, then choose Shift
1070 Right from the Edit menu. Note that the accelerator keys for these menu
1071 items are Ctrl+9 and Ctrl+0, which correspond to the right and left
1072 parenthesis on most keyboards. Remember them as adjusting the text in the
1073 direction pointed to by the parenthesis character. Holding the Shift key
1074 while selecting either Shift Left or Shift Right will shift the text by one
1075 tab stop (or by one emulated tab stop if tab emulation is turned on). The
1076 help section "Shifting and Filling" under "Basic Operation" has details.
1077 <P><HR>
1079 <A NAME="Syntax_Highlighting"</A>
1080 <H2> Syntax Highlighting </H2>
1082 Syntax Highlighting means using colors and fonts to help distinguish language
1083 elements in programming languages and other types of structured files.
1084 Programmers use syntax highlighting to understand code faster and better, and
1085 to spot many kinds of syntax errors more quickly.
1087 To use syntax highlighting in NEdit, select Highlight Syntax in the
1088 Preferences menu. If NEdit recognizes the computer language that you are
1089 using, and highlighting rules (patterns) are available for that language, it
1090 will highlight your text, and maintain the highlighting, automatically, as
1091 you type.
1093 If NEdit doesn't correctly recognize the type of the file you are editing,
1094 you can manually select a language mode from Language Modes in the
1095 Preferences menu. You can also program the method that NEdit uses to
1096 recognize language modes in Preferences -&#62; Default Settings -&#62; Language
1097 Modes....
1099 If no highlighting patterns are available for the language that you want to
1100 use, you can create new patterns relatively quickly. The Help section
1101 "<A HREF="#Highlighting_Patterns">Highlighting Patterns</A>" under "Customizing", has details.
1103 If you are satisfied with what NEdit is highlighting, but would like it to
1104 use different colors or fonts, you can change these by selecting Preferences
1105 -&#62; Default Settings -&#62; Syntax Highlighting -&#62; Text Drawing Styles.
1106 Highlighting patterns are connected with font and color information through a
1107 common set of styles so that colorings defined for one language will be
1108 similar across others, and patterns within the same language which are meant
1109 to appear identical can be changed in the same place. To understand which
1110 styles are used to highlight the language you are interested in, you may need
1111 to look at "<A HREF="#Highlighting_Patterns">Highlighting Patterns</A>" section, as well.
1113 Syntax highlighting is CPU intensive, and under some circumstances can affect
1114 NEdit's responsiveness. If you have a particularly slow system, or work with
1115 very large files, you may not want to use it all of the time. Syntax
1116 highlighting introduces two kinds of delays. The first is an initial parsing
1117 delay, proportional to the size of the file. This delay is also incurred
1118 when pasting large sections of text, filtering text through shell commands,
1119 and other circumstances involving changes to large amounts of text. The
1120 second kind of delay happens when text which has not previously been visible
1121 is scrolled in to view. Depending on your system, and the highlight patterns
1122 you are using, this may or may not be noticeable. A typing delay is also
1123 possible, but unlikely if you are only using the built-in patterns.
1124 <P><HR>
1126 <A NAME="Finding_Declarations_(ctags)"</A>
1127 <H2> Finding Declarations (ctags) </H2>
1129 <A NAME="ctags"</A>
1130 NEdit can process tags files generated using the Unix ctags command or the
1131 Exuberant Ctags program. Ctags creates index files correlating names of
1132 functions and declarations with their locations in C, Fortran, or Pascal source
1133 code files. (See the ctags manual page for more information). Ctags produces a
1134 file called "tags" which can be loaded by NEdit. NEdit can manage any number
1135 of tags files simultaneously. Tag collisions are handled with a popup menu to
1136 let the user decide which tag to use. In 'Smart' mode NEdit will automatically
1137 choose the desired tag based on the scope of the file or module. Once loaded,
1138 the information in the tags file enables NEdit to go directly to the
1139 declaration of a highlighted function or data structure name with a single
1140 command. To load a tags file, select "Load Tags File" from the File menu and
1141 choose a tags file to load, or specify the name of the tags file on the NEdit
1142 command line:
1144 <PRE>
1145 nedit -tags tags
1146 </PRE>
1148 NEdit can also be set to load a tags file automatically when it starts up.
1149 Setting the X resource nedit.tagFile to the name of a tag file tells NEdit to
1150 look for that file at startup time (see "<A HREF="#Customizing_NEdit">Customizing NEdit</A>"). The file name
1151 can be either a complete path name, in which case NEdit will always load the
1152 same tags file, or a file name without a path or with a relative path, in
1153 which case NEdit will load it starting from the current directory. The
1154 second option allows you to have different tags files for different projects,
1155 each automatically loaded depending on the directory you're in when you start
1156 NEdit. Setting the name to "tags" is an obvious choice since this is the
1157 name that ctags uses. NEdit normally evaluates relative path tag file
1158 specifications every time a file is opened. All accessible tag files are
1159 loaded at this time. To disable the automatic loading of tag files specified
1160 as relative paths, set the X resource nedit.alwaysCheckRelativeTagsSpecs to
1161 False.
1163 To unload a tags file, select "Un-load Tags File" from the File menu and
1164 choose from the list of tags files. NEdit will keep track of tags file updates
1165 by checking the timestamp on the files, and automatically update the tags
1166 cache.
1168 To find the definition of a function or data structure once a tags file is
1169 loaded, select the name anywhere it appears in your program (see
1170 "<A HREF="#Selecting_Text">Selecting Text</A>") and choose "Find Definition" from the Search menu.
1171 <P><HR>
1173 <A NAME="Calltips"</A>
1174 <H2> Calltips </H2>
1176 Calltips are little yellow boxes that pop up to remind you what the arguments
1177 and return type of a function are. More generally, they're a UI mechanism to
1178 present a small amount of crucial information in a prominent location. To
1179 display a calltip, select some text and choose "Show Calltip" from the Search
1180 menu.
1182 Calltips get their information from one of two places -- either a tags file (see
1183 "<A HREF="#Finding_Declarations_(ctags)">Finding Declarations (ctags)</A>") or a calltips file. First, any loaded calltips
1184 files are searched for a definition, and if nothing is found then the tags
1185 database is searched. If a tag is found that matches the hilighted text then
1186 a calltip is displayed with the first few lines of the definition -- usually
1187 enough to show you what the arguments of a function are.
1189 You can load a calltips file by using choosing "Load Calltips File" from the
1190 File menu. You can unload a calltips file by selecting it from the
1191 "Unload Calltips File" submenu of the File menu. You can also choose one or
1192 more default calltips files to be loaded for each language mode using the
1193 "Default calltips file(s)" field of the Language Modes dialog.
1195 The calltips file format is very simple. calltips files are organized in blocks
1196 separated by blank lines. The first line of the block is the key, which is the
1197 word that is matched when a calltip is requested. The rest of the block is
1198 displayed as the calltip.
1200 Almost any text at all can appear in a calltip key or a calltip. There are no
1201 special characters that need to be escaped. The only issues to note are that
1202 trailing whitespace is ignored, and you cannot have a blank line inside a
1203 calltip. (Use a single period instead -- it'll be nearly invisible.) You should
1204 also avoid calltip keys that begin and end with '*' characters, since those are
1205 used to mark special blocks.
1207 There are five special block types--comment, include, language, alias, and
1208 version--which are distinguished by their first lines, "* comment *",
1209 "* include *", "* language *", "* alias *", and "* version *" respectively
1210 (without quotes).
1212 Comment blocks are ignored when reading calltips files.
1214 Include blocks specify additional calltips files to load, one per line. The ~
1215 character can be used for your $HOME directory, but other shell shortcuts like
1216 * and ? can't be used. Include blocks allow you to make a calltips file for your
1217 project that includes, say, the calltips files for C, Motif, and Xt.
1219 Language blocks specify which language mode the calltips should be used with.
1220 When a calltip is requested it won't match tips from languages other than the
1221 current language mode. Language blocks only affect the tips listed after the
1222 block.
1224 Alias blocks allow a calltip to have multiple keys. The first line of the block
1225 is the key for the calltip to be displayed, and the rest of the lines are
1226 additional keys, one per line, that should also show the calltip.
1228 Version blocks are ignored for the time being.
1230 You can use calltips in your own macros using the calltip() and kill_calltip()
1231 macro subroutines and the $calltip_ID macro variable. See the
1232 <A HREF="#Macro_Subroutines">Macro Subroutines</A> section for details.
1233 <P><HR>
1235 <A NAME="Regular_Expressions"</A>
1236 <H1> Regular Expressions </H1>
1238 <A NAME="Basic_Regular_Expression_Syntax"</A>
1239 <H2> Basic Regular Expression Syntax </H2>
1241 Regular expressions (regex's) are useful as a way to match inexact sequences
1242 of characters. They can be used in the `Find...' and `Replace...' search
1243 dialogs and are at the core of Color Syntax Highlighting patterns. To specify
1244 a regular expression in a search dialog, simply click on the `Regular
1245 Expression' radio button in the dialog.
1247 A regex is a specification of a pattern to be matched in the searched text.
1248 This pattern consists of a sequence of tokens, each being able to match a
1249 single character or a sequence of characters in the text, or assert that a
1250 specific position within the text has been reached (the latter is called an
1251 anchor.) Tokens (also called atoms) can be modified by adding one of a number
1252 of special quantifier tokens immediately after the token. A quantifier token
1253 specifies how many times the previous token must be matched (see below.)
1255 Tokens can be grouped together using one of a number of grouping constructs,
1256 the most common being plain parentheses. Tokens that are grouped in this way
1257 are also collectively considered to be a regex atom, since this new larger
1258 atom may also be modified by a quantifier.
1260 A regex can also be organized into a list of alternatives by separating each
1261 alternative with pipe characters, `|'. This is called alternation. A match
1262 will be attempted for each alternative listed, in the order specified, until a
1263 match results or the list of alternatives is exhausted (see <A HREF="#alternation">Alternation</A>
1264 section below.)
1266 <H3>The 'Any' Character</H3>
1268 If a dot (`.') appears in a regex, it means to match any character exactly
1269 once. By default, dot will not match a newline character, but this behavior
1270 can be changed (see help topic <A HREF="#Parenthetical_Constructs">Parenthetical Constructs</A>, under the
1271 heading, Matching Newlines).
1273 <H3>Character Classes</H3>
1275 A character class, or range, matches exactly one character of text, but the
1276 candidates for matching are limited to those specified by the class. Classes
1277 come in two flavors as described below:
1279 <PRE>
1280 [...] Regular class, match only characters listed.
1281 [^...] Negated class, match only characters NOT listed.
1282 </PRE>
1284 As with the dot token, by default negated character classes do not match
1285 newline, but can be made to do so.
1287 The characters that are considered special within a class specification are
1288 different than the rest of regex syntax as follows. If the first character in
1289 a class is the `]' character (second character if the first character is `^')
1290 it is a literal character and part of the class character set. This also
1291 applies if the first or last character is `-'. Outside of these rules, two
1292 characters separated by `-' form a character range which includes all the
1293 characters between the two characters as well. For example, `[^f-j]' is the
1294 same as `[^fghij]' and means to match any character that is not `f', `g',
1295 `h', `i', or `j'.
1297 <H3>Anchors</H3>
1299 Anchors are assertions that you are at a very specific position within the
1300 search text. NEdit regular expressions support the following anchor tokens:
1302 <PRE>
1303 ^ Beginning of line
1304 $ End of line
1305 &#60; Left word boundary
1306 &#62; Right word boundary
1307 \B Not a word boundary
1308 </PRE>
1310 Note that the \B token ensures that the left and right characters are both
1311 delimiter characters, or that both left and right characters are
1312 non-delimiter characters. Currently word anchors check only one character,
1313 e.g. the left word anchor `&#60;' only asserts that the left character is a word
1314 delimiter character. Similarly the right word anchor checks the right
1315 character.
1317 <H3>Quantifiers</H3>
1319 Quantifiers specify how many times the previous regular expression atom may
1320 be matched in the search text. Some quantifiers can produce a large
1321 performance penalty, and can in some instances completely lock up NEdit. To
1322 prevent this, avoid nested quantifiers, especially those of the maximal
1323 matching type (see below.)
1325 The following quantifiers are maximal matching, or "greedy", in that they
1326 match as much text as possible.
1328 <PRE>
1329 * Match zero or more
1330 + Match one or more
1331 ? Match zero or one
1332 </PRE>
1334 The following quantifiers are minimal matching, or "lazy", in that they match
1335 as little text as possible.
1337 <PRE>
1338 *? Match zero or more
1339 +? Match one or more
1340 ?? Match zero or one
1341 </PRE>
1343 One final quantifier is the counting quantifier, or brace quantifier. It
1344 takes the following basic form:
1346 <PRE>
1347 {min,max} Match from `min' to `max' times the
1348 previous regular expression atom.
1349 </PRE>
1351 If `min' is omitted, it is assumed to be zero. If `max' is omitted, it is
1352 assumed to be infinity. Whether specified or assumed, `min' must be less
1353 than or equal to `max'. Note that both `min' and `max' are limited to
1354 65535. If both are omitted, then the construct is the same as `*'. Note
1355 that `{,}' and `{}' are both valid brace constructs. A single number
1356 appearing without a comma, e.g. `{3}' is short for the `{min,min}' construct,
1357 or to match exactly `min' number of times.
1359 The quantifiers `{1}' and `{1,1}' are accepted by the syntax, but are
1360 optimized away since they mean to match exactly once, which is redundant
1361 information. Also, for efficiency, certain combinations of `min' and `max'
1362 are converted to either `*', `+', or `?' as follows:
1364 <PRE>
1365 {} {,} {0,} *
1366 {1,} +
1367 {,1} {0,1} ?
1368 </PRE>
1370 Note that {0} and {0,0} are meaningless and will generate an error message at
1371 regular expression compile time.
1373 Brace quantifiers can also be "lazy". For example {2,5}? would try to match
1374 2 times if possible, and will only match 3, 4, or 5 times if that is what is
1375 necessary to achieve an overall match.
1377 <H3>Alternation</H3>
1379 A series of alternative patterns to match can be specified by separating them
1380 <A NAME="alternation"</A>
1381 with vertical pipes, `|'. An example of alternation would be `a|be|sea'.
1382 This will match `a', or `be', or `sea'. Each alternative can be an
1383 arbitrarily complex regular expression. The alternatives are attempted in
1384 the order specified. An empty alternative can be specified if desired, e.g.
1385 `a|b|'. Since an empty alternative can match nothingness (the empty string),
1386 this guarantees that the expression will match.
1388 <H3>Comments</H3>
1390 Comments are of the form `(?#&#60;comment text&#62;)' and can be inserted anywhere
1391 and have no effect on the execution of the regular expression. They can be
1392 handy for documenting very complex regular expressions. Note that a comment
1393 begins with `(?#' and ends at the first occurrence of an ending parenthesis,
1394 or the end of the regular expression... period. Comments do not recognize
1395 any escape sequences.
1396 <P><HR>
1398 <A NAME="Metacharacters"</A>
1399 <H2> Metacharacters </H2>
1401 <H3>Escaping Metacharacters</H3>
1403 In a regular expression (regex), most ordinary characters match themselves.
1404 For example, `ab%' would match anywhere `a' followed by `b' followed by `%'
1405 appeared in the text. Other characters don't match themselves, but are
1406 metacharacters. For example, backslash is a special metacharacter which
1407 'escapes' or changes the meaning of the character following it. Thus, to
1408 match a literal backslash would require a regular expression to have two
1409 backslashes in sequence. NEdit provides the following escape sequences so
1410 that metacharacters that are used by the regex syntax can be specified as
1411 ordinary characters.
1413 <PRE>
1414 \( \) \- \[ \] \&#60; \&#62; \{ \}
1415 \. \| \^ \$ \* \+ \? \&#38; \\
1416 </PRE>
1418 <H3>Special Control Characters</H3>
1420 There are some special characters that are difficult or impossible to type.
1421 Many of these characters can be constructed as a sort of metacharacter or
1422 sequence by preceding a literal character with a backslash. NEdit recognizes
1423 the following special character sequences:
1425 <PRE>
1426 \a alert (bell)
1427 \b backspace
1428 \e ASCII escape character (***)
1429 \f form feed (new page)
1430 \n newline
1431 \r carriage return
1432 \t horizontal tab
1433 \v vertical tab
1434 </PRE>
1436 <PRE>
1437 *** For environments that use the EBCDIC character set,
1438 when compiling NEdit set the EBCDIC_CHARSET compiler
1439 symbol to get the EBCDIC equivalent escape
1440 character.)
1441 </PRE>
1443 <H3>Octal and Hex Escape Sequences</H3>
1445 Any ASCII (or EBCDIC) character, except null, can be specified by using
1446 either an octal escape or a hexadecimal escape, each beginning with \0 or \x
1447 (or \X), respectively. For example, \052 and \X2A both specify the `*'
1448 character. Escapes for null (\00 or \x0) are not valid and will generate an
1449 error message. Also, any escape that exceeds \0377 or \xFF will either cause
1450 an error or have any additional character(s) interpreted literally. For
1451 example, \0777 will be interpreted as \077 (a `?' character) followed by `7'
1452 since \0777 is greater than \0377.
1454 An invalid digit will also end an octal or hexadecimal escape. For example,
1455 \091 will cause an error since `9' is not within an octal escape's range of
1456 allowable digits (0-7) and truncation before the `9' yields \0 which is
1457 invalid.
1459 <H3>Shortcut Escape Sequences</H3>
1461 NEdit defines some escape sequences that are handy shortcuts for commonly
1462 used character classes.
1464 <PRE>
1465 \d digits 0-9
1466 \l letters a-z, A-Z, and locale dependent letters
1467 \s whitespace \t, \r, \v, \f, and space
1468 \w word characters letters, digits, and underscore, `_'
1469 </PRE>
1471 \D, \L, \S, and \W are the same as the lowercase versions except that the
1472 resulting character class is negated. For example, \d is equivalent to
1473 `[0-9]', while \D is equivalent to `[^0-9]'.
1475 These escape sequences can also be used within a character class. For
1476 example, `[\l_]' is the same as `[a-zA-Z_]', extended with possible locale
1477 dependent letters. The escape sequences for special characters, and octal
1478 and hexadecimal escapes are also valid within a class.
1480 <H3>Word Delimiter Tokens</H3>
1482 Although not strictly a character class, the following escape sequences
1483 behave similarly to character classes:
1485 <PRE>
1486 \y Word delimiter character
1487 \Y Not a word delimiter character
1488 </PRE>
1490 The `\y' token matches any single character that is one of the characters
1491 that NEdit recognizes as a word delimiter character, while the `\Y' token
1492 matches any character that is NOT a word delimiter character. Word delimiter
1493 characters are dynamic in nature, meaning that the user can change them through
1494 preference settings. For this reason, they must be handled differently by the
1495 regular expression engine. As a consequence of this, `\y' and `\Y' can not be
1496 used within a character class specification.
1497 <P><HR>
1499 <A NAME="Parenthetical_Constructs"</A>
1500 <H2> Parenthetical Constructs </H2>
1502 <H3>Capturing Parentheses</H3>
1504 Capturing Parentheses are of the form `(&#60;regex&#62;)' and can be used to group
1505 arbitrarily complex regular expressions. Parentheses can be nested, but the
1506 total number of parentheses, nested or otherwise, is limited to 50 pairs.
1507 The text that is matched by the regular expression between a matched set of
1508 parentheses is captured and available for text substitutions and
1509 backreferences (see below.) Capturing parentheses carry a fairly high
1510 overhead both in terms of memory used and execution speed, especially if
1511 quantified by `*' or `+'.
1513 <H3>Non-Capturing Parentheses</H3>
1515 Non-Capturing Parentheses are of the form `(?:&#60;regex&#62;)' and facilitate
1516 grouping only and do not incur the overhead of normal capturing parentheses.
1517 They should not be counted when determining numbers for capturing parentheses
1518 which are used with backreferences and substitutions. Because of the limit
1519 on the number of capturing parentheses allowed in a regex, it is advisable to
1520 use non-capturing parentheses when possible.
1522 <H3>Positive Look-Ahead</H3>
1524 Positive look-ahead constructs are of the form `(?=&#60;regex&#62;)' and implement a
1525 zero width assertion of the enclosed regular expression. In other words, a
1526 match of the regular expression contained in the positive look-ahead
1527 construct is attempted. If it succeeds, control is passed to the next
1528 regular expression atom, but the text that was consumed by the positive
1529 look-ahead is first unmatched (backtracked) to the place in the text where
1530 the positive look-ahead was first encountered.
1532 One application of positive look-ahead is the manual implementation of a
1533 first character discrimination optimization. You can include a positive
1534 look-ahead that contains a character class which lists every character that
1535 the following (potentially complex) regular expression could possibly start
1536 with. This will quickly filter out match attempts that can not possibly
1537 succeed.
1539 <H3>Negative Look-Ahead</H3>
1541 Negative look-ahead takes the form `(?!&#60;regex&#62;)' and is exactly the same as
1542 positive look-ahead except that the enclosed regular expression must NOT
1543 match. This can be particularly useful when you have an expression that is
1544 general, and you want to exclude some special cases. Simply precede the
1545 general expression with a negative look-ahead that covers the special cases
1546 that need to be filtered out.
1548 <H3>Positive Look-Behind</H3>
1550 Positive look-behind constructs are of the form `(?&#60;=&#60;regex&#62;)' and implement
1551 a zero width assertion of the enclosed regular expression in front of the
1552 current matching position. It is similar to a positive look-ahead assertion,
1553 except for the fact the the match is attempted on the text preceeding the
1554 current position, possibly even in front of the start of the matching range
1555 of the entire regular expression.
1557 A restriction on look-behind expressions is the fact that the expression
1558 must match a string of a bounded size. In other words, `*', `+', and `{n,}'
1559 quantifiers are not allowed inside the look-behind expression. Moreover,
1560 matching performance is sensitive to the difference between the upper and
1561 lower bound on the matching size. The smaller the difference, the better the
1562 performance. This is especially important for regular expressions used in
1563 highlight patterns.
1565 Another (minor) restriction is the fact that look-<B>ahead</B> patterns, nor
1566 any construct that requires look-ahead information (such as word boundaries)
1567 are supported at the end of a look-behind pattern (no error is raised, but
1568 matching behaviour is unspecified). It is always possible to place these
1569 look-ahead patterns immediately after the look-behind pattern, where they
1570 will work as expected.
1572 Positive look-behind has similar applications as positive look-ahead.
1574 <H3>Negative Look-Behind</H3>
1576 Negative look-behind takes the form `(?&#60;!&#60;regex&#62;)' and is exactly the same as
1577 positive look-behind except that the enclosed regular expression must
1578 NOT match. The same restrictions apply.
1580 Note however, that performance is even more sensitive to the distance
1581 between the size boundaries: a negative look-behind must not match for
1582 <B>any</B> possible size, so the matching engine must check <B>every</B> size.
1584 <H3>Case Sensitivity</H3>
1586 There are two parenthetical constructs that control case sensitivity:
1588 <PRE>
1589 (?i&#60;regex&#62;) Case insensitive; `AbcD' and `aBCd' are
1590 equivalent.
1591 </PRE>
1593 <PRE>
1594 (?I&#60;regex&#62;) Case sensitive; `AbcD' and `aBCd' are
1595 different.
1596 </PRE>
1598 Regular expressions are case sensitive by default, that is, `(?I&#60;regex&#62;)' is
1599 assumed. All regular expression token types respond appropriately to case
1600 insensitivity including character classes and backreferences. There is some
1601 extra overhead involved when case insensitivity is in effect, but only to the
1602 extent of converting each character compared to lower case.
1604 <H3>Matching Newlines</H3>
1606 NEdit regular expressions by default handle the matching of newlines in a way
1607 that should seem natural for most editing tasks. There are situations,
1608 however, that require finer control over how newlines are matched by some
1609 regular expression tokens.
1611 By default, NEdit regular expressions will NOT match a newline character for
1612 the following regex tokens: dot (`.'); a negated character class (`[^...]');
1613 and the following shortcuts for character classes:
1615 <PRE>
1616 `\d', `\D', `\l', `\L', `\s', `\S', `\w', `\W', `\Y'
1617 </PRE>
1619 The matching of newlines can be controlled for the `.' token, negated
1620 character classes, and the `\s' and `\S' shortcuts by using one of the
1621 following parenthetical constructs:
1623 <PRE>
1624 (?n&#60;regex&#62;) `.', `[^...]', `\s', `\S' match newlines
1625 </PRE>
1627 <PRE>
1628 (?N&#60;regex&#62;) `.', `[^...]', `\s', `\S' don't match
1629 newlines
1630 </PRE>
1632 `(?N&#60;regex&#62;)' is the default behavior.
1634 <H3>Notes on New Parenthetical Constructs</H3>
1636 Except for plain parentheses, none of the parenthetical constructs capture
1637 text. If that is desired, the construct must be wrapped with capturing
1638 parentheses, e.g. `((?i&#60;regex))'.
1640 All parenthetical constructs can be nested as deeply as desired, except for
1641 capturing parentheses which have a limit of 50 sets of parentheses,
1642 regardless of nesting level.
1644 <H3>Back References</H3>
1646 Backreferences allow you to match text captured by a set of capturing
1647 parenthesis at some later position in your regular expression. A
1648 backreference is specified using a single backslash followed by a single
1649 digit from 1 to 9 (example: \3). Backreferences have similar syntax to
1650 substitutions (see below), but are different from substitutions in that they
1651 appear within the regular expression, not the substitution string. The number
1652 specified with a backreference identifies which set of text capturing
1653 parentheses the backreference is associated with. The text that was most
1654 recently captured by these parentheses is used by the backreference to
1655 attempt a match. As with substitutions, open parentheses are counted from
1656 left to right beginning with 1. So the backreference `\3' will try to match
1657 another occurrence of the text most recently matched by the third set of
1658 capturing parentheses. As an example, the regular expression `(\d)\1' could
1659 match `22', `33', or `00', but wouldn't match `19' or `01'.
1661 A backreference must be associated with a parenthetical expression that is
1662 complete. The expression `(\w(\1))' contains an invalid backreference since
1663 the first set of parentheses are not complete at the point where the
1664 backreference appears.
1666 <H3>Substitution</H3>
1668 Substitution strings are used to replace text matched by a set of capturing
1669 parentheses. The substitution string is mostly interpreted as ordinary text
1670 except as follows.
1672 The escape sequences described above for special characters, and octal and
1673 hexadecimal escapes are treated the same way by a substitution string. When
1674 the substitution string contains the `&#38;' character, NEdit will substitute the
1675 entire string that was matched by the `Find...' operation. Any of the first
1676 nine sub-expressions of the match string can also be inserted into the
1677 replacement string. This is done by inserting a `\' followed by a digit from
1678 1 to 9 that represents the string matched by a parenthesized expression
1679 within the regular expression. These expressions are numbered left-to-right
1680 in order of their opening parentheses.
1682 The capitalization of text inserted by `&#38;' or `\1', `\2', ... `\9' can be
1683 altered by preceding them with `\U', `\u', `\L', or `\l'. `\u' and `\l'
1684 change only the first character of the inserted entity, while `\U' and `\L'
1685 change the entire entity to upper or lower case, respectively.
1686 <P><HR>
1688 <A NAME="Advanced_Topics"</A>
1689 <H2> Advanced Topics </H2>
1691 <H3>Substitutions</H3>
1693 Regular expression substitution can be used to program automatic editing
1694 operations. For example, the following are search and replace strings to find
1695 occurrences of the `C' language subroutine `get_x', reverse the first and
1696 second parameters, add a third parameter of NULL, and change the name to
1697 `new_get_x':
1699 <PRE>
1700 Search string: `get_x *\( *([^ ,]*), *([^\)]*)\)'
1701 Replace string: `new_get_x(\2, \1, NULL)'
1702 </PRE>
1704 <H3>Ambiguity</H3>
1706 If a regular expression could match two different parts of the text, it will
1707 match the one which begins earliest. If both begin in the same place but
1708 match different lengths, or match the same length in different ways, life
1709 gets messier, as follows.
1711 In general, the possibilities in a list of alternatives are considered in
1712 left-to-right order. The possibilities for `*', `+', and `?' are considered
1713 longest-first, nested constructs are considered from the outermost in, and
1714 concatenated constructs are considered leftmost-first. The match that will be
1715 chosen is the one that uses the earliest possibility in the first choice that
1716 has to be made. If there is more than one choice, the next will be made in
1717 the same manner (earliest possibility) subject to the decision on the first
1718 choice. And so forth.
1720 For example, `(ab|a)b*c' could match `abc' in one of two ways. The first
1721 choice is between `ab' and `a'; since `ab' is earlier, and does lead to a
1722 successful overall match, it is chosen. Since the `b' is already spoken for,
1723 the `b*' must match its last possibility, the empty string, since it must
1724 respect the earlier choice.
1726 In the particular case where no `|'s are present and there is only one `*',
1727 `+', or `?', the net effect is that the longest possible match will be
1728 chosen. So `ab*', presented with `xabbbby', will match `abbbb'. Note that
1729 if `ab*' is tried against `xabyabbbz', it will match `ab' just after `x', due
1730 to the begins-earliest rule. (In effect, the decision on where to start the
1731 match is the first choice to be made, hence subsequent choices must respect
1732 it even if this leads them to less-preferred alternatives.)
1734 <H3>References</H3>
1736 An excellent book on the care and feeding of regular expressions is
1738 <PRE>
1739 "Mastering Regular Expressions"
1740 Jeffrey E. F. Friedl
1741 (c) 1997, O'Reilly &#38; Associates
1742 ISBN 1-56592-257-3
1743 <P><HR>
1744 </PRE>
1746 <A NAME="Example_Regular_Expressions"</A>
1747 <H2> Example Regular Expressions </H2>
1749 The following are regular expression examples which will match:
1751 <UL>
1752 <LI> An entire line.
1753 </UL>
1754 <PRE>
1755 ^.*$
1757 </PRE>
1758 <UL>
1759 <LI> Blank lines.
1760 </UL>
1761 <PRE>
1764 </PRE>
1765 <UL>
1766 <LI> Whitespace on a line.
1767 </UL>
1768 <PRE>
1771 </PRE>
1772 <UL>
1773 <LI> Whitespace across lines.
1774 </UL>
1775 <PRE>
1776 (?n\s+)
1778 </PRE>
1779 <UL>
1780 <LI> Whitespace that spans at least two lines. Note minimal matching `*?' quantifier.
1781 </UL>
1782 <PRE>
1783 (?n\s*?\n\s*)
1785 </PRE>
1786 <UL>
1787 <LI> IP address (not robust).
1788 </UL>
1789 <PRE>
1790 (?:\d{1,3}(?:\.\d{1,3}){3})
1792 </PRE>
1793 <UL>
1794 <LI> Two character US Postal state abbreviations (includes territories).
1795 </UL>
1796 <PRE>
1797 [ACDF-IK-PR-W][A-Z]
1799 </PRE>
1800 <UL>
1801 <LI> Web addresses.
1802 </UL>
1803 <PRE>
1804 (?:http://)?www\.\S+
1806 </PRE>
1807 <UL>
1808 <LI> Case insensitive double words across line breaks.
1809 </UL>
1810 <PRE>
1811 (?i(?n&#60;(\S+)\s+\1&#62;))
1813 </PRE>
1814 <UL>
1815 <LI> Upper case words with possible punctuation.
1816 </UL>
1817 <PRE>
1818 &#60;[A-Z][^a-z\s]*&#62;
1819 <P><HR>
1820 </PRE>
1822 <A NAME="Macro/Shell_Extensions"</A>
1823 <H1> Macro/Shell Extensions </H1>
1825 <A NAME="Shell_Commands_and_Filters"</A>
1826 <H2> Shell Commands and Filters </H2>
1828 The Shell menu (Unix versions only) allows you to execute Unix shell commands
1829 from within NEdit. You can add items to the menu to extend NEdit's command
1830 set or to incorporate custom automatic editing features using shell commands
1831 or editing languages like awk and sed. To add items to the menu, select
1832 Preferences -&#62; Default Settings Customize Menus -&#62; Shell Menu. NEdit comes
1833 pre-configured with a few useful Unix commands like spell and sort, but we
1834 encourage you to add your own custom extensions.
1836 Filter Selection... prompts you for a Unix command to use to process the
1837 currently selected text. The output from this command replaces the contents
1838 of the selection.
1840 Execute Command... prompts you for a Unix command and replaces the current
1841 selection with the output of the command. If there is no selection, it
1842 deposits the output at the current insertion point. In the Shell Command
1843 field, the % character expands to the name (including directory path), and
1844 the # character expands to the current line number of the file in the window.
1845 To include a % or # character in the command, use %% or ##, respectively.
1847 Execute Command Line uses the position of the cursor in the window to
1848 indicate a line to execute as a shell command line. The cursor may be
1849 positioned anywhere on the line. This command allows you to use an NEdit
1850 window as an editable command window for saving output and saving commands
1851 for re-execution. Note that the same character expansions described above
1852 in Execute Command also occur with this command.
1854 The X resource called nedit.shell (See "<A HREF="#Customizing_NEdit">Customizing NEdit</A>") determines which
1855 Unix shell is used to execute commands. The default value for this resource
1856 is /bin/csh.
1857 <P><HR>
1859 <A NAME="Learn/Replay"</A>
1860 <H2> Learn/Replay </H2>
1862 Selecting Learn Keystrokes from the Macro menu puts NEdit in learn mode. In
1863 learn mode, keystrokes and menu commands are recorded, to be played back
1864 later, using the Replay Keystrokes command, or pasted into a macro in the
1865 Macro Commands dialog of the Default Settings menu in Preferences.
1867 Note that only keyboard and menu commands are recorded, not mouse clicks or
1868 mouse movements since these have no absolute point of reference, such as
1869 cursor or selection position. When you do a mouse-based operation in learn
1870 mode, NEdit will beep (repeatedly) to remind you that the operation was not
1871 recorded.
1873 Learn mode is also the quickest and easiest method for writing macros. The
1874 dialog for creating macro commands contains a button labeled "Paste Learn /
1875 Replay Macro", which will deposit the last sequence learned into the body of
1876 the macro.
1878 <H3>Repeating Actions and Learn/Replay Sequences</H3>
1880 You can repeat the last (keyboard-based) command, or learn/replay sequence
1881 with the Repeat... command in the Macro menu. To repeat an action, first do
1882 the action (that is, insert a character, do a search, move the cursor), then
1883 select Repeat..., decide how or how many times you want it repeated, and
1884 click OK. For example, to move down 30 lines through a file, you could type:
1885 &#60;Down Arrow&#62; Ctrl+, 29 &#60;Return&#62;. To repeat a learn/replay sequence, first
1886 learn it, then select Repeat..., click on Learn/Replay and how you want it
1887 repeated, then click OK.
1889 If the commands you are repeating advance the cursor through the file, you
1890 can also repeat them within a range of characters, or from the current cursor
1891 position to the end of the file. To iterate over a range of characters, use
1892 the primary selection (drag the left mouse button over the text) to mark the
1893 range you want to operate on, and select "In Selection" in the Repeat dialog.
1895 When using In "Selection" or "To End" with a learned sequence, try to do
1896 cursor movement as the last step in the sequence, since testing of the cursor
1897 position is only done at the end of the sequence execution. If you do cursor
1898 movement first, for example searching for a particular word then doing a
1899 modification, the position of the cursor won't be checked until the sequence
1900 has potentially gone far beyond the end of your desired range.
1902 It's easy for a repeated command to get out of hand, and you can easily
1903 generate an infinite loop by using range iteration on a command which doesn't
1904 progress. To cancel a repeating command in progress, type Ctrl+. (period),
1905 or select Cancel Macro from the Macro menu.
1906 <P><HR>
1908 <A NAME="Macro_Language"</A>
1909 <H2> Macro Language </H2>
1911 Macros can be called from Macro menu commands, window background menu
1912 commands, within the smart-indent framework, from the autoload macro file and
1913 from the command line.
1914 Macro menu and window background menu commands are defined under Preferences
1915 -&#62; Default Settings -&#62; Customize Menus. Help on creating items in these
1916 menus can be found in the section, Help -&#62; Customizing -&#62; Preferences.
1918 The autoload macro file is a file of macro commands and definitions which
1919 NEdit will automatically execute when it is first started. Its location is
1920 dependent on your environment:
1921 <UL>
1922 <LI> The default place for the file is '$HOME/.nedit/autoload.nm',
1923 <LI> if the variable $NEDIT_HOME is set in your environment it is located at
1924 </UL>
1925 <PRE>
1926 '$NEDIT_HOME/autoload.nm',
1927 </PRE>
1928 <UL>
1929 <LI> if you are using old-style run control files (i.e. $HOME/.nedit is a regular
1930 </UL>
1931 <PRE>
1932 file) it is located in $HOME/.neditmacro'.
1933 </PRE>
1934 (For VMS, the file is in '$NEDIT_HOME/autoload.nm' if $NEDIT_HOME is set, in
1935 'SYS$LOGIN:.neditmacro' otherwise.)
1937 NEdit's macro language is a simple interpreter with integer arithmetic,
1938 dynamic strings, and C-style looping constructs (very similar to the
1939 procedural portion of the Unix awk program). From the macro language, you
1940 can call the same action routines which are bound to keyboard keys and menu
1941 items, as well additional subroutines for accessing and manipulating editor
1942 data, which are specific to the macro language (these are listed in the
1943 sections titled "<A HREF="#Macro_Subroutines">Macro Subroutines</A>", and "<A HREF="#Action_Routines">Action Routines</A>").
1945 <H3>Syntax</H3>
1947 An NEdit macro language program consists of a list of statements, each
1948 terminated by a newline. Groups of statements which are executed together
1949 conditionally, such as the body of a loop, are surrounded by curly braces
1950 "{}".
1952 Blank lines and comments are also allowed. Comments begin with a "#" and end
1953 with a newline, and can appear either on a line by themselves, or at the end
1954 of a statement.
1956 Statements which are too long to fit on a single line may be split across
1957 several lines, by placing a backslash "\" character at the end of each line
1958 to be continued.
1960 <H3>Data Types</H3>
1962 The NEdit macro language recognizes only three data types, dynamic character
1963 strings, integer values and associative arrays. In general strings and
1964 integers can be used interchangeably. If a string represents an integer
1965 value, it can be used as an integer. Integers can be compared and
1966 concatenated with strings. Arrays may contain integers, strings, or arrays.
1967 Arrays are stored key/value pairs. Keys are always stored as strings.
1969 <H4>Integer Constants</H4>
1971 Integers are non-fractional numbers in the range of -2147483647 to
1972 2147483647. Integer constants must be in decimal. For example:
1974 <PRE>
1975 a = -1
1976 b = 1000
1977 </PRE>
1979 <H4>Character String Constants</H4>
1981 Character string constants are enclosed in double quotes. For example:
1983 <PRE>
1984 a = "a string"
1985 dialog("Hi there!", "Dismiss")
1986 </PRE>
1988 Strings may also include C-language style escape sequences:
1990 <PRE>
1991 \\ Backslash \t Tab \f Form feed
1992 \" Double quote \b Backspace \a Alert
1993 \n Newline \r Carriage return \v Vertical tab
1994 </PRE>
1996 For example, to send output to the terminal from which NEdit was started, a
1997 newline character is necessary because, like printf, t_print requires
1998 explicit newlines, and also buffers its output on a per-line basis:
2000 <PRE>
2001 t_print("a = " a "\n")
2002 </PRE>
2004 <H3>Variables</H3>
2006 Variable names must begin either with a letter (local variables), or a $
2007 (global variables). Beyond the first character, variables may also contain
2008 numbers and underscores `_'. Variables are called in to existence just by
2009 setting them (no explicit declarations are necessary).
2011 Local variables are limited in scope to the subroutine (or menu item
2012 definition) in which they appear. Global variables are accessible from all
2013 routines, and their values persist beyond the call which created them, until
2014 reset.
2016 <H4>Built-in Variables</H4>
2018 NEdit has a number of permanently defined variables, which are used to access
2019 global editor information and information about the the window in which the
2020 macro is executing. These are listed along with the built in functions in
2021 the section titled "<A HREF="#Macro_Subroutines">Macro Subroutines</A>".
2023 <H3>Functions and Subroutines</H3>
2025 The syntax of a function or subroutine call is:
2027 <PRE>
2028 function_name(arg1, arg2, ...)
2029 </PRE>
2031 where arg1, arg2, etc. represent up to 9 argument values which are passed to
2032 the routine being called. A function or subroutine call can be on a line by
2033 itself, as above, or if it returns a value, can be invoked within a character
2034 or numeric expression:
2036 <PRE>
2037 a = fn1(b, c) + fn2(d)
2038 dialog("fn3 says: " fn3())
2039 </PRE>
2041 Arguments are passed by value. This means that you can not return values via
2042 the argument list, only through the function value or indirectly through
2043 agreed-upon global variables.
2045 <H4>Built-in Functions</H4>
2047 NEdit has a wide range of built in functions which can be called from the
2048 macro language. These routines are divided into two classes, macro-language
2049 functions, and editor action routines. Editor action routines are more
2050 flexible, in that they may be called either from the macro language, or bound
2051 directly to keys via translation tables. They are also limited, however, in
2052 that they can not return values. Macro language routines can return values,
2053 but can not be bound to keys in translation tables.
2055 Nearly all of the built-in subroutines operate on an implied window, which is
2056 initially the window from which the macro was started. To manipulate the
2057 contents of other windows, use the focus_window subroutine to change the
2058 focus to the ones you wish to modify. focus_window can also be used to
2059 iterate over all of the currently open windows, using the special keyword
2060 names, "last" and "next".
2062 For backwards compatibility, hyphenated action routine names are allowed, and
2063 most of the existing action routines names which contain underscores have an
2064 equivalent version containing hyphens ('-') instead of underscores. Use of
2065 these names is discouraged. The macro parser resolves the ambiguity between
2066 '-' as the subtraction/negation operator, and - as part of an action routine
2067 name by assuming subtraction unless the symbol specifically matches an action
2068 routine name.
2070 <H4>User Defined Functions</H4>
2072 Users can define their own macro subroutines, using the define keyword:
2074 <PRE>
2075 define subroutine_name {
2076 &#60; body of subroutine &#62;
2078 </PRE>
2080 Macro definitions can not appear within other definitions, or within macro
2081 menu item definitions (usually they are found in the autoload macro file).
2083 The arguments with which a user-defined subroutine or function was invoked,
2084 are presented as $1, $2, ... , $9. The number of arguments can be read from
2085 $n_args.
2087 To return a value from a subroutine, and/or to exit from the subroutine
2088 before the end of the subroutine body, use the return statement:
2090 <PRE>
2091 return &#60;value to return&#62;
2092 </PRE>
2094 <H3>Operators and Expressions</H3>
2096 Operators have the same meaning and precedence that they do in C, except for
2097 ^, which raises a number to a power (y^x means y to the x power), rather than
2098 bitwise exclusive OR. The table below lists operators in decreasing order of
2099 precedence.
2101 <PRE>
2102 Operators Associativity
2104 ^ right to left
2105 - ! ++ -- (unary)
2106 * / % left to right
2107 + - left to right
2108 &#62; &#62;= &#60; &#60;= == != left to right
2109 &#38; left to right
2110 | left to right
2111 &#38;&#38; left to right
2112 || left to right
2113 (concatenation) left to right
2114 = += -= *= /= %=, &#38;= |= right to left
2115 </PRE>
2117 The order in which operands are evaluated in an expression is undefined,
2118 except for &#38;&#38; and ||, which like C, evaluate operands left to right, but stop
2119 when further evaluation would no longer change the result.
2121 <H4>Numerical Operators</H4>
2123 The numeric operators supported by the NEdit macro language are listed below:
2125 <PRE>
2126 + addition
2127 - subtraction or negation
2128 * multiplication
2129 / division
2130 % modulo
2131 ^ power
2132 &#38; bitwise and
2133 | bitwise or
2134 </PRE>
2136 Increment (++) and decrement (--) operators can also be appended or prepended
2137 to variables within an expression. Prepended increment/decrement operators
2138 act before the variable is evaluated. Appended increment/decrement operators
2139 act after the variable is evaluated.
2141 <H4>Logical and Comparison Operators</H4>
2143 Logical operations produce a result of 0 (for false) or 1 (for true). In a
2144 logical operation, any non-zero value is recognized to mean true. The
2145 logical and comparison operators allowed in the NEdit macro language are
2146 listed below:
2148 <PRE>
2149 &#38;&#38; logical and
2150 || logical or
2151 ! not
2152 &#62; greater
2153 &#60; less
2154 &#62;= greater or equal
2155 &#60;= less or equal
2156 == equal (integers and/or strings)
2157 != not equal (integers and/or strings)
2158 </PRE>
2160 <H4>Character String Operators</H4>
2162 The "operator" for concatenating two strings is the absence of an operator.
2163 Adjoining character strings with no operator in between means concatenation:
2165 <PRE>
2166 d = a b "string" c
2167 t_print("the value of a is: " a)
2168 </PRE>
2170 Comparison between character strings is done with the == and != operators,
2171 (as with integers). There are a number of useful built-in routines for
2172 working with character strings, which are listed in the section called
2173 "<A HREF="#Macro_Subroutines">Macro Subroutines</A>".
2175 <H4>Arrays and Array Operators</H4>
2177 Arrays may contain either strings, integers, or other arrays. Arrays are
2178 associative, which means that they relate two pieces of information, the key
2179 and the value. The key is always a string; if you use an integer it is
2180 converted to a string.
2182 To determine if a given key is in an array, use the 'in' keyword.
2184 <PRE>
2185 if ("6" in x)
2186 &#60;body&#62;
2187 </PRE>
2189 If the left side of the in keyword is an array, the result is true if every
2190 key in the left array is in the right array. Array values are not compared.
2192 To iterate through all the keys of an array use the 'for' looping construct.
2193 Keys are not guaranteed in any particular order:
2195 <PRE>
2196 for (aKey in x)
2197 &#60;body&#62;
2198 </PRE>
2200 Elements can be removed from an array using the delete command:
2202 <PRE>
2203 delete x[3] # deletes element with key 3
2204 delete x[] # deletes all elements
2205 </PRE>
2207 The number of elements in an array can be determined by referencing the
2208 array with no indices:
2210 <PRE>
2211 dialog("array x has " x[] " elements", "OK")
2212 </PRE>
2214 Arrays can be combined with some operators. All the following operators only
2215 compare the keys of the arrays.
2217 <PRE>
2218 result = x + y (Merge arrays)
2219 </PRE>
2221 The 'result' is a new array containing keys from both x and y. If
2222 duplicates are present values from y are used.
2224 <PRE>
2225 result = x - y (Remove keys)
2226 </PRE>
2228 The 'result' is a new array containing all keys from x that are not in y.
2230 <PRE>
2231 result = x &#38; y (Common keys)
2232 </PRE>
2234 The 'result' is a new array containing all keys which are in both x and y.
2235 The values from y are used.
2237 <PRE>
2238 result = x | y (Unique keys)
2239 </PRE>
2241 The 'result' is a new array containing keys which exist in either x or y,
2242 but not both.
2244 When duplicate keys are encountered using the + and &#38; operators, the values
2245 from the array on the right side of the operators are used for the result.
2246 All of the above operators are array only, meaning both the left and right
2247 sides of the operator must be arrays. The results are also arrays.
2249 Array keys can also contain multiple dimensions:
2251 <PRE>
2252 x[1, 1, 1] = "string"
2253 </PRE>
2255 These are used in the expected way, e.g.:
2257 <PRE>
2258 for (i = 1; i &#60; 3; i++)
2260 for (j = 1; j &#60; 3; j++)
2262 x[i, j] = k++
2265 </PRE>
2267 gives the following array:
2269 <PRE>
2270 x[1, 1] = 0
2271 x[1, 2] = 1
2272 x[2, 1] = 2
2273 x[2, 2] = 3
2274 </PRE>
2276 Internally all indices are part of one string, separated by the string
2277 $sub_sep (ASCII 0x18). The first key in the above example is in fact
2279 <PRE>
2280 ["1" $sub_sep "1"]
2281 </PRE>
2283 If you need to extract one of the keys, you can use split(), using
2284 $sub_sep as the separator.
2286 You can also check for the existence of multi-dimensional array by
2287 looking for $sub_sep in the key.
2289 Last, you need $sub_sep if you want to use the 'in' keyword.
2291 <PRE>
2292 if ((1,2) in myArray)
2293 {..}
2294 </PRE>
2296 doesn't work, but
2298 <PRE>
2299 if (("1" $sub_sep "2") in myArray)
2300 {..}
2301 </PRE>
2303 does work.
2305 <H3>Looping and Conditionals</H3>
2307 NEdit supports looping constructs: for and while, and conditional statements:
2308 if and else, with essentially the same syntax as C:
2310 <PRE>
2311 for (&#60;init&#62;, ...; &#60;condition&#62;; &#60;increment&#62;, ...) &#60;body&#62;
2312 </PRE>
2314 <PRE>
2315 while (&#60;condition&#62;) &#60;body&#62;
2316 </PRE>
2318 <PRE>
2319 if (&#60;condition&#62;) &#60;body&#62;
2320 </PRE>
2322 <PRE>
2323 if (&#60;condition&#62;) &#60;body&#62; else &#60;body&#62;
2324 </PRE>
2326 &#60;body&#62;, as in C, can be a single statement, or a list of statements enclosed
2327 in curly braces ({}). &#60;condition&#62; is an expression which must evaluate to
2328 true for the statements in &#60;body&#62; to be executed. for loops may also contain
2329 initialization statements, &#60;init&#62;, executed once at the beginning of the
2330 loop, and increment/decrement statements (or any arbitrary statement), which
2331 are executed at the end of the loop, before the condition is evaluated again.
2333 Examples:
2335 <PRE>
2336 for (i=0; i&#60;100; i++)
2337 j = i * 2
2338 </PRE>
2340 <PRE>
2341 for (i=0, j=20; i&#60;20; i++, j--) {
2342 k = i * j
2343 t_print(i, j, k)
2345 </PRE>
2347 <PRE>
2348 while (k &#62; 0)
2350 k = k - 1
2351 t_print(k)
2353 </PRE>
2355 <PRE>
2356 for (;;) {
2357 if (i-- &#60; 1)
2358 break
2360 </PRE>
2362 Loops may contain break and continue statements. A break statement causes an
2363 exit from the innermost loop, a continue statement transfers control to the
2364 end of the loop.
2365 <P><HR>
2367 <A NAME="Macro_Subroutines"</A>
2368 <H2> Macro Subroutines </H2>
2370 <H3>Built in Variables</H3>
2372 These variables are read-only and can not be changed.
2374 <PRE>
2375 <B>$active_pane</B>
2376 </PRE>
2377 Index of the current pane.
2379 <PRE>
2380 <B>$auto_indent</B>
2381 </PRE>
2382 Contains the current preference for auto indent.
2383 Can be "off", "on" or "auto".
2385 <PRE>
2386 <B>$calltip_ID</B>
2387 </PRE>
2388 Equals the ID of the currently displayed calltip, or 0 if no calltip is
2389 being displayed.
2391 <PRE>
2392 <B>$cursor</B>
2393 </PRE>
2394 Position of the cursor in the current window.
2396 <PRE>
2397 <B>$column</B>
2398 </PRE>
2399 Column number of the cursor position in the current window.
2401 <PRE>
2402 <B>$display_width</B>
2403 </PRE>
2404 Width of the current pane in pixels.
2406 <PRE>
2407 <B>$em_tab_dist</B>
2408 </PRE>
2409 If tab emulation is turned on in the Tabs...
2410 dialog of the Preferences menu, value is the
2411 distance between emulated tab stops. If tab
2412 emulation is turned off, value is -1.
2414 <PRE>
2415 <B>$empty_array</B>
2416 </PRE>
2417 An array with no elements. This can be used to initialize
2418 an array to an empty state.
2420 <PRE>
2421 <B>$file_format</B>
2422 </PRE>
2423 Current newline format that the file will be saved with. Can
2424 be "unix", "dos" or "macintosh".
2426 <PRE>
2427 <B>$file_name</B>
2428 </PRE>
2429 Name of the file being edited in the current
2430 window, stripped of directory component.
2432 <PRE>
2433 <B>$file_path</B>
2434 </PRE>
2435 Directory component of file being edited in the current window.
2437 <PRE>
2438 <B>$font_name</B>
2439 </PRE>
2440 Contains the current plain text font name.
2442 <PRE>
2443 <B>$font_name_bold</B>
2444 </PRE>
2445 Contains the current bold text font name.
2447 <PRE>
2448 <B>$font_name_bold_italic</B>
2449 </PRE>
2450 Contains the current bold-italic text font name.
2452 <PRE>
2453 <B>$font_name_italic</B>
2454 </PRE>
2455 Contains the current italic text font name.
2457 <PRE>
2458 <B>$highlight_syntax</B>
2459 </PRE>
2460 Whether syntax highlighting is turned on.
2462 <PRE>
2463 <B>$incremental_backup</B>
2464 </PRE>
2465 Contains 1 if incremental auto saving is on, otherwise 0.
2467 <PRE>
2468 <B>$incremental_search_line</B>
2469 </PRE>
2470 Has a value of 1 if the preference is
2471 selected to always show the incremental search line, otherwise 0.
2473 <PRE>
2474 <B>$language_mode</B>
2475 </PRE>
2476 Name of language mode set in the current window.
2478 <PRE>
2479 <B>$line</B>
2480 </PRE>
2481 Line number of the cursor position in the current window.
2483 <PRE>
2484 <B>$locked</B>
2485 </PRE>
2486 True if the file has been locked by the user.
2488 <PRE>
2489 <B>$make_backup_copy</B>
2490 </PRE>
2491 Has a value of 1 if original file is kept in a
2492 backup file on save, otherwise 0.
2494 <PRE>
2495 <B>$max_font_width</B>
2496 </PRE>
2497 The maximum font width of all the active styles.
2498 Syntax highlighting styles are only considered if syntax highlighting
2499 is turned on.
2501 <PRE>
2502 <B>$min_font_width</B>
2503 </PRE>
2504 The minimum font width of all the active styles.
2505 Syntax highlighting styles are only considered if syntax highlighting
2506 is turned on.
2508 <PRE>
2509 <B>$modified</B>
2510 </PRE>
2511 True if the file in the current window has
2512 been modified and the modifications have not
2513 yet been saved.
2515 <PRE>
2516 <B>$n_display_lines</B>
2517 </PRE>
2518 The number of lines visible in the currently active pane.
2520 <PRE>
2521 <B>$n_panes</B>
2522 </PRE>
2523 The number of panes in the current window.
2525 <PRE>
2526 <B>$overtype_mode</B>
2527 </PRE>
2528 True if in Overtype mode.
2530 <PRE>
2531 <B>$read_only</B>
2532 </PRE>
2533 True if the file is read only.
2535 <PRE>
2536 <B>$selection_start, $selection_end</B>
2537 </PRE>
2538 Beginning and ending positions of the
2539 primary selection in the current window, or
2540 -1 if there is no text selected in the current window.
2542 <PRE>
2543 <B>$selection_left, $selection_right</B>
2544 </PRE>
2545 Left and right character offsets of the rectangular (primary) selection in
2546 the current window, or -1 if there is no selection or it is not rectangular.
2548 <PRE>
2549 <B>$server_name</B>
2550 </PRE>
2551 Name of the current NEdit server.
2553 <PRE>
2554 <B>$show_line_numbers</B>
2555 </PRE>
2556 Whether line numbers are shown next to the text.
2558 <PRE>
2559 <B>$show_matching</B>
2560 </PRE>
2561 Contains the current preference for showing matching pairs,
2562 such as "[]" and "{}" pairs. Can be "off", "delimiter", or "range".
2564 <PRE>
2565 <B>$match_syntax_based</B>
2566 </PRE>
2567 Whether pair matching should use syntax information, if available.
2569 <PRE>
2570 <B>$statistics_line</B>
2571 </PRE>
2572 Has a value of 1 if the statistics line is shown, otherwise 0.
2574 <PRE>
2575 <B>$sub_sep</B>
2576 </PRE>
2577 Contains the value of the array sub-script separation string.
2579 <PRE>
2580 <B>$tab_dist</B>
2581 </PRE>
2582 The distance between tab stops for a
2583 hardware tab character, as set in the
2584 Tabs... dialog of the Preferences menu.
2586 <PRE>
2587 <B>$text_length</B>
2588 </PRE>
2589 The length of the text in the current window.
2591 <PRE>
2592 <B>$top_line</B>
2593 </PRE>
2594 The line number of the top line of the currently active pane.
2596 <PRE>
2597 <B>$use_tabs</B>
2598 </PRE>
2599 Whether the user is allowing the NEdit to insert tab characters to maintain
2600 spacing in tab emulation and rectangular dragging operations. (The setting of
2601 the "Use tab characters in padding and emulated tabs" button in the Tabs...
2602 dialog of the Preferences menu.)
2604 <PRE>
2605 <B>$wrap_margin</B>
2606 </PRE>
2607 The right margin in the current window for text wrapping and filling.
2609 <PRE>
2610 <B>$wrap_text</B>
2611 </PRE>
2612 The current wrap text mode. Values are "none", "auto" or "continuous".
2614 <H3>Built-in Subroutines</H3>
2616 <PRE>
2617 <B>append_file( string, filename )</B>
2618 </PRE>
2619 Appends a string to a named file. Returns 1 on successful write, or 0 if
2620 unsuccessful.
2622 <PRE>
2623 <B>beep()</B>
2624 </PRE>
2625 Ring the bell.
2627 <PRE>
2628 <B>calltip( "text_or_key" [, mode [, pos]] )</B>
2629 </PRE>
2630 Pops up a calltip. &#60;pos&#62; is an optional position in the buffer where the tip
2631 will be displayed. The upper-left corner of the calltip will appear below
2632 where the cursor would appear if it were at this position. &#60;mode&#62; is one of
2633 "tipText" (default), "tipKey", or "tagKey". "tipText" displays the text as-is,
2634 "tagKey" uses it as the key to look up a tag, then converts the tag to a
2635 calltip, and "tipKey uses it as the key to look up a calltip, then falls back
2636 to a tag if that fails. You'll usually use "tipKey" or "tipText".
2637 Returns the ID of the calltip if it was found and/or displayed correctly,
2638 0 otherwise.
2640 <PRE>
2641 <B>clipboard_to_string()</B>
2642 </PRE>
2643 Returns the contents of the clipboard as a macro string. Returns empty
2644 string on error.
2646 <PRE>
2647 <B>dialog( message, btn_1_label, btn_2_label, ... )</B>
2648 </PRE>
2649 Pop up a dialog for querying and presenting information to the user. First
2650 argument is a string to show in the message area of the dialog. Up to eight
2651 additional optional arguments represent labels for buttons to appear along
2652 the bottom of the dialog. Returns the number of the button pressed (the
2653 first button is number 1), or 0 if the user closed the dialog via the window
2654 close box.
2656 <PRE>
2657 <B>focus_window( window_name )</B>
2658 </PRE>
2659 Sets the window on which subsequent macro commands operate. window_name can
2660 be either a fully qualified file name, or one of "last" for the last window
2661 created, or "next" for the next window in the chain from the currently
2662 focused window (the first window being the one returned from calling
2663 focus_window("last"). Returns the name of the newly-focused window, or an
2664 empty string if the requested window was not found.
2666 <PRE>
2667 <B>get_character( position )</B>
2668 </PRE>
2669 Returns the single character at the position
2670 indicated by the first argument to the routine from the current window.
2672 <PRE>
2673 <B>get_range( start, end )</B>
2674 </PRE>
2675 Returns the text between a starting and ending position from the current
2676 window.
2678 <PRE>
2679 <B>get_selection()</B>
2680 </PRE>
2681 Returns a string containing the text currently selected by the primary
2682 selection either from the current window (no keyword), or from anywhere on
2683 the screen (keyword "any").
2685 <PRE>
2686 <B>getenv( name )</B>
2687 </PRE>
2688 Gets the value of an environment variable.
2690 <PRE>
2691 <B>kill_calltip( [calltip_ID] )</B>
2692 </PRE>
2693 Kills any calltip that is being displayed in the window in which the macro is
2694 running. If there is no displayed calltip this does nothing. If a calltip
2695 ID is supplied then the calltip is killed only if its ID is calltip_ID.
2697 <PRE>
2698 <B>length( string )</B>
2699 </PRE>
2700 Returns the length of a string
2702 <PRE>
2703 <B>list_dialog( message, text, btn_1_label, btn_2_label, ... )</B>
2704 </PRE>
2705 Pop up a dialog for prompting the user to choose a line from the given text
2706 string. The first argument is a message string to be used as a title for the
2707 fixed text describing the list. The second string provides the list data:
2708 this is a text string in which list entries are separated by newline
2709 characters. Up to seven additional optional arguments represent labels for
2710 buttons to appear along the bottom of the dialog. Returns the line of text
2711 selected by the user as the function value (without any newline separator) or
2712 the empty string if none was selected, and number of the button pressed (the
2713 first button is number 1), in $list_dialog_button. If the user closes the
2714 dialog via the window close box, the function returns the empty string, and
2715 $list_dialog_button returns 0.
2717 <PRE>
2718 <B>max( n1, n2, ... )</B>
2719 </PRE>
2720 Returns the maximum value of all of its arguments
2722 <PRE>
2723 <B>min( n1, n2, ... )</B>
2724 </PRE>
2725 Returns the minimum value of all of its arguments
2727 <PRE>
2728 <B>read_file( filename )</B>
2729 </PRE>
2730 Reads the contents of a text file into a string. On success, returns 1 in
2731 $read_status, and the contents of the file as a string in the subroutine
2732 return value. On failure, returns the empty string "" and an 0 $read_status.
2734 <PRE>
2735 <B>replace_in_string( string, search_for, replace_with [, type, "copy"] )</B>
2736 </PRE>
2737 Replaces all occurrences of a search string in a string with a replacement
2738 string. Arguments are 1: string to search in, 2: string to search for, 3:
2739 replacement string. There are two optional arguments. One is a search type,
2740 either "literal", "case", "word", "caseWord", "regex", or "regexNoCase".
2741 The default search type is "literal". If the optional "copy" argument is
2742 specified, a copy of the input string is returned when no replacements were
2743 performed. By default an empty string ("") will be returned in this case.
2744 Returns a new string with all of the replacements done.
2746 <PRE>
2747 <B>replace_range( start, end, string )</B>
2748 </PRE>
2749 Replaces all of the text in the current window between two positions.
2751 <PRE>
2752 <B>replace_selection( string )</B>
2753 </PRE>
2754 Replaces the primary-selection selected text in the current window.
2756 <PRE>
2757 <B>replace_substring( string, start, end, replace_with )</B>
2758 </PRE>
2759 Replacing a substring between two positions in a string within another string.
2761 <PRE>
2762 <B>search( search_for, start [, search_type, wrap, direction] )</B>
2763 </PRE>
2764 Searches silently in a window without dialogs, beeps, or changes to the
2765 selection. Arguments are: 1: string to search for, 2: starting position.
2766 Optional arguments may include the strings: "wrap" to make the search wrap
2767 around the beginning or end of the string, "backward" or "forward" to change
2768 the search direction ("forward" is the default), "literal", "case", "word",
2769 "caseWord", "regex", or "regexNoCase" to change the search type (default is
2770 "literal"). Returns the starting position of the match, or -1 if nothing
2771 matched. Also returns the ending position of the match in $search_end.
2773 <PRE>
2774 <B>search_string( string, search_for, start [, search_type, direction] )</B>
2775 </PRE>
2777 Built-in macro subroutine for searching a string. Arguments are 1: string to
2778 search in, 2: string to search for, 3: starting position. Optional arguments
2779 may include the strings: "wrap" to make the search wrap around the beginning
2780 or end of the string, "backward" or "forward" to change the search direction
2781 ("forward" is the default), "literal", "case", "word", "caseWord", "regex",
2782 or "regexNoCase" to change the search type (default is "literal"). Returns
2783 the starting position of the match, or -1 if nothing matched. Also returns
2784 the ending position of the match in $search_end.
2786 <PRE>
2787 <B>select( start, end )</B>
2788 </PRE>
2789 Selects (with the primary selection) text in the current buffer between a
2790 starting and ending position.
2792 <PRE>
2793 <B>select_rectangle( start, end, left, right )</B>
2794 </PRE>
2795 Selects a rectangular area of text between a starting and ending position,
2796 and confined horizontally to characters displayed between positions "left",
2797 and "right".
2799 <PRE>
2800 <B>set_cursor_pos( position )</B>
2801 </PRE>
2802 Set the cursor position for the current window.
2804 <PRE>
2805 <B>shell_command( command, input_string )</B>
2806 </PRE>
2807 Executes a shell command, feeding it input from input_string. On completion,
2808 output from the command is returned as the function value, and the command's
2809 exit status is returned in the global variable $shell_cmd_status.
2811 <PRE>
2812 <B>split(string, separation_string [, search_type])</B>
2813 </PRE>
2814 Splits a string using the separator specified. Optionally the search_type
2815 argument can specify how the separation_string is interpreted. The default
2816 is "literal". The returned value is an array with keys beginning at 0.
2818 <PRE>
2819 <B>string_dialog( message, btn_1_label, btn_2_label, ... )</B>
2820 </PRE>
2821 Pops up a dialog prompting the user to enter information. The first argument
2822 is a string to show in the message area of the dialog. Up to nine additional
2823 optional arguments represent labels for buttons to appear along the bottom of
2824 the dialog. Returns the string entered by the user as the function value,
2825 and number of the button pressed (the first button is number 1), in
2826 $string_dialog_button. If the user closes the dialog via the window close
2827 box, the function returns the empty string, and $string_dialog_button returns
2830 <PRE>
2831 <B>string_compare(string1, string2 [, consider-case])</B>
2832 </PRE>
2833 Compare two strings and return 0 if they are equal, -1 if string1 is less
2834 than string2 or 1 if string1 is greater than string2. The values for the
2835 optional consider-case argument is either "case" or "nocase". The default
2836 is to do a case sensitive comparison.
2838 <PRE>
2839 <B>string_to_clipboard( string )</B>
2840 </PRE>
2841 Copy the contents of a macro string to the clipboard.
2843 <PRE>
2844 <B>substring( string, start, end )</B>
2845 </PRE>
2846 Returns the portion of a string between a starting and ending position.
2848 <PRE>
2849 <B>t_print( string1, string2, ... )</B>
2850 </PRE>
2851 Writes strings to the terminal (stdout) from which NEdit was started.
2853 <PRE>
2854 <B>tolower( string )</B>
2855 </PRE>
2856 Return an all lower-case version of string.
2858 <PRE>
2859 <B>toupper( string )</B>
2860 </PRE>
2861 Return an all upper-case version of string.
2863 <PRE>
2864 <B>write_file( string, filename )</B>
2865 </PRE>
2866 Writes a string (parameter 1) to a file named in parameter 2. Returns 1 on
2867 successful write, or 0 if unsuccessful.
2868 <P><HR>
2870 <A NAME="Action_Routines"</A>
2871 <H2> Action Routines </H2>
2873 All of the editing capabilities of NEdit are represented as a special type of
2874 subroutine, called an action routine, which can be invoked from both macros
2875 and translation table entries (see "<A HREF="#Key_Binding">Key Binding</A>" in the
2876 Customizing section of the Help menu).
2878 <H3>Actions Representing Menu Commands</H3>
2880 <PRE>
2881 File Menu Search Menu
2882 ----------------------- -------------------------
2883 new() find()
2884 open() find_dialog()
2885 open_dialog() find_again()
2886 open_selected() find_selection()
2887 close() replace()
2888 save() replace_dialog()
2889 save_as() replace_all()
2890 save_as_dialog() replace_in_selection()
2891 revert_to_saved() replace_again()
2892 include_file() goto_line_number()
2893 include_file_dialog() goto_line_number_dialog()
2894 load_macro_file() goto_selected()
2895 load_macro_file_dialog() mark()
2896 load_tags_file() mark_dialog()
2897 load_tags_file_dialog() goto_mark()
2898 unload_tags_file() goto_mark_dialog()
2899 print() goto_matching()
2900 print_selection() select_to_matching()
2901 exit() find_definition()
2902 </PRE>
2904 <PRE>
2905 Edit Menu Shell Menu
2906 ----------------------- -------------------------
2907 undo() filter_selection_dialog()
2908 redo() filter_selection()
2909 delete() execute_command()
2910 select_all() execute_command_dialog()
2911 shift_left() execute_command_line()
2912 shift_left_by_tab() shell_menu_command()
2913 shift_right()
2914 shift_right_by_tab() Macro Menu
2915 uppercase() -------------------------
2916 lowercase() macro_menu_command()
2917 fill_paragraph() repeat_macro()
2918 control_code_dialog() repeat_dialog()
2919 </PRE>
2921 <PRE>
2922 Windows Menu
2923 -------------------------
2924 split_window()
2925 close_pane()
2926 </PRE>
2928 An action representing a menu command is named the same as its corresponding
2929 menu item except that all punctuation is removed, all letters are changed to
2930 lower case, and spaces are replaced with underscores. To present a dialog to
2931 ask the user for input, use the actions with the `_dialog` suffix. Actions
2932 without the `_dialog` suffix take the information from the routine's
2933 arguments (see below).
2935 <H3>Menu Action Routine Arguments</H3>
2937 Arguments are text strings enclosed in quotes. Below are the menu action
2938 routines which take arguments. Optional arguments are enclosed in [].
2940 <PRE>
2941 <B>close</B>( ["prompt" | "save" | "nosave"] )
2942 </PRE>
2944 <PRE>
2945 <B>execute_command</B>( shell-command )
2946 </PRE>
2948 <PRE>
2949 <B>filter_selection</B>( shell-command )
2950 </PRE>
2952 <PRE>
2953 <B>find</B>( search-string [, <I>search-direction</I>] [, <I>search-type</I>]
2954 [, <I>search-wrap</I>] )
2955 </PRE>
2957 <PRE>
2958 <B>find_again</B>( [<I>search-direction</I>] [, <I>search-wrap</I>] )
2959 </PRE>
2961 <PRE>
2962 <B>find_definition</B>( [tag-name] )
2963 </PRE>
2965 <PRE>
2966 <B>find_dialog</B>( [<I>search-direction</I>] [, <I>search-type</I>]
2967 [, <I>keep-dialog</I>] )
2968 </PRE>
2970 <PRE>
2971 <B>find_selection</B>( [<I>search-direction</I>] [, <I>search-wrap</I>]
2972 [, <I>non-regex-search-type</I>] )
2973 </PRE>
2975 <PRE>
2976 <B>goto_line_number</B>( [line-number] )
2977 </PRE>
2979 <PRE>
2980 <B>goto_mark</B>( <I>mark-letter</I> )
2981 </PRE>
2983 <PRE>
2984 <B>include_file</B>( <I>filename</I> )
2985 </PRE>
2987 <PRE>
2988 <B>load_tags_file</B>( <I>filename</I> )
2989 </PRE>
2991 <PRE>
2992 <B>macro_menu_command</B>( <I>macro-menu-item-name</I> )
2993 </PRE>
2995 <PRE>
2996 <B>mark</B>( <I>mark-letter</I> )
2997 </PRE>
2999 <PRE>
3000 <B>open</B>( <I>filename</I> )
3001 </PRE>
3003 <PRE>
3004 <B>replace</B>( search-string, replace-string,
3005 [, <I>search-direction</I>] [, <I>search-type</I>] [, <I>search-wrap</I>] )
3006 </PRE>
3008 <PRE>
3009 <B>replace_again</B>( [<I>search-direction</I>] [, <I>search-wrap</I>] )
3010 </PRE>
3012 <PRE>
3013 <B>replace_dialog</B>( [<I>search-direction</I>] [, <I>search-type</I>]
3014 [, <I>keep-dialog</I>] )
3015 </PRE>
3017 <PRE>
3018 <B>replace_in_selection</B>( search-string,
3019 replace-string [, <I>search-type</I>] )
3020 </PRE>
3022 <PRE>
3023 <B>save_as</B>( <I>filename</I> )
3024 </PRE>
3026 <PRE>
3027 <B>shell_menu_command</B>( <I>shell-menu-item-name</I> )
3028 </PRE>
3030 <PRE>
3031 <B>unload_tags_file</B>( <I>filename</I> )
3032 </PRE>
3034 <PRE>
3035 <B>----------- Some notes on argument types above -----------</B>
3036 </PRE>
3038 <PRE>
3039 <I>filename</I> Path names are relative to the directory from
3040 which NEdit was started. Shell interpreted
3041 wildcards and `~' are not expanded.
3042 </PRE>
3044 <PRE>
3045 <I>keep-dialog</I> Either "keep" or "nokeep".
3046 </PRE>
3048 <PRE>
3049 <I>mark-letter</I> The mark command limits users to single
3050 letters. Inside of macros, numeric marks are
3051 allowed, which won't interfere with marks set
3052 by the user.
3053 </PRE>
3055 <PRE>
3056 <I>macro-menu-item-name</I>
3057 Name of the command exactly as specified in
3058 the Macro Menu dialogs.
3059 </PRE>
3061 <PRE>
3062 <I>non-regex-search-type</I>
3063 Either "literal", "case", "word", or
3064 "caseWord".
3065 </PRE>
3067 <PRE>
3068 <I>search-direction</I>
3069 Either "forward" or "backward".
3070 </PRE>
3072 <PRE>
3073 <I>search-type</I> Either "literal", "case", "word",
3074 "caseWord", "regex", or "regexNoCase".
3075 </PRE>
3077 <PRE>
3078 <I>search-wrap</I> Either "wrap" or "nowrap".
3079 </PRE>
3081 <PRE>
3082 <I>shell-menu-item-name</I>
3083 Name of the command exactly as specified in
3084 the Shell Menu dialogs.
3085 </PRE>
3087 <H3>Window Preferences Actions</H3>
3089 <PRE>
3090 <B>set_auto_indent( "off" | "on" | "smart" )</B>
3091 </PRE>
3092 Set auto indent mode for the current window.
3094 <PRE>
3095 <B>set_em_tab_dist( em-tab-distance )</B>
3096 </PRE>
3097 Set the emulated tab size. An em-tab-distance value of
3098 0 or -1 translates to no emulated tabs. Em-tab-distance must
3099 be smaller than 1000.
3101 <PRE>
3102 <B>set_fonts( font-name, italic-font-name, bold-font-name, bold-italic-font-name )</B>
3103 </PRE>
3104 Set all the fonts used for the current window.
3106 <PRE>
3107 <B>set_highlight_syntax( [0 | 1] )</B>
3108 </PRE>
3109 Set syntax highlighting mode for the current window.
3110 A value of 0 turns it off and a value of 1 turns it on.
3111 If no parameters are supplied the option is toggled.
3113 <PRE>
3114 <B>set_incremental_backup( [0 | 1] )</B>
3115 </PRE>
3116 Set incremental backup mode for the current window.
3117 A value of 0 turns it off and a value of 1 turns it on.
3118 If no parameters are supplied the option is toggled.
3120 <PRE>
3121 <B>set_incremental_search_line( [0 | 1] )</B>
3122 </PRE>
3123 Show or hide the incremental search line for the current window.
3124 A value of 0 turns it off and a value of 1 turns it on.
3125 If no parameters are supplied the option is toggled.
3127 <PRE>
3128 <B>set_language_mode( language-mode )</B>
3129 </PRE>
3130 Set the language mode for the current window. If the language mode is
3131 "" or unrecognized, it will be set to Plain.
3133 <PRE>
3134 <B>set_locked( [0 | 1] )</B>
3135 </PRE>
3136 This only affects the locked status of a file, not it's read-only
3137 status. Permissions are NOT changed.
3138 A value of 0 turns it off and a value of 1 turns it on.
3139 If no parameters are supplied the option is toggled.
3141 <PRE>
3142 <B>set_make_backup_copy( [0 | 1] )</B>
3143 </PRE>
3144 Set whether backup copies are made during saves for the current window.
3145 A value of 0 turns it off and a value of 1 turns it on.
3146 If no parameters are supplied the option is toggled.
3148 <PRE>
3149 <B>set_overtype_mode( [0 | 1] )</B>
3150 </PRE>
3151 Set overtype mode for the current window.
3152 A value of 0 turns it off and a value of 1 turns it on.
3153 If no parameters are supplied the option is toggled.
3155 <PRE>
3156 <B>set_show_line_numbers( [0 | 1] )</B>
3157 </PRE>
3158 Show or hide line numbers for the current window.
3159 A value of 0 turns it off and a value of 1 turns it on.
3160 If no parameters are supplied the option is toggled.
3162 <PRE>
3163 <B>set_show_matching( "off" | "delimiter" | "range" )</B>
3164 </PRE>
3165 Set show matching (...) mode for the current window.
3167 <PRE>
3168 <B>set_match_syntax_based( [0 | 1] )</B>
3169 </PRE>
3170 Set whether matching should be syntax based for the current window.
3172 <PRE>
3173 <B>set_statistics_line( [0 | 1] )</B>
3174 </PRE>
3175 Show or hide the statistics line for the current window.
3176 A value of 0 turns it off and a value of 1 turns it on.
3177 If no parameters are supplied the option is toggled.
3179 <PRE>
3180 <B>set_tab_dist( tab-distance )</B>
3181 </PRE>
3182 Set the size of hardware tab spacing. Tab-distance must
3183 must be a value greater than 0 and no greater than 20.
3185 <PRE>
3186 <B>set_use_tabs( [0 | 1] )</B>
3187 </PRE>
3188 Set whether tabs are used for the current window.
3189 A value of 0 turns it off and a value of 1 turns it on.
3190 If no parameters are supplied the option is toggled.
3192 <PRE>
3193 <B>set_wrap_margin( wrap-width )</B>
3194 </PRE>
3195 Set the wrap width for text wrapping of the current window. A value
3196 of 0 means to wrap at window width.
3198 <PRE>
3199 <B>set_wrap_text( "none" | "auto" | "continuous" )</B>
3200 </PRE>
3201 Set wrap text mode for the current window.
3203 <H3>Keyboard-Only Actions</H3>
3205 In addition to the arguments listed in the call descriptions below, any
3206 routine involving cursor movement can take the argument "extend", meaning,
3207 adjust the primary selection to the new cursor position. Routines which take
3208 the "extend" argument as well as mouse dragging operations for both primary
3209 and secondary selections can take the optional keyword "rect", meaning, make
3210 the selection rectangular. Any routine that accepts the "scrollbar" argument
3211 will move the display but not the cursor or selection. Routines that accept
3212 the "nobell" argument will fail silently without beeping, when that argument
3213 is supplied.
3215 <PRE>
3216 <B>backward_character( ["nobell"] )</B>
3217 </PRE>
3218 Moves the cursor one character to the left.
3220 <PRE>
3221 <B>backward_paragraph(["nobell"] )</B>
3222 </PRE>
3223 Moves the cursor to the beginning of the paragraph, or
3224 if the cursor is already at the beginning of a paragraph, moves the cursor to
3225 the beginning of the previous paragraph. Paragraphs are defined as regions
3226 of text delimited by one or more blank lines.
3228 <PRE>
3229 <B>backward_word( ["nobell"] )</B>
3230 </PRE>
3231 Moves the cursor to the beginning of a word, or, if the
3232 cursor is already at the beginning of a word, moves the cursor to the
3233 beginning of the previous word. Word delimiters are user-settable, and
3234 defined by the X resource wordDelimiters.
3236 <PRE>
3237 <B>beginning_of_file( ["scrollbar"] )</B>
3238 </PRE>
3239 Moves the cursor to the beginning of the file.
3241 <PRE>
3242 <B>beginning_of_line()</B>
3243 </PRE>
3244 Moves the cursor to the beginning of the line.
3246 <PRE>
3247 <B>beginning_of_selection()</B>
3248 </PRE>
3249 Moves the cursor to the beginning of the selection
3250 without disturbing the selection.
3252 <PRE>
3253 <B>copy_clipboard()</B>
3254 </PRE>
3255 Copies the current selection to the clipboard.
3257 <PRE>
3258 <B>copy_primary()</B>
3259 </PRE>
3260 Copies the primary selection to the cursor.
3262 <PRE>
3263 <B>copy_to()</B>
3264 </PRE>
3265 If a secondary selection exists, copies the secondary selection to
3266 the cursor. If no secondary selection exists, copies the primary selection
3267 to the pointer location.
3269 <PRE>
3270 <B>copy_to_or_end_drag()</B>
3271 </PRE>
3272 Completes either a secondary selection operation, or a
3273 primary drag. If the user is dragging the mouse to adjust a secondary
3274 selection, the selection is copied and either inserted at the cursor
3275 location, or, if pending-delete is on and a primary selection exists in the
3276 window, replaces the primary selection. If the user is dragging a block of
3277 text (primary selection), completes the drag operation and leaves the text at
3278 it's current location.
3280 <PRE>
3281 <B>cut_clipboard()</B>
3282 </PRE>
3283 Deletes the text in the primary selection and places it in
3284 the clipboard.
3286 <PRE>
3287 <B>cut_primary()</B>
3288 </PRE>
3289 Copies the primary selection to the cursor and deletes it at
3290 its original location.
3292 <PRE>
3293 <B>delete_selection()</B>
3294 </PRE>
3295 Deletes the contents of the primary selection.
3297 <PRE>
3298 <B>delete_next_character( ["nobell"] )</B>
3299 </PRE>
3300 If a primary selection exists, deletes its contents.
3301 Otherwise, deletes the character following the cursor.
3303 <PRE>
3304 <B>delete_previous_character( ["nobell"] )</B>
3305 </PRE>
3306 If a primary selection exists, deletes its
3307 contents. Otherwise, deletes the character before the cursor.
3309 <PRE>
3310 <B>delete_next_word( ["nobell"] )</B>
3311 </PRE>
3312 If a primary selection exists, deletes its contents.
3313 Otherwise, deletes the word following the cursor.
3315 <PRE>
3316 <B>delete_previous_word( ["nobell"] )</B>
3317 </PRE>
3318 If a primary selection exists, deletes its contents.
3319 Otherwise, deletes the word before the cursor.
3321 <PRE>
3322 <B>delete_to_start_of_line( ["nobell"] )</B>
3323 </PRE>
3324 If a primary selection exists, deletes its
3325 contents. Otherwise, deletes the characters between the cursor and the start
3326 of the line.
3328 <PRE>
3329 <B>delete_to_end_of_line( ["nobell"] )</B>
3330 </PRE>
3331 If a primary selection exists, deletes its contents.
3332 Otherwise, deletes the characters between the cursor and the end of the line.
3334 <PRE>
3335 <B>deselect_all()</B>
3336 </PRE>
3337 De-selects the primary selection.
3339 <PRE>
3340 <B>end_of_file( ["scrollbar"] )</B>
3341 </PRE>
3342 Moves the cursor to the end of the file.
3344 <PRE>
3345 <B>end_of_line()</B>
3346 </PRE>
3347 Moves the cursor to the end of the line.
3349 <PRE>
3350 <B>end_of_selection()</B>
3351 </PRE>
3352 Moves the cursor to the end of the selection without
3353 disturbing the selection.
3355 <PRE>
3356 <B>exchange( ["nobell"] )</B>
3357 </PRE>
3358 Exchange the primary and secondary selections.
3360 <PRE>
3361 <B>extend_adjust()</B>
3362 </PRE>
3363 Attached mouse-movement events to begin a selection between
3364 the cursor and the mouse, or extend the primary selection to the mouse
3365 position.
3367 <PRE>
3368 <B>extend_end()</B>
3369 </PRE>
3370 Completes a primary drag-selection operation.
3372 <PRE>
3373 <B>extend_start()</B>
3374 </PRE>
3375 Begins a selection between the cursor and the mouse. A
3376 drag-selection operation can be started with either extend_start or
3377 grab_focus.
3379 <PRE>
3380 <B>focus_pane( [relative-pane] | [positive-index] | [negative-index] )</B>
3381 </PRE>
3382 Move the focus to the requested pane.
3383 Arguments can be specified in the form of a relative-pane
3384 ("first", "last", "next", "previous"), a positive-index
3385 (numbers greater than 0, 1 is the same as "first") or a
3386 negative-index (numbers less than 0, -1 is the same as "last").
3388 <PRE>
3389 <B>forward_character()</B>
3390 </PRE>
3391 Moves the cursor one character to the right.
3393 <PRE>
3394 <B>forward_paragraph( ["nobell"] )</B>
3395 </PRE>
3396 Moves the cursor to the beginning of the next paragraph.
3397 Paragraphs are defined as regions of text delimited by one or more blank
3398 lines.
3400 <PRE>
3401 <B>forward_word( ["tail"] ["nobell"] )</B>
3402 </PRE>
3403 Moves the cursor to the beginning of the next word. Word
3404 delimiters are user-settable, and defined by the X resource wordDelimiters.
3405 If the "tail" argument is supplied the cursor will be moved to
3406 the end of the current word or the end of the next word, if the
3407 cursor is between words.
3409 <PRE>
3410 <B>grab_focus()</B>
3411 </PRE>
3412 Moves the cursor to the mouse pointer location, and prepares for
3413 a possible drag-selection operation (bound to extend_adjust), or multi-click
3414 operation (a further grab_focus action). If a second invocation of grab
3415 focus follows immediately, it selects a whole word, or a third, a whole line.
3417 <PRE>
3418 <B>insert_string( "string" )</B>
3419 </PRE>
3420 If pending delete is on and the cursor is inside the
3421 selection, replaces the selection with "string". Otherwise, inserts "string"
3422 at the cursor location.
3424 <PRE>
3425 <B>key_select( "direction" [,"nobell"] )</B>
3426 </PRE>
3427 Moves the cursor one character in "direction"
3428 ("left", "right", "up", or "down") and extends the selection. Same as
3429 forward/backward-character("extend"), or process-up/down("extend"), for
3430 compatibility with previous versions.
3432 <PRE>
3433 <B>move-destination()</B>
3434 </PRE>
3435 Moves the cursor to the pointer location without
3436 disturbing the selection. (This is an unusual way of working. We left it in
3437 for compatibility with previous versions, but if you actually use this
3438 capability, please send us some mail, otherwise it is likely to disappear in
3439 the future.
3441 <PRE>
3442 <B>move_to()</B>
3443 </PRE>
3444 If a secondary selection exists, deletes the contents of the
3445 secondary selection and inserts it at the cursor, or if pending-delete is on
3446 and there is a primary selection, replaces the primary selection. If no
3447 secondary selection exists, moves the primary selection to the pointer
3448 location, deleting it from its original position.
3450 <PRE>
3451 <B>move_to_or_end_drag()</B>
3452 </PRE>
3453 Completes either a secondary selection operation, or a
3454 primary drag. If the user is dragging the mouse to adjust a secondary
3455 selection, the selection is deleted and either inserted at the cursor
3456 location, or, if pending-delete is on and a primary selection exists in the
3457 window, replaces the primary selection. If the user is dragging a block of
3458 text (primary selection), completes the drag operation and deletes the text
3459 from it's current location.
3461 <PRE>
3462 <B>newline()</B>
3463 </PRE>
3464 Inserts a newline character. If Auto Indent is on, lines up the
3465 indentation of the cursor with the current line.
3467 <PRE>
3468 <B>newline_and_indent()</B>
3469 </PRE>
3470 Inserts a newline character and lines up the indentation
3471 of the cursor with the current line, regardless of the setting of Auto
3472 Indent.
3474 <PRE>
3475 <B>newline_no_indent()</B>
3476 </PRE>
3477 Inserts a newline character, without automatic
3478 indentation, regardless of the setting of Auto Indent.
3480 <PRE>
3481 <B>next_page( ["stutter"] ["column"] ["scrollbar"] ["nobell"] )</B>
3482 </PRE>
3483 Moves the cursor and scroll forward one page.
3484 The parameter "stutter" moves the cursor to the bottom of the display,
3485 unless it is already there, otherwise it will page down.
3486 The parameter "column" will maintain the preferred column while
3487 moving the cursor.
3489 <PRE>
3490 <B>page_left( ["scrollbar"] ["nobell"] )</B>
3491 </PRE>
3492 Move the cursor and scroll left one page.
3494 <PRE>
3495 <B>page_right( ["scrollbar"] ["nobell"] )</B>
3496 </PRE>
3497 Move the cursor and scroll right one page.
3499 <PRE>
3500 <B>paste_clipboard()</B>
3501 </PRE>
3502 Insert the contents of the clipboard at the cursor, or if
3503 pending delete is on, replace the primary selection with the contents of the
3504 clipboard.
3506 <PRE>
3507 <B>previous_page( ["stutter"] ["column"] ["scrollbar"] ["nobell"] )</B>
3508 </PRE>
3509 Moves the cursor and scroll backward one page.
3510 The parameter "stutter" moves the cursor to the top of the display,
3511 unless it is already there, otherwise it will page up.
3512 The parameter "column" will maintain the preferred column while
3513 moving the cursor.
3515 <PRE>
3516 <B>process_bdrag()</B>
3517 </PRE>
3518 Same as secondary_or_drag_start for compatibility with previous versions.
3520 <PRE>
3521 <B>process_cancel()</B>
3522 </PRE>
3523 Cancels the current extend_adjust, secondary_adjust, or
3524 secondary_or_drag_adjust in progress.
3526 <PRE>
3527 <B>process_down( ["nobell"] )</B>
3528 </PRE>
3529 Moves the cursor down one line.
3531 <PRE>
3532 <B>process_return()</B>
3533 </PRE>
3534 Same as newline for compatibility with previous versions.
3536 <PRE>
3537 <B>process_shift_down( ["nobell"] )</B>
3538 </PRE>
3539 Same as process_down("extend") for compatibility with previous versions.
3541 <PRE>
3542 <B>process_shift_up( ["nobell"] )</B>
3543 </PRE>
3544 Same as process_up("extend") for compatibility with previous versions.
3546 <PRE>
3547 <B>process_tab()</B>
3548 </PRE>
3549 If tab emulation is turned on, inserts an emulated tab,
3550 otherwise inserts a tab character.
3552 <PRE>
3553 <B>process_up( ["nobell"] )</B>
3554 </PRE>
3555 Moves the cursor up one line.
3557 <PRE>
3558 <B>raise_window([relative-window] | [positive-index] | [negative-index])</B>
3559 </PRE>
3560 Raise the current focused window to the front if no argument is supplied.
3561 Arguments can be specified in the form of a relative-window
3562 ("first", "last", "next", "previous"), a positive-index
3563 (numbers greater than 0, 1 is the same as "last") or a
3564 negative-index (numbers less than 0, -1 is the same as "first").
3566 <PRE>
3567 <B>scroll_down(nLines)</B>
3568 </PRE>
3569 Scroll the display down (towards the end of the file) by nLines.
3571 <PRE>
3572 <B>scroll_left( nPixels )</B>
3573 </PRE>
3574 Scroll the display left by nPixels.
3576 <PRE>
3577 <B>scroll_right( nPixels )</B>
3578 </PRE>
3579 Scroll the display right by nPixels.
3581 <PRE>
3582 <B>scroll_up( nLines )</B>
3583 </PRE>
3584 Scroll the display up (towards the beginning of the file) by nLines.
3586 <PRE>
3587 <B>scroll_to_line( lineNum )</B>
3588 </PRE>
3589 Scroll to position line number lineNum at the top of
3590 the pane. The first line of a file is line 1.
3592 <PRE>
3593 <B>secondary_adjust()</B>
3594 </PRE>
3595 Attached mouse-movement events to extend the secondary
3596 selection to the mouse position.
3598 <PRE>
3599 <B>secondary_or_drag_adjust()</B>
3600 </PRE>
3601 Attached mouse-movement events to extend the
3602 secondary selection, or reposition the primary text being dragged. Takes two
3603 optional arguments, "copy", and "overlay". "copy" leaves a copy of the
3604 dragged text at the site at which the drag began. "overlay" does the drag in
3605 overlay mode, meaning the dragged text is laid on top of the existing text,
3606 obscuring and ultimately deleting it when the drag is complete.
3608 <PRE>
3609 <B>secondary_or_drag_start()</B>
3610 </PRE>
3611 To be attached to a mouse down event. Begins drag
3612 selecting a secondary selection, or dragging the contents of the primary
3613 selection, depending on whether the mouse is pressed inside of an existing
3614 primary selection.
3616 <PRE>
3617 <B>secondary_start()</B>
3618 </PRE>
3619 To be attached to a mouse down event. Begin drag selecting
3620 a secondary selection.
3622 <PRE>
3623 <B>select_all()</B>
3624 </PRE>
3625 Select the entire file.
3627 <PRE>
3628 <B>self_insert()</B>
3629 </PRE>
3630 To be attached to a key-press event, inserts the character
3631 equivalent of the key pressed.
3633 <P><HR>
3635 <A NAME="Customizing"</A>
3636 <H1> Customizing </H1>
3638 <A NAME="Customizing_NEdit"</A>
3639 <H2> Customizing NEdit </H2>
3641 NEdit can be customized many different ways. The most important
3642 user-settable options are presented in the Preferences menu, including all
3643 options that users might need to change during an editing session. Options
3644 set in the Default Settings sub-menu of the Preferences menu can be preserved
3645 between sessions by selecting Save Defaults, which writes the changes to the
3646 preferences file. See the section titled "<A HREF="#Preferences">Preferences</A>" for more details.
3648 User defined commands can be added to NEdit's Shell, Macro, and window
3649 background menus. Dialogs for creating items in these menus can be found
3650 under Customize Menus in the Default Settings sub menu of the Preferences
3651 menu.
3653 For users who depend on NEdit every day and want to tune every excruciating
3654 detail, there are also X resources for tuning a vast number of such details,
3655 down to the color of each individual button. See the section "<A HREF="#X_Resources">X Resources</A>"
3656 for more information, as well as a list of selected resources.
3658 The most common reason customizing your X resources for NEdit, however, is
3659 key binding. While limited key binding can be done through Preferences
3660 settings (Preferences -&#62; Default Settings -&#62; Customize Menus), you can really
3661 only add keys this way, and each key must have a corresponding menu item.
3662 Any significant changes to key binding should be made via the Translations
3663 resource and menu accelerator resources. The sections titled "<A HREF="#Key_Binding">Key Binding</A>"
3664 and "<A HREF="#X_Resources">X Resources</A>" have more information.
3665 <P><HR>
3667 <A NAME="Preferences"</A>
3668 <H2> Preferences </H2>
3670 The Preferences menu allows you to set options for both the current editing
3671 window, and default values for newly created windows and future NEdit
3672 sessions. Options in the Preferences menu itself (not in the Default
3673 Settings sub-menu) take effect immediately and refer to the current window
3674 only. Options in the Default Settings sub-menu provide initial settings for
3675 future windows created using the New or Open commands; options affecting all
3676 windows are also set here.
3677 Preferences set in the Default Settings sub-menu can be saved in a file that
3678 is automatically read by NEdit at startup time, by selecting Save Defaults.
3680 <H3>Preferences Menu</H3>
3682 <PRE>
3683 <B>Default Settings</B>
3684 </PRE>
3685 Menu of initial settings for future windows. Generally the same as the
3686 options in the main part of the menu, but apply as defaults for future
3687 windows created during this NEdit session. These settings can be saved using
3688 the Save Defaults command below, to be loaded automatically each time NEdit
3689 is started.
3691 <PRE>
3692 <B>Save Defaults</B>
3693 </PRE>
3694 Save the default options as set under Default Settings for future NEdit
3695 sessions.
3697 <PRE>
3698 <B>Statistics Line</B>
3699 </PRE>
3700 Show the full file name, line number, and length of the file being edited.
3702 <PRE>
3703 <B>Incremental Search Line</B>
3704 </PRE>
3705 Keep the incremental search bar (Search -&#62; Find Incremental) permanently
3706 displayed at the top of the window.
3708 <PRE>
3709 <B>Show Line Numbers</B>
3710 </PRE>
3711 Display line numbers to the right of the text.
3713 <PRE>
3714 <B>Language Mode</B>
3715 </PRE>
3716 Tells NEdit what language (if any) to assume, for selecting language-specific
3717 features such as highlight patterns and smart indent macros, and setting
3718 language specific preferences like word delimiters, tab emulation, and
3719 auto-indent. See Features for Programming -&#62; <A HREF="#Programming_with_NEdit">Programming with NEdit</A> for
3720 more information.
3722 <PRE>
3723 <B>Auto Indent</B>
3724 </PRE>
3725 Setting Auto Indent "on" maintains a running indent (pressing the Return key
3726 will line up the cursor with the indent level of the previous line). If
3727 smart indent macros are available for the current language mode, smart indent
3728 can be selected and NEdit will attempt to guess proper language indentation
3729 for each new line. See Help -&#62; Features for Programming -&#62; Automatic Indent
3730 for more information.
3732 <PRE>
3733 <B>Wrap</B>
3734 </PRE>
3735 Choose between two styles of automatic wrapping or none. Auto Newline wrap,
3736 wraps text at word boundaries when the cursor reaches the right margin, by
3737 replacing the space or tab at the last word boundary with a newline
3738 character. Continuous Wrap wraps long lines which extend past the right
3739 margin. Continuous Wrap mode is typically used to produce files where
3740 newlines are omitted within paragraphs, to make text filling automatic (a
3741 kind of poor-man's word processor). Text of this style is common on Macs and
3742 PCs but is not necessarily supported very well under Unix (except in programs
3743 which deal with e-mail, for which it is often the format of choice).
3745 <PRE>
3746 <B>Wrap Margin</B>
3747 </PRE>
3748 Set margin for Auto Newline Wrap, Continuous Wrap, and Fill Paragraph. Lines
3749 may, be wrapped at the right margin of the window, or the margin can be set
3750 at a specific column.
3752 <PRE>
3753 <B>Tabs</B>
3754 </PRE>
3755 Set the tab distance (number of characters between tab stops) for tab
3756 characters, and control tab emulation and use of tab characters in padding
3757 and emulated tabs.
3759 <PRE>
3760 <B>Text Font...</B>
3761 </PRE>
3762 Change the font(s) used to display text (fonts for menus and dialogs must be
3763 set using X resources for the text area of the window). See below for more
3764 information.
3766 <PRE>
3767 <B>Highlight Syntax</B>
3768 </PRE>
3769 If NEdit recognizes the language being edited, and highlighting patterns are
3770 available for that language, use fonts and colors to enhance viewing of the
3771 file. (See Help -&#62; Features for Programming -&#62; Syntax Highlighting for more
3772 information.
3774 <PRE>
3775 <B>Make Backup Copy</B>
3776 </PRE>
3777 On Save, write a backup copy of the file as it existed before the Save
3778 command with the extension .bck (Unix only).
3780 <PRE>
3781 <B>Incremental Backup</B>
3782 </PRE>
3783 Periodically make a backup copy of the file being edited under the name
3784 `~filename` on Unix or `_filename` on VMS (see <A HREF="#Crash_Recovery">Crash Recovery</A>).
3786 <PRE>
3787 <B>Show Matching (..)</B>
3788 </PRE>
3789 Momentarily highlight matching parenthesis, brackets, and braces, or the
3790 range between them, when one of these characters is typed, or when the
3791 insertion cursor is positioned after it. Delimiter only highlights the
3792 matching delimiter, while Range highlights the whole range of text between
3793 the matching delimiters.
3795 Optionally, the matching can make use of syntax information if syntax
3796 highlighting is enabled. Alternatively, the matching is purely character
3797 based. In general, syntax based matching results in fewer false matches.
3799 <PRE>
3800 <B>Overtype</B>
3801 </PRE>
3802 In overtype mode, new characters entered replace the characters in front of
3803 the insertion cursor, rather than being inserted before them.
3805 <PRE>
3806 <B>Read Only</B>
3807 </PRE>
3808 Lock the file against accidental modification. This temporarily prevents the
3809 file from being modified in this NEdit session. Note that this is different
3810 from setting the file protection.
3812 <H3>Preferences -> Default Settings Menu</H3>
3814 Options in the Preferences -&#62; Default Settings menu have the same meaning as
3815 those in the top-level Preferences menu, except that they apply to future
3816 NEdit windows and future NEdit sessions if saved with the Save Defaults
3817 command. Additional options which appear in this menu are:
3819 <PRE>
3820 <B>Language Modes</B>
3821 </PRE>
3822 Define language recognition information (for determining language mode from
3823 file name or content) and set language specific preferences.
3825 <PRE>
3826 <B>Tag Collisions</B>
3827 </PRE>
3828 How to react to multiple tags for the same name. Tags are described in the
3829 section: Features for Programmers -&#62; Finding Declarations (ctags). In Show
3830 All mode, all matching tags are displayed in a dialog. In Smart mode, if one
3831 of the matching tags is in the current window, that tag is chosen, without
3832 displaying the dialog.
3834 <PRE>
3835 <B>Customize Menus</B>
3836 </PRE>
3837 Add/remove items from the Shell, Macro, and window background menus (see
3838 below).
3840 <PRE>
3841 <B>Customize Window Title</B>
3842 </PRE>
3843 Opens a dialog where the information to be displayed in the windows's title
3844 field can be defined and tested. The dialog contains a Help button, providing
3845 further information about the options available.
3847 <PRE>
3848 <B>Searching</B>
3849 </PRE>
3850 Options for controlling the behavior of Find and Replace commands:
3852 <I>Verbose</I> -
3853 Presents search results in dialog form, asks before wrapping a
3854 search back around the beginning (or end) of the file
3855 (unless Beep On Search Wrap is turned on).
3857 <I>Wrap Around</I> -
3858 Search and Replace operations wrap around the beginning (or end) of the file.
3860 <I>Beep On Search Wrap</I> -
3861 Beep when Search and Replace operations wrap around the beginning (or end) of
3862 the file (only if Wrap Around is turned on).
3864 <I>Keep Dialogs Up</I> -
3865 Don't pop down Replace and Find boxes after searching.
3867 <I>Default Search Style</I> -
3868 Initial setting for search type in Find and Replace dialogs.
3870 <I>Default Replace Scope</I> -
3871 [THIS OPTION IS ONLY PRESENT WHEN NEDIT WAS COMPILED WITH THE
3872 <PRE>
3873 -DREPLACE_SCOPE FLAG TO SELECT AN ALTERNATIVE REPLACE DIALOG LAYOUT.]
3874 </PRE>
3876 Initial setting for the scope in the Replace/Find dialog, when a selection
3877 exists. It can be either "In Window", "In Selection", or "Smart". "Smart"
3878 results in "In Window" if the size of the selection is smaller than 1 line,
3879 and to "In Selection" otherwise.
3881 <PRE>
3882 <B>Syntax Highlighting</B>
3883 </PRE>
3884 Program and configure enhanced text display for new or supported languages
3885 (See Features for Programming -&#62; <A HREF="#Syntax_Highlighting">Syntax Highlighting</A>).
3887 <PRE>
3888 <B>Append Line Feed on Save</B>
3889 </PRE>
3890 Some UNIX tools expect that files end with a line feed. If this option is
3891 activated, NEdit will append one if required.
3893 <PRE>
3894 <B>Sort Open Prev. Menu</B>
3895 </PRE>
3896 Option to order the File -&#62; Open Previous menu alphabetically, versus in
3897 order of last access.
3899 <PRE>
3900 <B>Popups Under Pointer</B>
3901 </PRE>
3902 Display pop-up dialogs centered on the current mouse position, as opposed to
3903 centered on the parent window. This generally speeds interaction, and is
3904 essential for users who users who set their window managers so keyboard focus
3905 follows the mouse.
3907 <PRE>
3908 <B>Modification Warnings</B>
3909 </PRE>
3910 Pop up a warning dialog when files get changed external to NEdit.
3912 <PRE>
3913 <B>Exit Warnings</B>
3914 </PRE>
3915 Ask before exiting when two or more files are open in an NEdit session.
3917 <PRE>
3918 <B>Initial Window Size</B>
3919 </PRE>
3920 Default size for new windows.
3922 <H3>Changing Font(s)</H3>
3924 The font used to display text in NEdit is set under Preferences -&#62; Text Font
3925 (for the current window), or Preferences -&#62; Default Settings Text Font (for
3926 future windows). These dialogs also allow you to set fonts for syntax
3927 highlighting. If you don't intend to use syntax highlighting, you can ignore
3928 most of the dialog, and just set the field labeled Primary Font.
3930 Unless you are absolutely certain about the types of files that you will be
3931 editing with NEdit, you should choose a fixed-spacing font. Many, if not
3932 most, plain-text files are written expecting to be viewed with fixed
3933 character spacing, and will look wrong with proportional spacing. NEdit's
3934 filling, wrapping, and rectangular operations will also work strangely if you
3935 choose a proportional font.
3937 Note that in the font browser (the dialog brought up by the Browse...
3938 button), the subset of fonts which are shown is narrowed depending on the
3939 characteristics already selected. It is therefore important to know that you
3940 can unselect characteristics from the lists by clicking on the selected items
3941 a second time.
3943 Fonts for syntax highlighting should ideally match the primary font in both
3944 height and spacing. A mismatch in spacing will result in similar distortions
3945 as choosing a proportional font: column alignment will sometimes look wrong,
3946 and rectangular operations, wrapping, and filling will behave strangely. A
3947 mismatch in height will cause windows to re-size themselves slightly when
3948 syntax highlighting is turned on or off, and increase the inter- line spacing
3949 of the text. Unfortunately, on some systems it is hard to find sets of fonts
3950 which match exactly in height.
3952 <H3>Customizing Menus</H3>
3954 You can add or change items in the Shell, Macro, and window background menus
3955 under Preferences -&#62; Default Settings -&#62; Customize Menus. When you choose
3956 one of these, you will see a dialog with a list of the current
3957 user-configurable items from the menu on the left. To change an existing
3958 item, select it from the list, and its properties will appear in the
3959 remaining fields of the dialog, where you may change them. Selecting the
3960 item "New" from the list allows you to enter new items in the menu.
3962 Hopefully most of the characteristics are self explanatory, but here are a
3963 few things to note:
3965 Accelerator keys are keyboard shortcuts which appear on the right hand side
3966 of the menus, and allow you avoid pulling down the menu and activate the
3967 command with a single keystroke. Enter accelerators by typing the keys
3968 exactly as you would to activate the command.
3970 Mnemonics are a single letter which should be part of the menu item name,
3971 which allow users to traverse and activate menu items by typing keys when the
3972 menu is pulled down.
3974 In the Shell Command field of the Shell Commands dialog, the % character
3975 expands to the name (including directory path) of the file in the window. To
3976 include a % character in the command, use %%.
3978 The Menu Entry field can contain special characters for constructing
3979 hierarchical sub-menus, and for making items which appear only in certain
3980 language modes. The right angle bracket character "&#62;" creates a sub-menu.
3981 The name of the item itself should be the last element of the path formed
3982 from successive sub-menu names joined with "&#62;". Menu panes are called in to
3983 existence simply by naming them as part of a Menu Entry name. To put several
3984 items in the same sub-menu, repeat the same hierarchical sequence for each.
3985 For example, in the Macro Commands dialog, two items with menu entries: a&#62;b&#62;c
3986 and a&#62;b&#62;d would create a single sub menu under the macro menu called "a",
3987 which would contain a single sub-menu, b, holding the actual items, c and d:
3989 <PRE>
3990 +---++---++---+
3991 |a &#62;||b &#62;||c |
3992 +---++---+|d |
3993 +---+
3994 </PRE>
3996 To qualify a menu entry with a language mode, simply add an at-sign "@" at
3997 the end of the menu command, followed (no space) by a language mode name. To
3998 make a menu item which appears in several language modes, append additional
3999 @s and language mode names. For example, an item with the menu entry:
4001 <PRE>
4002 Make C Prototypes@C@C++
4003 </PRE>
4005 would appear only in C and C++ language modes, and:
4007 <PRE>
4008 Make Class Template@C++
4009 </PRE>
4011 would appear only in C++ mode.
4013 Menu items with no qualification appear in all language modes.
4015 If a menu item is followed by the single language qualification "@*", that
4016 item will appear only if there are no applicable language-specific items of
4017 the same name in the same submenu. For example, if you have the following
4018 three entries in the same menu:
4020 <PRE>
4021 Make Prototypes@C@C++
4022 Make Prototypes@Java
4023 Make Prototypes@*
4024 </PRE>
4026 The first will be available when the language mode is C or C++, the second
4027 when the language mode is Java, and for all other language modes (including
4028 the "Plain" non-language mode). If the entry:
4030 <PRE>
4031 Make Prototypes
4032 </PRE>
4034 also exists, this will always appear, meaning that the menu will always have
4035 two "Make Prototypes" entries, whatever the language mode.
4037 <H3>The NEdit Preferences File</H3>
4039 The NEdit saved preferences file is an X resource file, and its contents can
4040 be moved into another X resource file (see <A HREF="#X_Resources">X Resources</A>). One reason for
4041 doing so would be to attach server specific preferences, such as a default
4042 font to a particular X server. Another reason for moving preferences into the
4043 X resource file would be to keep preferences menu options and resource
4044 settable options together in one place.
4045 Though the files are the same format, additional resources should not be added
4046 to the preference file since NEdit modifies this file by overwriting it
4047 completely. Note also that the contents of the preference file take
4048 precedence over the values of X resources.
4049 Using Save Defaults after moving the contents of your preference file to your
4050 .Xdefaults file will re-create the preference file, interfering with the
4051 options that you have moved.
4052 The location of NEdit's preferences file depends on your environment:
4053 <UL>
4054 <LI> The default place for the file is '$HOME/.nedit/nedit.rc',
4055 <LI> if the variable $NEDIT_HOME is set in your environment it is located at
4056 </UL>
4057 <PRE>
4058 '$NEDIT_HOME/nedit.rc',
4059 </PRE>
4060 <UL>
4061 <LI> you may also use old-style run control files; in this case, the preferences
4062 </UL>
4063 <PRE>
4064 are stored in $HOME/.nedit.
4065 </PRE>
4066 (For VMS, the file is in '$NEDIT_HOME/nedit.rc' if $NEDIT_HOME is set, in
4067 'SYS$LOGIN:.nedit' otherwise.)
4069 <H3>Sharing Customizations with Other NEdit Users</H3>
4071 If you have written macro or shell menu commands, highlight patterns, or
4072 smart-indent macros that you want to share with other NEdit users, you can
4073 make a file which they can load into their NEdit environment.
4075 To load such a file, start NEdit with the command:
4077 <PRE>
4078 nedit -import &#60;file&#62;
4079 </PRE>
4081 In the new NEdit session, verify that the imported patterns or macros do what
4082 you want, then select Preferences -&#62; Save Defaults. Saving incorporates the
4083 changes into the nedit preferences file, so the next time you run NEdit, you
4084 will not have to import the distribution file.
4086 Loading a customization file is automated, but creating one is not. To
4087 produce a file to be imported by other users, you must make a copy of your own
4088 NEdit configuration file, and edit it, by hand, to remove everything but the
4089 few items of interest to the recipient. Leave only the individual
4090 resource(s), and within those resources, only the particular macro, pattern,
4091 style, etc, that you wish to exchange.
4093 For example, to share a highlighting pattern set, you would include the
4094 patterns, any new styles you added, and language mode information only if the
4095 patterns are intended to support a new language rather than updating an
4096 existing one. For example:
4098 <PRE>
4099 nedit.highlightPatterns:\
4100 My Language:1:0{\n\
4101 Comment:"#":"$"::Comment::\n\
4102 Loop Header:"^[ \\t]*loop:":::Loop::\n\
4104 nedit.languageModes: My Language:.my::::::
4105 nedit.styles: Loop:blue:Bold
4106 </PRE>
4108 Resources are in the format of X resource files, but the format of text
4109 within multiple-item resources like highlight patterns, language modes,
4110 macros, styles, etc., are private to NEdit. Each resource is a string which
4111 ends at the first newline character not escaped with \, so you must be
4112 careful about how you treat ends of lines. While you can generally just cut
4113 and paste indented sections, if something which was originally in the middle
4114 of a resource string is now at the end, you must remove the \ line
4115 continuation character(s) so it will not join the next line into the
4116 resource. Conversely, if something which was originally at the end of a
4117 resource is now in the middle, you'll have to add continuation character(s)
4118 to make sure that the resource string is properly continued from beginning to
4119 end, and possibly newline character(s) (\n) to make sure that it is properly
4120 separated from the next item.
4121 <P><HR>
4123 <A NAME="X_Resources"</A>
4124 <H2> X Resources </H2>
4126 NEdit has additional options to those provided in the Preferences menu which
4127 are set using X resources. Like most other X programs, NEdit can be
4128 customized to vastly unnecessary proportions, from initial window positions
4129 down to the font and shadow colors of each individual button (A complete
4130 discussion of how to do this is left to books on the X Windows System). Key
4131 binding (see "<A HREF="#Key_Binding">Key Binding</A>" is one of the most useful of these resource
4132 settable options.
4134 X resources are usually specified in a file called .Xdefaults or .Xresources
4135 in your home directory (on VMS this is sys$login:decw$xdefaults.dat). On
4136 some systems, this file is read and its information attached to the X server
4137 (your screen) when you start X. On other systems, the .Xdefaults file is
4138 read each time you run an X program. When X resource values are attached to
4139 the X server, changes to the resource file are not available to application
4140 programs until you either run the xrdb program with the appropriate file as
4141 input, or re-start the X server.
4143 <H3>Selected X Resource Names</H3>
4145 The following are selected NEdit resource names and default values for NEdit
4146 options not settable via the Preferences menu (for preference resource names,
4147 see your NEdit preference file):
4149 <PRE>
4150 <B>nedit.tagFile</B>: (not defined)
4151 </PRE>
4153 This can be the name of a file, or multiple files separated by a colon (:)
4154 character, of the type produced by Exuberant Ctags or the Unix ctags
4155 command, which NEdit will load at startup time (see <A HREF="#ctags">ctag support</A> ). The tag
4156 file provides a database from which NEdit can automatically open files
4157 containing the definition of a particular subroutine or data type.
4159 <PRE>
4160 <B>nedit.alwaysCheckRelativeTagsSpecs: True</B>
4161 </PRE>
4163 When this resource is set to True, and there are tag files specified (with
4164 the nedit.tagFile resource, see above) as relative paths, NEdit will evaluate
4165 these tag value paths whenever a file is opened. All accessible tag files
4166 will be loaded at this time. When this resource value is False, relative path
4167 tag specifications will only be evaluated at NEdit startup time.
4169 <PRE>
4170 <B>nedit.shell</B>: /bin/csh
4171 </PRE>
4173 (Unix systems only) The Unix shell (command interpreter) to use for executing
4174 commands from the Shell menu
4176 <PRE>
4177 <B>nedit.wordDelimiters</B>: .,/\\`'!@#%^&#38;*()-=+{}[]":;&#60;&#62;?
4178 </PRE>
4180 The characters, in addition to blanks and tabs, which mark the boundaries
4181 between words for the move-by-word (Ctrl+Arrow) and select-word (double
4182 click) commands. Note that this default value may be overridden by the
4183 setting in Preferences -&#62; Default Settings -&#62; Language Modes....
4185 <PRE>
4186 <B>nedit.remapDeleteKey</B>: False
4187 </PRE>
4189 Setting this resource to True forcibly maps the delete key to backspace. This
4190 can be helpful on systems where the bindings have become tangled, and in
4191 environments which mix systems with PC style keyboards and systems with DEC
4192 and Macintosh keyboards. Theoretically, these bindings should be made using
4193 the standard X/Motif mechanisms, outside of NEdit. In practice, some
4194 environments where users access several different systems remotely, can be
4195 very hard to configure. If you've given up and are using a backspace key
4196 halfway off the keyboard because you can't figure out the bindings, set this
4197 to True.
4199 <PRE>
4200 <B>nedit.typingHidesPointer</B>: False
4201 </PRE>
4203 Setting this resource to True causes the mouse pointer to be hidden when you
4204 type in the text area. As soon as the mouse pointer is moved, it will
4205 reappear. This is useful to stop the mouse pointer from obscuring text.
4207 <PRE>
4208 <B>nedit.overrideDefaultVirtualKeyBindings</B>: Auto
4209 </PRE>
4211 Motif uses a virtual key binding mechanism that shares the bindings between
4212 different Motif applications. When a first Motif application is started, it
4213 installs some default virtual key bindings and any other Motif application
4214 that runs afterwards, simply reuses them. Obviously, if the first
4215 application installs an invalid set, all others applications may have
4216 problems.
4218 In the past, NEdit has been the victim of invalid bindings installed by other
4219 applications several times. Through this resource, NEdit can be instructed
4220 to ignore the bindings installed by other applications, and use its own
4221 private bindings. By default, NEdit tries to detect invalid bindings
4222 and ignore them automatically (Auto). Optionally, NEdit can be told to
4223 always keep the installed bindings (Never), or to always override them
4224 (Always).
4226 <PRE>
4227 <B>nedit.stdOpenDialog</B>: False
4228 </PRE>
4230 Setting this resource to True restores the standard Motif style of Open
4231 dialog. NEdit file open dialogs are missing a text field at the bottom of
4232 the dialog, where the file name can be entered as a string. The field is
4233 removed in NEdit to encourage users to type file names in the list, a
4234 non-standard, but much faster method for finding files.
4236 <PRE>
4237 <B>nedit.bgMenuButton</B>: ~Shift~Ctrl~Meta~Alt&#60;Btn3Down&#62;
4238 </PRE>
4240 Specification for mouse button / key combination to post the background menu
4241 (in the form of an X translation table event specification). The event
4242 specification should be as specific as possible, since it will override less
4243 specific translation table entries.
4245 <PRE>
4246 <B>nedit.maxPrevOpenFiles</B>: 30
4247 </PRE>
4249 Number of files listed in the Open Previous sub-menu of the File menu.
4250 Setting this to zero disables the Open Previous menu item and maintenance of
4251 the NEdit file history file.
4253 <PRE>
4254 <B>nedit.printCommand</B>: (system specific)
4255 </PRE>
4257 Command used by the print dialog to print a file, such as, lp, lpr, etc..
4258 The command must be capable of accepting input via stdin (standard input).
4260 <PRE>
4261 <B>nedit.printCopiesOption</B>: (system specific)
4262 </PRE>
4264 Option name used to specify multiple copies to the print command. If the
4265 option should be separated from its argument by a space, leave a trailing
4266 space. If blank, no "Number of Copies" item will appear in the print dialog.
4268 <PRE>
4269 <B>nedit.printQueueOption</B>: (system specific)
4270 </PRE>
4272 Option name used to specify a print queue to the print command. If the
4273 option should be separated from its argument by a space, leave a trailing
4274 space. If blank, no "Queue" item will appear in the print dialog.
4276 <PRE>
4277 <B>nedit.printNameOption</B>: (system specific)
4278 </PRE>
4280 Option name used to specify a job name to the print command. If the option
4281 should be separated from its argument by a space, leave a trailing space. If
4282 blank, no job or file name will be attached to the print job or banner page.
4284 <PRE>
4285 <B>nedit.printHostOption</B>: (system specific)
4286 </PRE>
4288 Option name used to specify a host name to the print command. If the option
4289 should be separated from its argument by a space, leave a trailing space. If
4290 blank, no "Host" item will appear in the print dialog.
4292 <PRE>
4293 <B>nedit.printDefaultQueue</B>: (system specific)
4294 </PRE>
4296 The name of the default print queue. Used only to display in the print
4297 dialog, and has no effect on printing.
4299 <PRE>
4300 <B>nedit.visualID</B>: Best
4301 </PRE>
4303 If your screen supports multiple visuals (color mapping models), this
4304 resource allows you to manually choose among them. The default value of
4305 "Best" chooses the deepest (most colors) visual available. Since NEdit does
4306 not depend on the specific characteristics of any given color model, Best
4307 probably IS the best choice for everyone, and the only reason for setting
4308 this resource would be to patch around some kind of X server problem. The
4309 resource may also be set to "Default", which chooses the screen's default
4310 visual (often a color-mapped, PseudoColor, visual for compatibility with
4311 older X applications). It may also be set to a numeric visual-id value (use
4312 xdpyinfo to see the list of visuals supported by your display), or a visual
4313 class name: PseudoColor, DirectColor, TrueColor, etc..
4315 <PRE>
4316 <B>nedit.installColormap</B>: False
4317 </PRE>
4319 Force the installation of a private colormap. If you have a humble 8-bit
4320 color display, and netscape is hogging all of the color cells, you may want
4321 to try turning this on. On most systems, this will result in colors flashing
4322 wildly when you switch between NEdit and other applications. But a few
4323 systems (SGI) have hardware support for multiple simultaneous colormaps, and
4324 applications with installed colormaps are well behaved.
4326 <PRE>
4327 <B>nedit.findReplaceUsesSelection</B>: False
4328 </PRE>
4330 Controls if the Find and Replace dialogs are automatically loaded with the
4331 contents of the primary selection.
4333 <PRE>
4334 <B>nedit.stickyCaseSenseButton</B>: True
4335 </PRE>
4337 Controls if the "Case Sensitive" buttons in the Find and Replace dialogs and
4338 the incremental search bar maintain a separate state for literal and regular
4339 expression searches. Moreover, when set to True, by default literal searches
4340 are case insensitive and regular expression searches are case sensitive. When
4341 set to False, the "Case Sensitive" buttons are independent of the "Regular
4342 Expression" toggle.
4344 <PRE>
4345 <B>nedit.printDefaultHost</B>: (system specific)
4346 </PRE>
4348 The node name of the default print host. Used only to display in the print
4349 dialog, and has no effect on printing.
4351 <PRE>
4352 <B>nedit.multiClickTime</B>: (system specific)
4353 </PRE>
4355 Maximum time in milliseconds allowed between mouse clicks within double and
4356 triple click actions.
4358 <PRE>
4359 <B>nedit*scrollBarPlacement</B>: BOTTOM_LEFT
4360 </PRE>
4362 How scroll bars are placed in NEdit windows, as well as various lists and
4363 text fields in the program. Other choices are: BOTTOM_RIGHT, TOP_LEFT, or
4364 TOP_RIGHT.
4366 <PRE>
4367 <B>nedit*text.autoWrapPastedText</B>: False
4368 </PRE>
4370 When Auto Newline Wrap is turned on, apply automatic wrapping (which
4371 normally only applies to typed text) to pasted text as well.
4373 <PRE>
4374 <B>nedit*text.heavyCursor</B>: False
4375 </PRE>
4377 For monitors with poor resolution or users who have difficulty seeing the
4378 cursor, makes the cursor in the text editing area of the window heavier and
4379 darker.
4381 <PRE>
4382 <B>nedit*text.foreground</B>: black
4383 </PRE>
4385 Foreground color of the text editing area of the NEdit window.
4387 <PRE>
4388 <B>nedit*text.background</B>: white
4389 </PRE>
4391 Background color of the text editing area of the NEdit window.
4393 <PRE>
4394 <B>nedit*text.selectForeground</B>: black
4395 </PRE>
4397 Foreground (text) color for selections in the text editing area of the NEdit
4398 window.
4400 <PRE>
4401 <B>nedit*text.selectBackground</B>: gray80
4402 </PRE>
4404 Color for selections in the text editing area of the NEdit window.
4406 <PRE>
4407 <B>nedit*text.highlightForeground</B>: white
4408 </PRE>
4410 Foreground (text) color for highlights (parenthesis flashing) in the text
4411 editing area of the NEdit window.
4413 <PRE>
4414 <B>nedit*text.highlightBackground</B>: red
4415 </PRE>
4417 Color for highlights (parenthesis flashing) in the text editing area of the
4418 NEdit window.
4420 <PRE>
4421 <B>nedit*text.cursorForeground</B>: black
4422 </PRE>
4424 Color for text cursor in the text editing area of the NEdit window.
4426 <PRE>
4427 <B>nedit*text.lineNumForeground</B>: gray47
4428 </PRE>
4430 Color for displaying line numbers in the NEdit window.
4432 <PRE>
4433 <B>nedit*text.blinkRate</B>: 500
4434 </PRE>
4436 Blink rate of the text insertion cursor in milliseconds. Set to zero to stop
4437 blinking.
4439 <PRE>
4440 <B>nedit*text.Translations</B>:
4441 </PRE>
4443 Modifies key bindings (see below).
4445 <PRE>
4446 <B>nedit*foreground</B>: black
4447 </PRE>
4449 Default foreground color for menus, dialogs, scroll bars, etc..
4451 <PRE>
4452 <B>nedit*background</B>: #b3b3b3
4453 </PRE>
4455 Default background color for menus, dialogs, scroll bars, etc..
4457 <PRE>
4458 <B>nedit*fontList</B>: helvetica medium 12 points
4459 </PRE>
4461 Default font for menus, dialogs, scroll bars, etc..
4463 <PRE>
4464 <B>nedit.helpFont</B>: helvetica medium 12 points
4465 </PRE>
4467 Font used for displaying online help.
4469 <PRE>
4470 <B>nedit.boldHelpFont</B>: helvetica bold 12 points
4471 </PRE>
4473 Bold font for online help.
4475 <PRE>
4476 <B>nedit.italicHelpFont</B>: helvetica italic 12 points
4477 </PRE>
4479 Italic font for online help.
4481 <PRE>
4482 <B>nedit.fixedHelpFont</B>: courier medium 12 points
4483 </PRE>
4485 Fixed font for online help.
4487 <PRE>
4488 <B>nedit.boldFixedHelpFont</B>: courier bold 12 points
4489 </PRE>
4491 Fixed bold for online help.
4493 <PRE>
4494 <B>nedit.italicFixedHelpFont</B>: courier italic 12 points
4495 </PRE>
4497 Fixed italic font for online help.
4499 <PRE>
4500 <B>nedit.h1HelpFont</B>: helvetica bold 14 points
4501 </PRE>
4503 Font for level-1 titles in help text.
4505 <PRE>
4506 <B>nedit.h2HelpFont</B>: helvetica bold italic 12 points
4507 </PRE>
4509 Font for level-2 titles in help text.
4511 <PRE>
4512 <B>nedit.h3HelpFont</B>: courier bold 12 points
4513 </PRE>
4515 Font for level-3 titles in help text.
4517 <PRE>
4518 <B>nedit.helpLinkFont</B>: helvetica medium 12 points
4519 </PRE>
4521 Font for hyperlinks in the help text
4523 <PRE>
4524 <B>nedit.helpLinkColor</B>: #009900
4525 </PRE>
4527 Color for hyperlinks in the help text
4529 <PRE>
4530 <B>nc.autoStart</B>: True
4531 </PRE>
4533 Whether the nc program should automatically start an NEdit server (without
4534 prompting the user) if an appropriate server is not found.
4536 <PRE>
4537 <B>nc.serverCommand</B>: nedit -server
4538 </PRE>
4540 Command used by the nc program to start an NEdit server.
4542 <P><HR>
4543 <I>The following are Selected widget names (to which you may append</I>
4544 <I>.background, .foreground, .fontList, etc., to change colors, fonts</I>
4545 <I> and other characteristics):</I>
4547 <PRE>
4548 <B>nedit*statsAreaForm</B>
4549 </PRE>
4551 Statistics line and incremental search bar. To get consistent results across
4552 the entire stats line and the incremental search bar, use '*' rather than '.'
4553 to separate the resource name. For example, to set the foreground color of
4554 both components use:
4555 <PRE>
4556 nedit*statsAreaForm*foreground
4557 </PRE>
4558 instead of:
4559 <PRE>
4560 nedit*statsAreaForm.foreground
4561 </PRE>
4563 <PRE>
4564 <B>nedit*menuBar</B>
4565 </PRE>
4567 Top-of-window menu-bar.
4569 <PRE>
4570 <B>nedit*textHorScrollBar</B>
4571 </PRE>
4573 Horizontal scroll bar.
4575 <PRE>
4576 <B>nedit*textVertScrollBar</B>
4577 </PRE>
4579 Vertical scroll bar.
4581 <PRE>
4582 <B>nedit*calltip</B>
4583 </PRE>
4585 Calltip pop-ups.
4586 <P><HR>
4588 <A NAME="Key_Binding"</A>
4589 <H2> Key Binding </H2>
4591 There are several ways to change key bindings in NEdit. The easiest way to
4592 add a new key binding in NEdit is to define a macro in Preferences -&#62; Default
4593 Settings -&#62; Customize Menus -&#62; Macro Menu. However, if you want to change
4594 existing bindings or add a significant number of new key bindings you will
4595 need to do so via X resources.
4597 Before reading this section, you must understand how to set X resources (see
4598 the help section "<A HREF="#X_Resources">X Resources</A>"). Since setting X resources is tricky, it is
4599 also helpful when working on key-binding, to set some easier-to-verify
4600 resource at the same time, as a simple check that the NEdit program is
4601 actually seeing your changes. The appres program is also very helpful in
4602 checking that the resource settings that you make, actually reach the program
4603 for which they are intended in the correct form.
4605 <H3>Key Binding in General</H3>
4607 Keyboard commands are associated with editor action routines through two
4608 separate mechanisms in NEdit. Commands which appear in pull-down menus have
4609 individual resources designating a keyboard equivalent to the menu command,
4610 called an accelerator key. Commands which do not have an associated menu
4611 item are bound to keys via the X toolkit translation mechanism. The methods
4612 for changing these two kinds of bindings are quite different.
4614 <H3>Key Binding Via Translations</H3>
4616 The most general way to bind actions to keys in NEdit is to use the
4617 translation table associated with the text widget. To add a binding to Alt+Y
4618 to insert the string "Hi!", for example, add lines similar to the following
4619 to your X resource file:
4621 <PRE>
4622 NEdit*text.Translations: #override \n\
4623 Alt&#60;Key&#62;y: insert_string("Hi!") \n
4624 </PRE>
4626 The Help topic "<A HREF="#Action_Routines">Action Routines</A>" lists the actions available to be bound.
4628 Translation tables map key and mouse presses, window operations, and other
4629 kinds of events, to actions. The syntax for translation tables is
4630 simplified here, so you may need to refer to a book on the X window system
4631 for more detailed information.
4633 Note that accelerator resources (discussed below) override translations, and
4634 that most Ctrl+letter and Alt+letter combinations are already bound to an
4635 accelerator key. To use one of these combinations from a translation table,
4636 therefore, you must first un-bind the original menu accelerator.
4638 A resource for changing a translation table consists of a keyword; #override,
4639 #augment, or #replace; followed by lines (separated by newline characters)
4640 pairing events with actions. Events begin with modifiers, like Ctrl, Shift,
4641 or Alt, followed by the event type in &#60;&#62;. BtnDown, Btn1Down, Btn2Down,
4642 Btn1Up, Key, KeyUp are valid event types. For key presses, the event type is
4643 followed by the name of the key. You can specify a combination of events,
4644 such as a sequence of key presses, by separating them with commas. The other
4645 half of the event/action pair is a set of actions. These are separated from
4646 the event specification by a colon and from each other by spaces. Actions
4647 are names followed by parentheses, optionally containing one or more
4648 parameters separated by comas.
4650 <H3>Changing Menu Accelerator Keys</H3>
4652 The menu shortcut keys shown at the right of NEdit menu items can also be
4653 changed via X resources. Each menu item has two resources associated with
4654 it, accelerator, the event to trigger the menu item; and acceleratorText, the
4655 string shown in the menu. The form of the accelerator resource is the same
4656 as events for translation table entries discussed above, though multiple keys
4657 and other subtleties are not allowed. The resource name for a menu is the
4658 title in lower case, followed by "Menu", the resource name of menu item is
4659 the name in lower case, run together, with words separated by caps, and all
4660 punctuation removed. For example, to change Cut to Ctrl+X, you would add the
4661 following to your .Xdefaults file:
4663 <PRE>
4664 nedit*editMenu.cut.accelerator: Ctrl&#60;Key&#62;x
4665 nedit*editMenu.cut.acceleratorText: Ctrl+X
4666 </PRE>
4668 Accelerator keys with optional shift key modifiers, like Find..., have an
4669 additional accelerator resource with Shift appended to the name. For
4670 example:
4672 <PRE>
4673 nedit*searchMenu.find.acceleratorText: [Shift]Alt+F
4674 nedit*searchMenu.find.accelerator: Alt&#60;Key&#62;f
4675 nedit*searchMenu.findShift.accelerator: Shift Alt&#60;Key&#62;f
4676 <P><HR>
4677 </PRE>
4679 <A NAME="Highlighting_Patterns"</A>
4680 <H2> Highlighting Patterns </H2>
4682 <H3>Writing Syntax Highlighting Patterns</H3>
4684 Patterns are the mechanism by which language syntax highlighting is
4685 implemented in NEdit (see <A HREF="#Syntax_Highlighting">Syntax Highlighting</A> under the heading of Features
4686 for Programming). To create syntax highlighting patterns for a new
4687 language, or to modify existing patterns, select "Recognition Patterns" from
4688 "Syntax Highlighting" sub-section of the "Default Settings" sub-menu of the
4689 "Preferences" menu.
4691 First, a word of caution. As with regular expression matching in general, it
4692 is quite possible to write patterns which are so inefficient that they
4693 essentially lock up the editor as they recursively re-examine the entire
4694 contents of the file thousands of times. With the multiplicity of patterns,
4695 the possibility of a lock-up is significantly increased in syntax
4696 highlighting. When working on highlighting patterns, be sure to save your
4697 work frequently.
4699 NEdit's syntax highlighting is unusual in that it works in real-time (as you
4700 type), and yet is completely programmable using standard regular expression
4701 notation. Other syntax highlighting editors usually fall either into the
4702 category of fully programmable but unable to keep up in real-time, or
4703 real-time but limited programmability. The additional burden that NEdit
4704 places on pattern writers in order to achieve this speed/flexibility mix, is
4705 to force them to state self-imposed limitations on the amount of context that
4706 patterns may examine when re-parsing after a change. While the "Pattern
4707 Context Requirements" heading is near the end of this section, it is not
4708 optional, and must be understood before making any any serious effort at
4709 pattern writing.
4711 In its simplest form, a highlight pattern consists of a regular expression to
4712 match, along with a style representing the font an color for displaying any
4713 text which matches that expression. To bold the word, "highlight", wherever
4714 it appears the text, the regular expression simply would be the word
4715 "highlight". The style (selected from the menu under the heading of
4716 "Highlight Style") determines how the text will be drawn. To bold the text,
4717 either select an existing style, such as "Keyword", which bolds text, or
4718 create a new style and select it under Highlight Style.
4720 The full range of regular expression capabilities can be applied in such a
4721 pattern, with the single caveat that the expression must conclusively match
4722 or not match, within the pre-defined context distance (as discussed below
4723 under Pattern Context Requirements).
4725 To match longer ranges of text, particularly any constructs which exceed the
4726 requested context, you must use a pattern which highlights text between a
4727 starting and ending regular expression match. To do so, select "Highlight
4728 text between starting and ending REs" under "Matching", and enter both a
4729 starting and ending regular expression. For example, to highlight everything
4730 between double quotes, you would enter a double quote character in both the
4731 starting and ending regular expression fields. Patterns with both a
4732 beginning and ending expression span all characters between the two
4733 expressions, including newlines.
4735 Again, the limitation for automatic parsing to operate properly is that both
4736 expressions must match within the context distance stated for the pattern
4737 set.
4739 With the ability to span large distances, comes the responsibility to recover
4740 when things go wrong. Remember that syntax highlighting is called upon to
4741 parse incorrect or incomplete syntax as often as correct syntax. To stop a
4742 pattern short of matching its end expression, you can specify an error
4743 expression, which stops the pattern from gobbling up more than it should.
4744 For example, if the text between double quotes shouldn't contain newlines,
4745 the error expression might be "$". As with both starting and ending
4746 expressions, error expressions must also match within the requested context
4747 distance.
4749 <H4>Coloring Sub-Expressions</H4>
4751 It is also possible to color areas of text within a regular expression
4752 match. A pattern of this type associates a style with sub-expressions
4753 references of the parent pattern (as used in regular expression substitution
4754 patterns, see the NEdit Help menu item on <A HREF="#Regular_Expressions">Regular Expressions</A>).
4755 Sub-expressions of both the starting and ending patterns may be colored. For
4756 example, if the parent pattern has a starting expression "\&#60;", and end
4757 expression "\&#62;", (for highlighting all of the text contained within angle
4758 brackets), a sub-pattern using "&#38;" in both the starting and ending expression
4759 fields could color the brackets differently from the intervening text. A
4760 quick shortcut to typing in pattern names in the Parent Pattern field is to
4761 use the middle mouse button to drag them from the Patterns list.
4763 <H4>Hierarchical Patterns</H4>
4765 A hierarchical sub-pattern, is identical to a top level pattern, but is
4766 invoked only between the beginning and ending expression matches of its
4767 parent pattern. Like the sub-expression coloring patterns discussed above,
4768 it is associated with a parent pattern using the Parent Pattern field in the
4769 pattern specification. Pattern names can be dragged from the pattern list
4770 with the middle mouse button to the Parent Pattern field.
4772 After the start expression of the parent pattern matches, the syntax
4773 highlighting parser searches for either the parent's end pattern or a
4774 matching sub-pattern. When a sub-pattern matches, control is not returned to
4775 the parent pattern until the entire sub-pattern has been parsed, regardless
4776 of whether the parent's end pattern appears in the text matched by the
4777 sub-pattern.
4779 The most common use for this capability is for coloring sub-structure of
4780 language constructs (smaller patterns embedded in larger patterns).
4781 Hierarchical patterns can also simplify parsing by having sub-patterns "hide"
4782 special syntax from parent patterns, such as special escape sequences or
4783 internal comments.
4785 There is no depth limit in nesting hierarchical sub-patterns, but beyond the
4786 third level of nesting, automatic re-parsing will sometimes have to re-parse
4787 more than the requested context distance to guarantee a correct parse (which
4788 can slow down the maximum rate at which the user can type if large sections
4789 of text are matched only by deeply nested patterns).
4791 While this is obviously not a complete hierarchical language parser it is
4792 still useful in many text coloring situations. As a pattern writer, your
4793 goal is not to completely cover the language syntax, but to generate
4794 colorings that are useful to the programmer. Simpler patterns are usually
4795 more efficient and also more robust when applied to incorrect code.
4797 <H4>Deferred (Pass-2) Parsing</H4>
4799 NEdit does pattern matching for syntax highlighting in two passes. The first
4800 pass is applied to the entire file when syntax highlighting is first turned
4801 on, and to new ranges of text when they are initially read or pasted in. The
4802 second pass is applied only as needed when text is exposed (scrolled in to
4803 view).
4805 If you have a particularly complex set of patterns, and parsing is beginning
4806 to add a noticeable delay to opening files or operations which change large
4807 regions of text, you can defer some of that parsing from startup time, to
4808 when it is actually needed for viewing the text. Deferred parsing can only
4809 be used with single expression patterns, or begin/end patterns which match
4810 entirely within the requested context distance. To defer the parsing of a
4811 pattern to when the text is exposed, click on the Pass-2 pattern type button
4812 in the highlight patterns dialog.
4814 Sometimes a pattern can't be deferred, not because of context requirements,
4815 but because it must run concurrently with pass-1 (non-deferred) patterns. If
4816 they didn't run concurrently, a pass-1 pattern might incorrectly match some
4817 of the characters which would normally be hidden inside of a sequence matched
4818 by the deferred pattern. For example, C has character constants enclosed in
4819 single quotes. These typically do not cross line boundaries, meaning they
4820 can be parsed entirely within the context distance of the C pattern set and
4821 should be good candidates for deferred parsing. However, they can't be
4822 deferred because they can contain sequences of characters which can trigger
4823 pass-one patterns. Specifically, the sequence, '\"', contains a double quote
4824 character, which would be matched by the string pattern and interpreted as
4825 introducing a string.
4827 <H4>Pattern Context Requirements</H4>
4829 The context requirements of a pattern set state how much additional text
4830 around any change must be examined to guarantee that the patterns will match
4831 what they are intended to match. Context requirements are a promise by NEdit
4832 to the pattern writer, that the regular expressions in his/her patterns will
4833 be matched against at least &#60;line context&#62; lines and &#60;character context&#62;
4834 characters, around any modified text. Combining line and character
4835 requirements guarantee that both will be met.
4837 Automatic re-parsing happens on EVERY KEYSTROKE, so the amount of context
4838 which must be examined is very critical to typing efficiency. The more
4839 complicated your patterns, the more critical the context becomes. To cover
4840 all of the keywords in a typical language, without affecting the maximum rate
4841 at which users can enter text, you may be limited to just a few lines and/or
4842 a few hundred characters of context.
4844 The default context distance is 1 line, with no minimum character
4845 requirement. There are several benefits to sticking with this default. One
4846 is simply that it is easy to understand and to comply with. Regular
4847 expression notation is designed around single line matching. To span lines
4848 in a regular expression, you must explicitly mention the newline character
4849 "\n", and matches which are restricted to a single line are virtually immune
4850 to lock-ups. Also, if you can code your patterns to work within a single
4851 line of context, without an additional character-range context requirement,
4852 the parser can take advantage the fact that patterns don't cross line
4853 boundaries, and nearly double its efficiency over a one-line and 1-character
4854 context requirement. (In a single line context, you are allowed to match
4855 newlines, but only as the first and/or last character.)
4856 <P><HR>
4858 <A NAME="Smart_Indent_Macros"</A>
4859 <H2> Smart Indent Macros </H2>
4861 Smart indent macros can be written for any language, but are usually more
4862 difficult to write than highlighting patterns. A good place to start, of
4863 course, is to look at the existing macros for C and C++.
4865 Smart indent macros for a language mode consist of standard NEdit macro
4866 language code attached to any or all of the following three activation
4867 conditions: 1) When smart indent is first turned on for a text window
4868 containing code of the language, 2) When a newline is typed and smart indent
4869 is expected, 3) after any character is typed. To attach macro code to any of
4870 these code "hooks", enter it in the appropriate section in the Preferences -&#62;
4871 Default Settings -&#62; Auto Indent -&#62; Program Smart Indent dialog.
4873 Typically most of the code should go in the initialization section, because
4874 that is the appropriate place for subroutine definitions, and smart indent
4875 macros are complicated enough that you are not likely to want to write them
4876 as one monolithic run of code. You may also put code in the Common/Shared
4877 Initialization section (accessible through the button in the upper left
4878 corner of the dialog). Unfortunately, since the C/C++ macros also reside in
4879 the common/shared section, when you add code there, you run some risk of
4880 missing out on future upgrades to these macros, because your changes will
4881 override the built-in defaults.
4883 The newline macro is invoked after the user types a newline, but before the
4884 newline is entered in the buffer. It takes a single argument ($1) which is
4885 the position at which the newline will be inserted. It must return the
4886 number of characters of indentation the line should have, or -1. A return
4887 value of -1 means to do a standard auto-indent. You must supply a newline
4888 macro, but the code: "return -1" (auto-indent), or "return 0" (no indent) is
4889 sufficient.
4891 The type-in macro takes two arguments. $1 is the insert position, and $2 is
4892 the character just inserted, and does not return a value. You can do just
4893 about anything here, but keep in mind that this macro is executed for every
4894 keystroke typed, so if you try to get too fancy, you may degrade performance.
4895 <P><HR>
4897 <A NAME="NEdit_Command_Line"</A>
4898 <H2> NEdit Command Line </H2>
4900 <PRE>
4901 <B>nedit</B> [-<B>read</B>] [-<B>create</B>] [-<B>line</B> n | +n] [-<B>server</B>]
4902 [-<B>do</B> command] [-<B>tags</B> file] [-<B>tabs</B> n] [-<B>wrap</B>]
4903 [-<B>nowrap</B>] [-<B>autowrap</B>] [-<B>autoindent</B>] [-<B>noautoindent</B>]
4904 [-<B>autosave</B>] [-<B>noautosave</B>] [-<B>rows</B> n] [-<B>columns</B> n]
4905 [-<B>font</B> font] [-<B>lm</B> languagemode] [-<B>geometry</B> geometry]
4906 [-<B>iconic</B>] [-<B>noiconic</B>] [-<B>display</B> [host]:server[.screen]
4907 [-<B>xrm</B> resourcestring] [-<B>svrname</B> name] [-<B>import</B> file]
4908 [-<B>background</B> color] [-<B>foreground</B> color] [-<B>V</B>|-<B>version</B>]
4909 [--] [file...]
4910 </PRE>
4912 <PRE>
4913 <B>-read</B>
4914 </PRE>
4915 Open the file Read Only regardless of the actual file protection.
4917 <PRE>
4918 <B>-create</B>
4919 </PRE>
4920 Don't warn about file creation when a file doesn't exist.
4922 <PRE>
4923 <B>-line n (or +n)</B>
4924 </PRE>
4925 Go to line number n
4927 <PRE>
4928 <B>-server</B>
4929 </PRE>
4930 Designate this session as an NEdit server, for processing commands from the
4931 nc program. nc can be used to interface NEdit to code development
4932 environments, mailers, etc., or just as a quick way to open files from the
4933 shell command line without starting a new NEdit session.
4935 <PRE>
4936 <B>-do command</B>
4937 </PRE>
4938 Execute an NEdit macro or action. On each file following the -do argument on
4939 the command line. -do is particularly useful from the nc program, where nc
4940 -do can remotely execute commands in an NEdit -server session.
4942 <PRE>
4943 <B>-tags file</B>
4944 </PRE>
4945 Load a file of directions for finding definitions of program subroutines and
4946 data objects. The file must be of the format gen- erated by Exuberant Ctags,
4947 or the standard Unix ctags command.
4949 <PRE>
4950 <B>-tabs n</B>
4951 </PRE>
4952 Set tab stops every n characters.
4954 <PRE>
4955 <B>-wrap, -nowrap</B>
4956 </PRE>
4957 Wrap long lines at the right edge of the window rather than continuing them
4958 past it. (Continuous Wrap mode)
4960 <PRE>
4961 <B>-autowrap, -noautowrap</B>
4962 </PRE>
4963 Wrap long lines when the cursor reaches the right edge of the window by
4964 inserting newlines at word boundaries. (Auto Newline Wrap mode)
4966 <PRE>
4967 <B>-autoindent, -noautoindent</B>
4968 </PRE>
4969 Maintain a running indent.
4971 <PRE>
4972 <B>-autosave, -noautosave</B>
4973 </PRE>
4974 Maintain a backup copy of the file being edited under the name '~filename'.
4976 <PRE>
4977 <B>-rows n</B>
4978 </PRE>
4979 Default height in characters for an editing window.
4981 <PRE>
4982 <B>-columns n</B>
4983 </PRE>
4984 Default width in characters for an editing window.
4986 <PRE>
4987 <B>-font font (or -fn font)</B>
4988 </PRE>
4989 Font for text being edited (Font for menus and dialogs can be set with -xrm
4990 "*fontList:font").
4992 <PRE>
4993 <B>-lm languagemode</B>
4994 </PRE>
4995 Initial language mode used for editing succeeding files.
4997 <PRE>
4998 <B>-geometry geometry (or -g geometry)</B>
4999 </PRE>
5000 The initial size and/or location of editor windows. The argument geometry
5001 has the form:
5003 <PRE>
5004 [&#60;width&#62;x&#60;height&#62;][+|-][&#60;xoffset&#62;[+|-]&#60;yoffset&#62;]
5005 </PRE>
5007 where &#60;width&#62; and &#60;height&#62; are the desired width and height of the window,
5008 and &#60;xoffset&#62; and &#60;yoffset&#62; are the distance from the edge of the screen to
5009 the window, + for top or left, - for bottom or right. -geometry can be
5010 specified for individual files on the command line.
5012 <PRE>
5013 <B>-iconic, -noiconic</B>
5014 </PRE>
5015 Initial window state for succeeding files.
5017 <PRE>
5018 <B>-display [host]:server[.screen]</B>
5019 </PRE>
5020 The name of the X server to use. host specifies the machine, server
5021 specifies the display server number, and screen specifies the screen number.
5022 host or screen can be omitted and default to the local machine, and screen 0.
5024 <PRE>
5025 <B>-background color (or -bg color)</B>
5026 </PRE>
5027 Background color. (background color for text can be set separately with
5028 -xrm "nedit*text.background: color").
5030 <PRE>
5031 <B>-foreground color (or -fg color)</B>
5032 </PRE>
5033 Foreground color. (foreground color for text can be set separately with -xrm
5034 "nedit*text.foreground: color").
5036 <PRE>
5037 <B>-xrm resourcestring</B>
5038 </PRE>
5039 Set the value of an X resource to override a default
5040 value (see "<A HREF="#Customizing_NEdit">Customizing NEdit</A>").
5042 <PRE>
5043 <B>-svrname name</B>
5044 </PRE>
5045 When starting NEdit in server mode, name the server, such that it responds to
5046 requests only when nc is given a corresponding -svrname argument. By naming
5047 servers, you can run several simultaneously, and direct files and commands
5048 specifically to any one.
5050 <PRE>
5051 <B>-import file</B>
5052 </PRE>
5053 Loads an additional preferences file on top of the existing defaults saved in
5054 your preferences file. To incorporate macros, language modes, and highlight
5055 patterns and styles written by other users, run NEdit with -import &#60;file&#62;,
5056 then re-save your preference file with Preferences -&#62; Save Defaults.
5058 <PRE>
5059 <B>-version</B>
5060 </PRE>
5061 Prints out the NEdit version information. The -V option is synonymous.
5063 <PRE>
5064 <B>--</B>
5065 </PRE>
5066 Treats all subsequent arguments as file names, even if they start with a
5067 dash. This is so NEdit can access files that begin with the dash character.
5069 <P><HR>
5071 <A NAME="Client/Server_Mode"</A>
5072 <H2> Client/Server Mode </H2>
5074 NEdit can be operated on its own, or as a two-part client/server
5075 application. Client/server mode is useful for integrating NEdit with
5076 software development environments, mailers, and other programs; or just as a
5077 quick way to open files from the shell command line without starting a new
5078 NEdit session.
5080 To run NEdit in server mode, type:
5082 <PRE>
5083 nedit -server
5084 </PRE>
5086 NEdit can also be started in server mode via the Nedit Client (nc) program
5087 when no servers are available.
5089 The nc program, which is distributed along with NEdit,
5090 sends commands to an nedit server to open files, select lines, or execute
5091 editor actions. It accepts a limited set of the nedit command line options:
5092 -read, -create, -line (or +n), -do, and a list of file names. Listing a file
5093 on the nc command line means, open it if it is not already open and bring the
5094 window to the front. -read and -create affect only newly opened files, but
5095 -line and -do can also be used on files which are already open
5096 (See "<A HREF="#NEdit_Command_Line">NEdit Command Line</A>" for more information).
5098 In typical Unix style, arguments affect the files which follow them on the
5099 command line, for example:
5101 <PRE>
5102 incorrect: nc file.c -line 25
5103 correct: nc -line 25 file.c
5104 </PRE>
5106 -read, -create, and -line affect all of the files which follow them on the
5107 command line. The -do macro is executed only once, on the next file on the
5108 line. -do without a file following it on the command line, executes the
5109 macro on the first available window (presumably when you give a -do command
5110 without a corresponding file or window, you intend it to do something
5111 independent of the window in which it happens to execute).
5113 nc also accepts one command line option of its own, -noask (or -ask), which
5114 instructs it whether to automatically start a server if one is not
5115 available. This is also settable via the X resource, nc.autoStart
5116 (See "<A HREF="#X_Resources">X Resources</A>" section).
5118 Sometimes it is useful to have more than one NEdit server running, for
5119 example to keep mail and programming work separate. The option, -svrname, to
5120 both nedit and nc, allows you to start, and communicate with, separate named
5121 servers. A named server responds only to requests with the corresponding
5122 -svrname argument. If you use ClearCase and are within a ClearCase view, the
5123 server name will default to the name of the view (based on the value of the
5124 CLEARCASE_ROOT environment variable).
5126 Communication between nc and nedit is through the X display. So as long as X
5127 windows is set up and working properly, nc will work properly as well.
5128 nc uses the DISPLAY environment variable, the machine name and your user name
5129 to find the appropriate server, meaning, if you have several machines sharing
5130 a common file system, nc will not be able to find a server that is running on
5131 a machine with a different host name, even though it may be perfectly
5132 appropriate for editing a given file.
5134 The command which nc uses to start an nedit server is settable via the X
5135 resource nc.serverCommand, by default, "nedit -server".
5136 <P><HR>
5138 <A NAME="Crash_Recovery"</A>
5139 <H2> Crash Recovery </H2>
5141 If a system crash, network failure, X server crash, or program error should
5142 happen while you are editing a file, you can still recover most of your
5143 work. NEdit maintains a backup file which it updates periodically (every 8
5144 editing operations or 80 characters typed). This file has the same name
5145 as the file that you are editing, but with the character `~' (tilde) on Unix
5146 or `_' (underscore) on VMS prefixed to the name. To recover a file after a
5147 crash, simply rename the file to remove the tilde or underscore character,
5148 replacing the older version of the file. (Because several of the Unix shells
5149 consider the tilde to be a special character, you may have to prefix the
5150 character with a `\' (backslash) when you move or delete an NEdit backup
5151 file.)
5153 Example, to recover the file called "help.c" on Unix type the command:
5155 <PRE>
5156 mv \~help.c help.c
5157 </PRE>
5159 A minor caveat, is that if the file you were editing was in MS DOS format,
5160 the backup file will be in Unix format, and you will need to open the backup
5161 file in NEdit and change the file format back to MS DOS via the Save As...
5162 dialog (or use the Unix unix2dos command outside of NEdit).
5163 <P><HR>
5165 <A NAME="Version"</A>
5166 <H2> Version </H2>
5168 <PRE>
5169 NEdit 5.4DEV
5170 Aug 9, 2002
5171 </PRE>
5173 NEdit was written by Mark Edel, Joy Kyriakopulos, Christopher Conrad,
5174 Jim Clark, Arnulfo Zepeda-Navratil, Suresh Ravoor, Tony Balinski, Max
5175 Vohlken, Yunliang Yu, Donna Reid, Arne Førlie, Eddy De Greef, Steve
5176 LoBasso, Alexander Mai, Scott Tringali, Thorsten Haude, and Steve Haehn.
5178 The regular expression matching routines used in NEdit are adapted (with
5179 permission) from original code written by Henry Spencer at the
5180 University of Toronto.
5182 Syntax highlighting patterns and smart indent macros were contributed by:
5183 Simon T. MacDonald, Maurice Leysens, Matt Majka, Alfred Smeenk,
5184 Alain Fargues, Christopher Conrad, Scott Markinson, Konrad Bernloehr,
5185 Ivan Herman, Patrice Venant, Christian Denat, Philippe Couton,
5186 Max Vohlken, Markus Schwarzenberg, Himanshu Gohel, Steven C. Kapp,
5187 Michael Turomsha, John Fieber, Chris Ross, Nathaniel Gray, Joachim Lous,
5188 Mike Duigou, Seak Teng-Fong, Joor Loohuis, Mark Jones,
5189 and Niek van den Berg.
5191 NEdit sources, executables, additional documentation, and contributed
5192 software are available from the NEdit web site at <A HREF="http://www.nedit.org">http://www.nedit.org</A>.
5194 This program is free software; you can redistribute it and/or
5195 modify it under the terms of the GNU General Public License
5196 as published by the Free Software Foundation; either version 2
5197 of the License, or (at your option) any later version.
5199 This program is distributed in the hope that it will be useful,
5200 but WITHOUT ANY WARRANTY; without even the implied warranty of
5201 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5202 GNU General Public License in the Help section "<A HREF="#Distribution_Policy">Distribution Policy</A>"
5203 for more details.
5204 <P><HR>
5206 <A NAME="Distribution_Policy"</A>
5207 <H2> Distribution Policy </H2>
5209 GNU GENERAL PUBLIC LICENSE
5211 Version 2, June 1991
5213 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
5214 Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
5215 verbatim copies of this license document, but changing it is not allowed.
5217 Preamble
5219 The licenses for most software are designed to take away your freedom to
5220 share and change it. By contrast, the GNU General Public License is intended
5221 to guarantee your freedom to share and change free software--to make sure the
5222 software is free for all its users. This General Public License applies to
5223 most of the Free Software Foundation's software and to any other program
5224 whose authors commit to using it. (Some other Free Software Foundation
5225 software is covered by the GNU Library General Public License instead.) You
5226 can apply it to your programs, too.
5228 When we speak of free software, we are referring to freedom, not price. Our
5229 General Public Licenses are designed to make sure that you have the freedom
5230 to distribute copies of free software (and charge for this service if you
5231 wish), that you receive source code or can get it if you want it, that you
5232 can change the software or use pieces of it in new free programs; and that
5233 you know you can do these things.
5235 To protect your rights, we need to make restrictions that forbid anyone to
5236 deny you these rights or to ask you to surrender the rights. These
5237 restrictions translate to certain responsibilities for you if you distribute
5238 copies of the software, or if you modify it.
5240 For example, if you distribute copies of such a program, whether gratis or
5241 for a fee, you must give the recipients all the rights that you have. You
5242 must make sure that they, too, receive or can get the source code. And you
5243 must show them these terms so they know their rights.
5245 We protect your rights with two steps: (1) copyright the software, and (2)
5246 offer you this license which gives you legal permission to copy, distribute
5247 and/or modify the software.
5249 Also, for each author's protection and ours, we want to make certain that
5250 everyone understands that there is no warranty for this free software. If the
5251 software is modified by someone else and passed on, we want its recipients to
5252 know that what they have is not the original, so that any problems introduced
5253 by others will not reflect on the original authors' reputations.
5255 Finally, any free program is threatened constantly by software patents. We
5256 wish to avoid the danger that redistributors of a free program will
5257 individually obtain patent licenses, in effect making the program
5258 proprietary. To prevent this, we have made it clear that any patent must be
5259 licensed for everyone's free use or not licensed at all.
5261 The precise terms and conditions for copying, distribution and modification
5262 follow.
5264 GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
5265 MODIFICATION
5267 0. This License applies to any program or other work which contains a notice
5268 placed by the copyright holder saying it may be distributed under the terms
5269 of this General Public License. The "Program", below, refers to any such
5270 program or work, and a "work based on the Program" means either the Program
5271 or any derivative work under copyright law: that is to say, a work containing
5272 the Program or a portion of it, either verbatim or with modifications and/or
5273 translated into another language. (Hereinafter, translation is included
5274 without limitation in the term "modification".) Each licensee is addressed as
5275 "you".
5277 Activities other than copying, distribution and modification are not covered
5278 by this License; they are outside its scope. The act of running the Program
5279 is not restricted, and the output from the Program is covered only if its
5280 contents constitute a work based on the Program (independent of having been
5281 made by running the Program). Whether that is true depends on what the
5282 Program does.
5284 1. You may copy and distribute verbatim copies of the Program's source code
5285 as you receive it, in any medium, provided that you conspicuously and
5286 appropriately publish on each copy an appropriate copyright notice and
5287 disclaimer of warranty; keep intact all the notices that refer to this
5288 License and to the absence of any warranty; and give any other recipients of
5289 the Program a copy of this License along with the Program.
5291 You may charge a fee for the physical act of transferring a copy, and you may
5292 at your option offer warranty protection in exchange for a fee.
5294 2. You may modify your copy or copies of the Program or any portion of it,
5295 thus forming a work based on the Program, and copy and distribute such
5296 modifications or work under the terms of Section 1 above, provided that you
5297 also meet all of these conditions:
5299 a) You must cause the modified files to carry prominent notices stating
5300 that you changed the files and the date of any change.
5302 b) You must cause any work that you distribute or publish, that in whole or
5303 in part contains or is derived from the Program or any part thereof, to be
5304 licensed as a whole at no charge to all third parties under the terms of
5305 this License.
5307 c) If the modified program normally reads commands interactively when run,
5308 you must cause it, when started running for such interactive use in the
5309 most ordinary way, to print or display an announcement including an
5310 appropriate copyright notice and a notice that there is no warranty (or
5311 else, saying that you provide a warranty) and that users may redistribute
5312 the program under these conditions, and telling the user how to view a copy
5313 of this License. (Exception: if the Program itself is interactive but does
5314 not normally print such an announcement, your work based on the Program is
5315 not required to print an announcement.)
5317 These requirements apply to the modified work as a whole. If identifiable
5318 sections of that work are not derived from the Program, and can be reasonably
5319 considered independent and separate works in themselves, then this License,
5320 and its terms, do not apply to those sections when you distribute them as
5321 separate works. But when you distribute the same sections as part of a whole
5322 which is a work based on the Program, the distribution of the whole must be
5323 on the terms of this License, whose permissions for other licensees extend to
5324 the entire whole, and thus to each and every part regardless of who wrote it.
5326 Thus, it is not the intent of this section to claim rights or contest your
5327 rights to work written entirely by you; rather, the intent is to exercise the
5328 right to control the distribution of derivative or collective works based on
5329 the Program.
5331 In addition, mere aggregation of another work not based on the Program with
5332 the Program (or with a work based on the Program) on a volume of a storage or
5333 distribution medium does not bring the other work under the scope of this
5334 License.
5336 3. You may copy and distribute the Program (or a work based on it, under
5337 Section 2) in object code or executable form under the terms of Sections 1
5338 and 2 above provided that you also do one of the following:
5340 a) Accompany it with the complete corresponding machine-readable source
5341 code, which must be distributed under the terms of Sections 1 and 2 above
5342 on a medium customarily used for software interchange; or,
5344 b) Accompany it with a written offer, valid for at least three years, to
5345 give any third party, for a charge no more than your cost of physically
5346 performing source distribution, a complete machine-readable copy of the
5347 corresponding source code, to be distributed under the terms of Sections 1
5348 and 2 above on a medium customarily used for software interchange; or,
5350 c) Accompany it with the information you received as to the offer to
5351 distribute corresponding source code. (This alternative is allowed only for
5352 noncommercial distribution and only if you received the program in object
5353 code or executable form with such an offer, in accord with Subsection b
5354 above.)
5356 The source code for a work means the preferred form of the work for making
5357 modifications to it. For an executable work, complete source code means all
5358 the source code for all modules it contains, plus any associated interface
5359 definition files, plus the scripts used to control compilation and
5360 installation of the executable. However, as a special exception, the source
5361 code distributed need not include anything that is normally distributed (in
5362 either source or binary form) with the major components (compiler, kernel,
5363 and so on) of the operating system on which the executable runs, unless that
5364 component itself accompanies the executable.
5366 If distribution of executable or object code is made by offering access to
5367 copy from a designated place, then offering equivalent access to copy the
5368 source code from the same place counts as distribution of the source code,
5369 even though third parties are not compelled to copy the source along with the
5370 object code.
5372 4. You may not copy, modify, sublicense, or distribute the Program except as
5373 expressly provided under this License. Any attempt otherwise to copy, modify,
5374 sublicense or distribute the Program is void, and will automatically
5375 terminate your rights under this License. However, parties who have received
5376 copies, or rights, from you under this License will not have their licenses
5377 terminated so long as such parties remain in full compliance.
5379 5. You are not required to accept this License, since you have not signed it.
5380 However, nothing else grants you permission to modify or distribute the
5381 Program or its derivative works. These actions are prohibited by law if you
5382 do not accept this License. Therefore, by modifying or distributing the
5383 Program (or any work based on the Program), you indicate your acceptance of
5384 this License to do so, and all its terms and conditions for copying,
5385 distributing or modifying the Program or works based on it.
5387 6. Each time you redistribute the Program (or any work based on the Program),
5388 the recipient automatically receives a license from the original licensor to
5389 copy, distribute or modify the Program subject to these terms and conditions.
5390 You may not impose any further restrictions on the recipients' exercise of
5391 the rights granted herein. You are not responsible for enforcing compliance
5392 by third parties to this License.
5394 7. If, as a consequence of a court judgment or allegation of patent
5395 infringement or for any other reason (not limited to patent issues),
5396 conditions are imposed on you (whether by court order, agreement or
5397 otherwise) that contradict the conditions of this License, they do not excuse
5398 you from the conditions of this License. If you cannot distribute so as to
5399 satisfy simultaneously your obligations under this License and any other
5400 pertinent obligations, then as a consequence you may not distribute the
5401 Program at all. For example, if a patent license would not permit
5402 royalty-free redistribution of the Program by all those who receive copies
5403 directly or indirectly through you, then the only way you could satisfy both
5404 it and this License would be to refrain entirely from distribution of the
5405 Program.
5407 If any portion of this section is held invalid or unenforceable under any
5408 particular circumstance, the balance of the section is intended to apply and
5409 the section as a whole is intended to apply in other circumstances.
5411 It is not the purpose of this section to induce you to infringe any patents
5412 or other property right claims or to contest validity of any such claims;
5413 this section has the sole purpose of protecting the integrity of the free
5414 software distribution system, which is implemented by public license
5415 practices. Many people have made generous contributions to the wide range of
5416 software distributed through that system in reliance on consistent
5417 application of that system; it is up to the author/donor to decide if he or
5418 she is willing to distribute software through any other system and a licensee
5419 cannot impose that choice.
5421 This section is intended to make thoroughly clear what is believed to be a
5422 consequence of the rest of this License.
5424 8. If the distribution and/or use of the Program is restricted in certain
5425 countries either by patents or by copyrighted interfaces, the original
5426 copyright holder who places the Program under this License may add an
5427 explicit geographical distribution limitation excluding those countries, so
5428 that distribution is permitted only in or among countries not thus excluded.
5429 In such case, this License incorporates the limitation as if written in the
5430 body of this License.
5432 9. The Free Software Foundation may publish revised and/or new versions of
5433 the General Public License from time to time. Such new versions will be
5434 similar in spirit to the present version, but may differ in detail to address
5435 new problems or concerns.
5437 Each version is given a distinguishing version number. If the Program
5438 specifies a version number of this License which applies to it and "any later
5439 version", you have the option of following the terms and conditions either of
5440 that version or of any later version published by the Free Software
5441 Foundation. If the Program does not specify a version number of this License,
5442 you may choose any version ever published by the Free Software Foundation.
5444 10. If you wish to incorporate parts of the Program into other free programs
5445 whose distribution conditions are different, write to the author to ask for
5446 permission. For software which is copyrighted by the Free Software
5447 Foundation, write to the Free Software Foundation; we sometimes make
5448 exceptions for this. Our decision will be guided by the two goals of
5449 preserving the free status of all derivatives of our free software and of
5450 promoting the sharing and reuse of software generally.
5452 <B>NO WARRANTY</B>
5454 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
5455 THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
5456 STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
5457 PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
5458 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
5459 FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
5460 PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
5461 YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
5463 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
5464 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
5465 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
5466 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
5467 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO
5468 LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
5469 THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
5470 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
5471 POSSIBILITY OF SUCH DAMAGES.
5473 END OF TERMS AND CONDITIONS
5474 <P><HR>
5476 <A NAME="Mailing_Lists"</A>
5477 <H2> Mailing Lists </H2>
5479 There are two separate mailing lists for nedit users, and one for developers.
5480 Users may post to the developer mailing list to report defects and communicate
5481 with the nedit developers. Remember that nedit is entirely a volunteer
5482 effort, so please ask questions first to the discussion list, and do your
5483 share to answer other users questions as well.
5485 <PRE>
5486 <A HREF="mailto:discuss@nedit.org">discuss@nedit.org</A>
5487 </PRE>
5489 General discussion, questions and answers among NEdit users and developers.
5491 <PRE>
5492 <A HREF="mailto:announce@nedit.org">announce@nedit.org</A>
5493 </PRE>
5495 A low-volume mailing list for announcing new versions.
5497 <PRE>
5498 <A HREF="mailto:develop@nedit.org">develop@nedit.org</A>
5499 </PRE>
5501 Communication among and with NEdit developers.
5502 Developers should also subscribe to the discuss list.
5504 To subscribe, send mail to &#60;majordomo@nedit.org&#62; with one or more of the
5505 following in the body of the message:
5507 <PRE>
5508 subscribe announce
5509 subscribe discuss
5510 subscribe develop
5511 <P><HR>
5512 </PRE>
5514 <A NAME="Problems/Defects"</A>
5515 <H2> Problems/Defects </H2>
5517 <H3>Solutions to Common Problems</H3>
5519 For a much more comprehensive list of common problems and solutions, see the
5520 NEdit FAQ. The latest version of the FAQ can always be found on the NEdit
5521 web site at:
5523 <PRE>
5524 <A HREF="http://www.nedit.org">http://www.nedit.org</A>.
5525 </PRE>
5527 <B>P: No files are shown in the "Files" list in the Open... dialog.</B>
5529 S: When you use the "Filter" field, include the file specification or a
5530 complete directory specification, including the trailing "/" on Unix.
5531 (See Help in the Open... dialog).
5533 <B>P: Find Again and Replace Again don't continue in the same direction as the original Find or Replace.</B>
5535 S: Find Again and Replace Again don't use the direction of the original
5536 search. The Shift key controls the direction: Ctrl+G means forward,
5537 Shift+Ctrl+G means backward.
5539 <B>P: Preferences specified in the Preferences menu don't seem to get saved when I select Save Defaults.</B>
5541 S: NEdit has two kinds of preferences: 1) per-window preferences, in the
5542 Preferences menu, and 2) default settings for preferences in newly created
5543 windows, in the Default Settings sub-menu of the Preferences menu.
5544 Per-window preferences are not saved by Save Defaults, only Default
5545 Settings.
5547 <B>P: Columns and indentation don't line up.</B>
5549 S: NEdit is using a proportional width font. Set the font to a fixed style
5550 (see Preferences menu).
5552 <B>P: NEdit performs poorly on very large files.</B>
5554 S: Turn off Incremental Backup. With Incremental Backup on, NEdit
5555 periodically writes a full copy of the file to disk.
5557 <B>P: Commands added to the Shell Commands menu (Unix only) don't output anything until they are finished executing.</B>
5559 S: If the command output is directed to a dialog, or the input is from a
5560 selection, output is collected together and held until the command
5561 completes. De-select both of the options and the output will be shown
5562 incrementally as the command executes.
5564 <B>P: Dialogs don't automatically get keyboard focus when they pop up.</B>
5566 S: Most X Window managers allow you to choose between two categories of
5567 keyboard focus models: pointer focus, and explicit focus. Pointer focus
5568 means that as you move the mouse around the screen, the window under the
5569 mouse automatically gets the keyboard focus. NEdit users who use this
5570 focus model should set "Popups Under Pointer" in the Default Settings sub
5571 menu of the preferences menu in NEdit. Users with the explicit focus
5572 model, in some cases, may have problems with certain dialogs, such as Find
5573 and Replace. In MWM this is caused by the mwm resource startupKeyFocus
5574 being set to False (generally a bad choice for explicit focus users).
5575 NCDwm users should use the focus model "click" instead of "explicit",
5576 again, unless you have set it that way to correct specific problems, this
5577 is the appropriate setting for most explicit focus users.
5579 <B>P: The Backspace key doesn't work, or deletes forward rather than backward.</B>
5581 S: While this is an X/Motif binding problem, and should be solved outside of
5582 NEdit in the Motif virtual binding layer (or possibly xmodmap or
5583 translations), NEdit provides an out. If you set the resource:
5584 nedit.remapDeleteKey to True, NEdit will forcibly map the delete key to
5585 backspace. The default setting of this resource recently changed, so
5586 users who have been depending on this remapping will now have to set it
5587 explicitly (or fix their bindings).
5589 <B>P: NEdit crashes when I try to paste text in to a text field in a dialog (like Find or Replace) on my SunOS system.</B>
5591 S: On many SunOS systems, you have to set up an nls directory before various
5592 inter-client communication features of Motif will function properly.
5593 There are instructions in README.sun in /pub/v5_0_2/individual/README.sun on
5594 ftp.nedit.org, as well as a tar file containing a complete nls
5595 directory: ftp://ftp.nedit.org/pub/v5_0_2/nls.tar.
5596 README.sun contains directions for setting up an nls directory, which
5597 is required by Motif for handling copy and paste to Motif text fields.
5599 <H3>Known Defects</H3>
5601 Below is the list of known defects which affect NEdit. The defects your copy
5602 of NEdit will exhibit depend on which system you are running and with which
5603 Motif libraries it was built. Note that there are now Motif 1.2 and/or 2.0
5604 libraries available on ALL supported platforms, and as you can see below
5605 there are far fewer defects in Motif 1.2, so it is in your best interest to
5606 upgrade your system.
5608 <H4>All Versions</H4>
5610 <PRE>
5611 <B>DEFECT</B>
5612 </PRE>
5613 Operations between rectangular selections on overlapping lines do nothing.
5615 <PRE>
5616 <I>Work Around</I>
5617 </PRE>
5618 None. These operations are very complicated and rarely used.
5620 <PRE>
5621 <B>DEFECT</B>
5622 </PRE>
5623 Cut and Paste menu items fail, or possibly crash,
5624 for very large (multi-megabyte) selections.
5626 <PRE>
5627 <I>Work Around</I>
5628 </PRE>
5629 Use selection copy (middle mouse button click)
5630 for transferring larger quantities of data.
5631 Cut and Paste save the copied text in server
5632 memory, which is usually limited.
5634 <H3>Reporting Defects</H3>
5636 Submit bugs through the web at:
5638 <PRE>
5639 http://sf.net/tracker/?func=add&#38;group_id=11005&#38;atid=111005
5640 </PRE>
5642 Please include the first few lines from Help &#62; Version, which identifes
5643 NEdit's version and other system attributes important for diagnosing your
5644 problem.
5646 The NEdit developers subscribe to both discuss@nedit.org and
5647 develop@nedit.org, either of which may be used for reporting defects. If
5648 you're not sure, or you think the report might be of interest to the general
5649 NEdit user community, send the report to <A HREF="mailto:discuss@nedit.org">discuss@nedit.org</A>. If it's
5650 something obvious and boring, like we misspelled "anemometer" in the on-line
5651 help, send it to <A HREF="mailto:develop@nedit.org">develop@nedit.org</A>. If you don't want to subscribe to the
5652 <A HREF="#Mailing_Lists">Mailing Lists</A>, please add a note to your mail about cc'ing you on responses.
5654 </BODY>
5655 </HTML>