1 .. $Id: help.etx,v 1.111 2008/02/19 22:31:51 ajbj Exp $
2 .. NOTE: Remember to supply 'version' variable on setext command line.
3 .. For example, setext -m -v "version=NEdit Version 6.0".
5 .. The following are variable definitions for the various titles below
6 .. ----------------------------------------------------------------------------
7 .. |>title=Nirvana Editor (NEdit) Help Documentation<|
8 .. |>ttlMk==========================================<|
9 .. ----------------------------------------------------------------------------
24 .. .. This table of contents is only for the HTML version of this document.
31 Basic Operation Macro/Shell Extensions
32 Selecting_Text_ Shell_Commands_and_Filters_
33 Finding_and_Replacing_Text_ Learn/Replay_
34 Cut_and_Paste_ Macro_Language_
35 Using_the_Mouse_ Macro_Subroutines_
36 Keyboard_Shortcuts_ Highlighting_Information_
37 Shifting_and_Filling_ Range_Sets_
38 Tabbed_Editing_ Action_Routines_
41 Features for Programming Customizing_NEdit_
42 Programming_with_NEdit_ Preferences_
43 Tabs/Emulated_Tabs_ X_Resources_
44 Auto/Smart_Indent_ Key_Binding_
45 Syntax_Highlighting_ Highlighting_Patterns_
46 Finding_Declarations_(ctags)_ Smart_Indent_Macros_
49 Regular Expressions NEdit_Command_Line_
50 Basic_Regular_Expression_Syntax_ Client/Server_Mode_
51 Metacharacters_ Crash_Recovery_
52 Parenthetical_Constructs_ Version_
53 Advanced_Topics_ GNU_General_Public_License_
54 Example_Regular_Expressions_ Mailing_Lists_
63 .. .. What appears below will always print whether or not NEDITDOC is defined.
66 NEdit is a standard GUI (Graphical User Interface) style text editor for
67 programs and plain-text files. Users of Macintosh and MS Windows based text
68 editors should find NEdit a familiar and comfortable environment. NEdit
69 provides all of the standard menu, dialog, editing, and mouse support, as
70 well as all of the standard shortcuts to which the users of modern GUI based
71 environments are accustomed. For users of older style Unix editors, welcome
72 to the world of mouse-based editing!
75 .. NEdit is freely distributed under the terms of the Gnu General Public
78 .. .. This stuff will always be invisible, unless NEDITDOC is defined
83 .. NEdit is a single stand-alone executable file which can be installed by simply
84 .. copying the appropriate executable "nedit" for your system. Both sources and
85 .. executables are available from http://www.nedit.org. The optional "nc" (NEdit
86 .. Client) program is also available for users who want to run nedit in
87 .. client/server mode.
93 Help sections of interest to new users are listed under the "Basic Operation"
94 heading in the top-level Help menu:
97 Finding_and_Replacing_Text_
101 Shifting_and_Filling_
103 Programmers should also read the introductory section under the "Features for
104 Programming" section:
106 Programming_with_NEdit_
108 If you get into trouble, the Undo command in the Edit menu can reverse any
109 modifications that you make. NEdit does not change the file you are editing
110 until you tell it to Save.
112 3>Editing an Existing File
114 To open an existing file, choose Open... from the file menu. Select the file
115 that you want to open in the pop-up dialog that appears and click on OK. You
116 may open any number of files at the same time. Depending on your settings
117 (cf. "Tabbed_Editing_") each file can appear in its own editor window, or it
118 can appear under a tab in the same editor window. Using Open... rather than
119 re-typing the NEdit command and running additional copies of NEdit, will give
120 you quick access to all of the files you have open via the Windows menu, and
121 ensure that you don't accidentally open the same file twice. NEdit has no
122 "main" window. It remains running as long as at least one editor window is
125 3>Creating a New File
127 If you already have an empty (Untitled) window displayed, just begin typing
128 in the window. To create a new Untitled window, choose New Window or New Tab
129 from the File menu. To give the file a name and save its contents to the
130 disk, choose Save or Save As... from the File menu.
134 NEdit maintains periodic backups of the file you are editing so that you can
135 recover the file in the event of a problem such as a system crash, network
136 failure, or X server crash. These files are saved under the name `~filename`
137 (on Unix) or `_filename` (on VMS), where filename is the name of the file you
138 were editing. If an NEdit process is killed, some of these backup files may
139 remain in your directory. (To remove one of these files on Unix, you may
140 have to prefix the `~' (tilde) character with a (backslash) to prevent the
141 shell from interpreting it as a special character.)
145 As you become more familiar with NEdit, substitute the control and function
146 keys shown on the right side of the menus for pulling down menus with the
149 Dialogs are also streamlined so you can enter information quickly and without
150 using the mouse*. To move the keyboard focus around a dialog, use the tab
151 and arrow keys. One of the buttons in a dialog is usually drawn with a
152 thick, indented, outline. This button can be activated by pressing Return or
153 Enter. The Cancel or Dismiss button can be activated by pressing escape.
154 For example, to replace the string "thing" with "things" type:
156 <ctrl-r>thing<tab>things<return>
158 To open a file named "whole_earth.c", type:
162 (how much of the filename you need to type depends on the other files in the
163 directory). See the section called "Keyboard_Shortcuts_" for more details.
165 * Users who have set their keyboard focus mode to "pointer" should set
166 "Popups Under Pointer" in the Default Settings menu to avoid the additional
167 step of moving the mouse into the dialog.
168 ----------------------------------------------------------------------
176 NEdit has two general types of selections, primary (highlighted text), and
177 secondary (underlined text). Selections can cover either a simple range of
178 text between two points in the file, or they can cover a rectangular area of
179 the file. Rectangular selections are only useful with non-proportional (fixed
182 To select text for copying, deleting, or replacing, press the left mouse
183 button with the pointer at one end of the text you want to select, and drag
184 it to the other end. The text will become highlighted. To select a whole
185 word, double click (click twice quickly in succession). Double clicking and
186 then dragging the mouse will select a number of words. Similarly, you can
187 select a whole line or a number of lines by triple clicking or triple
188 clicking and dragging. Quadruple clicking selects the whole file. After
189 releasing the mouse button, you can still adjust a selection by holding down
190 the shift key and dragging on either end of the selection. To delete the
191 selected text, press delete or backspace. To replace it, begin typing.
193 To select a rectangle or column of text, hold the Ctrl key while dragging the
194 mouse. Rectangular selections can be used in any context that normal
195 selections can be used, including cutting and pasting, filling, shifting,
196 dragging, and searching. Operations on rectangular selections automatically
197 fill in tabs and spaces to maintain alignment of text within and to the right
198 of the selection. Note that the interpretation of rectangular selections by
199 Fill Paragraph is slightly different from that of other commands, the section
200 titled "Shifting_and_Filling_" has details.
202 The middle mouse button can be used to make an additional selection (called
203 the secondary selection). As soon as the button is released, the contents of
204 this selection will be copied to the insert position of the window where the
205 mouse was last clicked (the destination window). This position is marked by a
206 caret shaped cursor when the mouse is outside of the destination window. If
207 there is a (primary) selection, adjacent to the cursor in the window, the new
208 text will replace the selected text. Holding the shift key while making the
209 secondary selection will move the text, deleting it at the site of the
210 secondary selection, rather than copying it.
212 Selected text can also be dragged to a new location in the file using the
213 middle mouse button. Holding the shift key while dragging the text will copy
214 the selected text, leaving the original text in place. Holding the control
215 key will drag the text in overlay mode.
217 Normally, dragging moves text by removing it from the selected position at
218 the start of the drag, and inserting it at a new position relative to the
219 mouse. Dragging a block of text over existing characters, displaces the
220 characters to the end of the selection. In overlay mode, characters which are
221 occluded by blocks of text being dragged are simply removed. When dragging
222 non-rectangular selections, overlay mode also converts the selection to
223 rectangular form, allowing it to be dragged outside of the bounds of the
226 The section "Using_the_Mouse_" summarizes the mouse commands for making primary
227 and secondary selections. Primary selections can also be made via keyboard
228 commands, see "Keyboard_Shortcuts_".
229 ----------------------------------------------------------------------
231 Finding and Replacing Text
232 --------------------------
234 The Search menu contains a number of commands for finding and replacing text.
236 The Find... and Replace... commands present dialogs for entering text for
237 searching and replacing. These dialogs also allow you to choose whether you
238 want the search to be sensitive to upper and lower case, or whether to use
239 the standard Unix pattern matching characters (regular expressions).
240 Searches begin at the current text insertion position.
242 Find Again and Replace Again repeat the last find or replace command without
243 prompting for search strings. To selectively replace text, use the two
244 commands in combination: Find Again, then Replace Again if the highlighted
245 string should be replaced, or Find Again again to go to the next string.
247 Find Selection searches for the text contained in the current primary
248 selection (see Selecting_Text_). The selected text does not have to be in the
249 current editor window, it may even be in another program. For example, if
250 the word dog appears somewhere in a window on your screen, and you want to
251 find it in the file you are editing, select the word dog by dragging the
252 mouse across it, switch to your NEdit window and choose Find Selection from
255 Find Incremental, which opens the interactive search bar, is yet another variation
256 on searching, where every character typed triggers a new search. After you've
257 completed the search string, the next occurrence in the buffer is found by hitting
258 the Return key, or by clicking on the icon to the left (magnifying glass). Holding
259 a Shift key down finds the previous occurrences. To the right there is a clear
260 button with an icon resembling "|<". Clicking on it empties the search text widget
261 without disturbing selections. A middle click on the clear button copies the
262 content of any existing selection into the search text widget and triggers a new
265 3>Searching Backwards
267 Holding down the shift key while choosing any of the search or replace
268 commands from the menu (or using the keyboard shortcut), will search in the
269 reverse direction. Users who have set the search direction using the buttons
270 in the search dialog, may find it a bit confusing that Find Again and Replace
271 Again don't continue in the same direction as the original search (for
272 experienced users, consistency of the direction implied by the shift key is
275 3>Selective Replacement
277 To replace only some occurrences of a string within a file, choose Replace...
278 from the Search menu, enter the string to search for and the string to
279 substitute, and finish by pressing the Find button. When the first
280 occurrence is highlighted, use either Replace Again (^T) to replace it, or
281 Find Again (^G) to move to the next occurrence without replacing it, and
282 continue in such a manner through all occurrences of interest.
284 To replace all occurrences of a string within some range of text, select the
285 range (see Selecting_Text_), choose Replace... from the Search menu, type the
286 string to search for and the string to substitute, and press the "R. in
287 Selection" button in the dialog. Note that selecting text in the Replace...
288 dialog will unselect the text in the window.
290 3>Replacement in Multiple Documents
292 You can do the same replacement in more than one document at the same time.
293 To do that, enter the search and replacement string in the replacement dialog
294 as usual, then press the 'Multiple Documents...' button. NEdit will open
295 another dialog where you can pick any document in which the replacement should
296 take place. Then press 'Replace' in this dialog to do the replacement. All
297 attributes (Regular Expression, Case, etc.) are used as selected in the main
300 ----------------------------------------------------------------------
305 The easiest way to copy and move text around in your file or between windows,
306 is to use the clipboard, an imaginary area that temporarily stores text and
307 data. The Cut command removes the selected text (see Selecting_Text_) from
308 your file and places it in the clipboard. Once text is in the clipboard, the
309 Paste command will copy it to the insert position in the current window. For
310 example, to move some text from one place to another, select it by dragging
311 the mouse over it, choose Cut to remove it, click the pointer to move the
312 insert point where you want the text inserted, then choose Paste to insert
313 it. Copy copies text to the clipboard without deleting it from your file.
314 You can also use the clipboard to transfer text to and from other Motif
315 programs and X programs which make proper use of the clipboard.
317 There are many other methods for copying and moving text within NEdit windows
318 and between NEdit and other programs. The most common such method is
319 clicking the middle mouse button to copy the primary selection (to the
320 clicked position). Copying the selection by clicking the middle mouse button
321 in many cases is the only way to transfer data to and from many X programs.
322 Holding the Shift key while clicking the middle mouse button moves the text,
323 deleting it from its original position, rather than copying it. Other
324 methods for transferring text include secondary selections, primary selection
325 dragging, keyboard-based selection copying, and drag and drop. These are
326 described in detail in the sections: "Selecting_Text_", "Using_the_Mouse_",
327 and "Keyboard_Shortcuts_".
328 ----------------------------------------------------------------------
333 Mouse-based editing is what NEdit is all about, and learning to use the more
334 advanced features like secondary selections and primary selection dragging
335 will be well worth your while.
337 If you don't have time to learn everything, you can get by adequately with
338 just the left mouse button: Clicking the left button moves the cursor.
339 Dragging with the left button makes a selection. Holding the shift key while
340 clicking extends the existing selection, or begins a selection between the
341 cursor and the mouse. Double or triple clicking selects a whole word or a
344 This section will make more sense if you also read the section called,
345 "Selecting_Text_", which explains the terminology of selections, that is,
346 what is meant by primary, secondary, rectangular, etc.
349 3>Button and Modifier Key Summary
351 General meaning of mouse buttons and modifier keys:
355 Button 1 (left) Cursor position and primary selection
357 Button 2 (middle) Secondary selections, and dragging and
358 copying the primary selection
360 Button 3 (right) Quick-access programmable menu and pan
365 Shift On primary selections, (left mouse button):
366 Extends selection to the mouse pointer
367 On secondary and copy operations, (middle):
368 Toggles between move and copy
370 Ctrl Makes selection rectangular or insertion
373 Alt* (on release) Exchange primary and secondary
379 The left mouse button is used to position the cursor and to make primary
382 Click Moves the cursor
384 Double Click Selects a whole word
386 Triple Click Selects a whole line
388 Quad Click Selects the whole file
390 Shift Click Adjusts (extends or shrinks) the
391 selection, or if there is no existing
392 selection, begins a new selection
393 between the cursor and the mouse.
395 Ctrl+Shift+ Adjusts (extends or shrinks) the
396 Click selection rectangularly.
398 Drag Selects text between where the mouse
399 was pressed and where it was released.
401 Ctrl+Drag Selects rectangle between where the
402 mouse was pressed and where it was
408 The right mouse button posts a programmable menu for frequently used commands.
410 Click/Drag Pops up the background menu (programmed
411 from Preferences -> Default Settings ->
412 Customize Menus -> Window Background).
414 Ctrl+Drag Pan scrolling. Scrolls the window
415 both vertically and horizontally, as if
416 you had grabbed it with your mouse.
419 3>Middle Mouse Button
421 The middle mouse button is for making secondary selections, and copying and
422 dragging the primary selection.
424 Click Copies the primary selection to the
427 Shift+Click Moves the primary selection to the
428 clicked position, deleting it from its
431 Drag 1) Outside of the primary selection:
432 Begins a secondary selection.
433 2) Inside of the primary selection:
434 Moves the selection by dragging.
436 Ctrl+Drag 1) Outside of the primary selection:
437 Begins a rectangular secondary
439 2) Inside of the primary selection:
440 Drags the selection in overlay
443 When the mouse button is released after creating a secondary selection:
445 No Modifiers If there is a primary selection,
446 replaces it with the secondary
447 selection. Otherwise, inserts the
448 secondary selection at the cursor
451 Shift Move the secondary selection, deleting
452 it from its original position. If
453 there is a primary selection, the move
454 will replace the primary selection
455 with the secondary selection.
456 Otherwise, moves the secondary
457 selection to the cursor position.
459 Alt* Exchange the primary and secondary
463 While moving the primary selection by dragging with the middle mouse button:
465 Shift Leaves a copy of the original
466 selection in place rather than
467 removing it or blanking the area.
469 Ctrl Changes from insert mode to overlay
472 Escape Cancels drag in progress.
474 Overlay Mode: Normally, dragging moves text by removing it from the selected
475 position at the start of the drag, and inserting it at a new position
476 relative to the mouse. When you drag a block of text over existing
477 characters, the existing characters are displaced to the end of the
478 selection. In overlay mode, characters which are occluded by blocks of text
479 being dragged are simply removed. When dragging non-rectangular selections,
480 overlay mode also converts the selection to rectangular form, allowing it to
481 be dragged outside of the bounds of the existing text.
483 Mouse buttons 4 and 5 are usually represented by a mouse wheel nowadays.
484 They are used to scroll up or down in the text window.
486 * The Alt key may be labeled Meta or Compose-Character on some keyboards.
487 Some window managers, including default configurations of mwm, bind
488 combinations of the Alt key and mouse buttons to window manager operations.
489 In NEdit, Alt is only used on button release, so regardless of the window
490 manager bindings for Alt-modified mouse buttons, you can still do the
491 corresponding NEdit operation by using the Alt key AFTER the initial mouse
492 press, so that Alt is held while you release the mouse button. If you find
493 this difficult or annoying, you can re-configure most window managers to skip
494 this binding, or you can re-configure NEdit to use a different key
496 ----------------------------------------------------------------------
501 Most of the keyboard shortcuts in NEdit are shown on the right hand sides of
502 the pull-down menus. However, there are more which are not as obvious. These
503 include; dialog button shortcuts; menu and dialog mnemonics; labeled keyboard
504 keys, such as the arrows, page-up, page-down, and home; and optional Shift
505 modifiers on accelerator keys, like [Shift]Ctrl+F.
510 Pressing the key combinations shown on the right of the menu items is a
511 shortcut for selecting the menu item with the mouse. Some items have the shift
512 key enclosed in brackets, such as [Shift]Ctrl+F. This indicates that the shift
513 key is optional. In search commands, including the shift key reverses the
514 direction of the search. In Shift commands, it makes the command shift the
515 selected text by a whole tab stop rather than by single characters.
520 Pressing the Alt key in combination with one of the underlined characters in
521 the menu bar pulls down that menu. Once the menu is pulled down, typing the
522 underlined characters in a menu item (without the Alt key) activates that
523 item. With a menu pulled down, you can also use the arrow keys to select menu
524 items, and the Space or Enter keys to activate them.
527 3>Keyboard Shortcuts within Dialogs
529 One button in a dialog is usually marked with a thick indented outline.
530 Pressing the Return or Enter key activates this button.
532 All dialogs have either a Cancel or Dismiss button. This button can be
533 activated by pressing the Escape (or Esc) key.
535 Pressing the tab key moves the keyboard focus to the next item in a dialog.
536 Within an associated group of buttons, the arrow keys move the focus among the
537 buttons. Shift+Tab moves backward through the items.
539 Most items in dialogs have an underline under one character in their name.
540 Pressing the Alt key along with this character, activates a button as if you
541 had pressed it with the mouse, or moves the keyboard focus to the associated
544 You can select items from a list by using the arrow keys to move the
545 selection and space to select.
547 In file selection dialogs, you can type the beginning characters of the file
548 name or directory in the list to select files
551 3>Labeled Function Keys
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
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 "Customizing_NEdit_", and
570 "X_Resources_" 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 3>Modifier Keys (in general)
577 Ctrl Extends the scope of the action that the key
578 would otherwise perform. For example, Home
579 normally moves the insert cursor to the beginning
580 of a line. Ctrl+Home moves it to the beginning of
581 the file. Backspace deletes one character, Ctrl+
582 Backspace deletes one word.
584 Shift Extends the selection to the cursor position. If
585 there's no selection, begins one between the old
586 and new cursor positions.
588 Alt When modifying a selection, makes the selection
591 (For the effects of modifier keys on mouse button presses, see the section
592 titled "Using_the_Mouse_")
596 Escape Cancels operation in progress: menu
597 selection, drag, selection, etc. Also
598 equivalent to cancel button in dialogs.
600 Backspace Delete the character before the cursor
602 Ctrl+BS Delete the word before the cursor
606 Left Move the cursor to the left one character
608 Ctrl+Left Move the cursor backward one word
609 (Word delimiters are settable, see
610 "Customizing_NEdit_", and "X_Resources_")
612 Right Move the cursor to the right one character
614 Ctrl+Right Move the cursor forward one word
616 Up Move the cursor up one line
618 Ctrl+Up Move the cursor up one paragraph.
619 (Paragraphs are delimited by blank lines)
621 Down Move the cursor down one line.
623 Ctrl+Down Move the cursor down one paragraph.
625 Ctrl+Return Return with automatic indent, regardless
626 of the setting of Auto Indent.
628 Shift+Return Return without automatic indent,
629 regardless of the setting of Auto Indent.
631 Ctrl+Tab Insert an ASCII tab character, without
632 processing emulated tabs.
634 Alt+Ctrl+<c> Insert the control-code equivalent of
637 Ctrl+/ Select everything (same as Select
642 Ctrl+U Delete to start of line
644 3>PC Standard Keyboard
646 Ctrl+Insert Copy the primary selection to the
647 clipboard (same as Copy menu item or ^C)
648 for compatibility with Motif standard key
651 Insert Copy the primary selection to the cursor
654 Delete Delete the character before the cursor.
655 (Can be configured to delete the character
656 after the cursor, see "Customizing_NEdit_",
659 Ctrl+Delete Delete to end of line.
661 Shift+Delete Cut, remove the currently selected text
662 and place it in the clipboard. (same as
663 Cut menu item or ^X) for compatibility
664 with Motif standard key binding
666 Delete Cut the primary selection to the cursor
669 Home Move the cursor to the beginning of the
672 Ctrl+Home Move the cursor to the beginning of the
675 End Move the cursor to the end of the line
677 Ctrl+End Move the cursor to the end of the file
679 PageUp Scroll and move the cursor up by one page.
681 PageDown Scroll and move the cursor down by one
684 F10 Make the menu bar active for keyboard
685 input (Arrow Keys, Return, Escape,
688 Alt+Home Switch to the previously active document.
690 Ctrl+PageUp Switch to the previous document.
692 Ctrl+PageDown Switch to the next document.
695 3>Specialty Keyboards
697 On machines with different styles of keyboards, generally, text editing
698 actions are properly matched to the labeled keys, such as Remove,
699 Next-screen, etc.. If you prefer different key bindings, see the section
700 titled "Key_Binding_" under the Customizing heading in the Help menu.
701 ----------------------------------------------------------------------
706 3>Shift Left, Shift Right
708 While shifting blocks of text is most important for programmers (See Features
709 for Programming), it is also useful for other tasks, such as creating
712 To shift a block of text one tab stop to the right, select the text, then
713 choose Shift Right from the Edit menu. Note that the accelerator keys for
714 these menu items are Ctrl+9 and Ctrl+0, which correspond to the right and
715 left parenthesis on most keyboards. Remember them as adjusting the text in
716 the direction pointed to by the parenthesis character. Holding the Shift key
717 while selecting either Shift Left or Shift Right will shift the text by one
720 It is also possible to shift blocks of text by selecting the text
721 rectangularly, and dragging it left or right (and up or down as well). Using
722 a rectangular selection also causes tabs within the selection to be
723 recalculated and substituted, such that the non-whitespace characters remain
724 stationary with respect to the selection.
729 Text filling using the Fill Paragraph command in the Edit menu is one of the
730 most important concepts in NEdit. And it will be well worth your while to
731 understand how to use it properly.
733 In plain text files, unlike word-processor files, there is no way to tell
734 which lines are continuations of other lines, and which lines are meant to be
735 separate, because there is no distinction in meaning between newline
736 characters which separate lines in a paragraph, and ones which separate
737 paragraphs from other text. This makes it impossible for a text editor like
738 NEdit to tell parts of the text which belong together as a paragraph from
739 carefully arranged individual lines.
741 In continuous wrap mode (Preferences -> Wrap -> Continuous), lines
742 automatically wrap and unwrap themselves to line up properly at the right
743 margin. In this mode, you simply omit the newlines within paragraphs and let
744 NEdit make the line breaks as needed. Unfortunately, continuous wrap mode is
745 not appropriate in the majority of situations, because files with extremely
746 long lines are not common under Unix and may not be compatible with all
747 tools, and because you can't achieve effects like indented sections, columns,
748 or program comments, and still take advantage of the automatic wrapping.
750 Without continuous wrapping, paragraph filling is not entirely automatic.
751 Auto-Newline wrapping keeps paragraphs lined up as you type, but once
752 entered, NEdit can no longer distinguish newlines which join wrapped text,
753 and newlines which must be preserved. Therefore, editing in the middle of a
754 paragraph will often leave the right margin messy and uneven.
756 Since NEdit can't act automatically to keep your text lined up, you need to
757 tell it explicitly where to operate, and that is what Fill Paragraph is for.
758 It arranges lines to fill the space between two margins, wrapping the lines
759 neatly at word boundaries. Normally, the left margin for filling is inferred
760 from the text being filled. The first line of each paragraph is considered
761 special, and its left indentation is maintained separately from the remaining
762 lines (for leading indents, bullet points, numbered paragraphs, etc.).
763 Otherwise, the left margin is determined by the furthest left non-whitespace
764 character. The right margin is either the Wrap Margin, set in the
765 preferences menu (by default, the right edge of the window), or can also be
766 chosen on the fly by using a rectangular selection (see below).
768 There are three ways to use Fill Paragraph. The simplest is, while you are
769 typing text, and there is no selection, simply select Fill Paragraph (or type
770 Ctrl+J), and NEdit will arrange the text in the paragraph adjacent to the
771 cursor. A paragraph, in this case, means an area of text delimited by blank
774 The second way to use Fill Paragraph is with a selection. If you select a
775 range of text and then chose Fill Paragraph, all of the text in the selection
776 will be filled. Again, continuous text between blank lines is interpreted as
777 paragraphs and filled individually, respecting leading indents and blank
780 The third, and most versatile, way to use Fill Paragraph is with a
781 rectangular selection. Fill Paragraph treats rectangular selections
782 differently from other commands. Instead of simply filling the text inside
783 the rectangular selection, NEdit interprets the right edge of the selection
784 as the requested wrap margin. Text to the left of the selection is not
785 disturbed (the usual interpretation of a rectangular selection), but text to
786 the right of the selection is included in the operation and is pulled in to
787 the selected region. This method enables you to fill text to an arbitrary
788 right margin, without going back and forth to the wrap-margin dialog, as well
789 as to exclude text to the left of the selection such as comment bars or other
791 ----------------------------------------------------------------------
796 NEdit is able to display files in distinct editor windows, or to display files
797 under tabs in the same editor window. The Options for controlling the tabbed
798 interface are found under Preferences -> Default Settings -> Tabbed Editing
799 (cf. "Preferences_", also "NEdit_Command_Line_").
801 Notice that you can re-group tabs at any time by detaching and attaching them,
802 or moving them, to other windows. This can be done using the Windows menu, or
803 using the context menu, which pops up when right clicking on a tab.
805 You can switch to a tab by simply clicking on it, or you can use the keyboard.
806 The default keybindings to switch tabs (which are Ctrl+PageUp/-Down and Alt+Home,
807 see "Keyboard_Shortcuts_") can be changed using the actions previous_document(),
808 next_document() and last_document().
810 ----------------------------------------------------------------------
815 While plain-text is probably the simplest and most interchangeable file
816 format in the computer world, there is still variation in what plain-text
817 means from system to system. Plain-text files can differ in character set,
818 line termination, and wrapping.
820 While character set differences are the most obvious and pose the most
821 challenge to portability, they affect NEdit only indirectly via the same font
822 and localization mechanisms common to all X applications. If your system is
823 set up properly, you will probably never see character-set related problems
824 in NEdit. NEdit cannot display Unicode text files, nor any multi-byte
827 The primary difference between an MS DOS format file and a Unix format file,
828 is how the lines are terminated. Unix uses a single newline character. MS
829 DOS uses a carriage-return and a newline. NEdit can read and write both file
830 formats, but internally, it uses the single character Unix standard. NEdit
831 auto-detects MS DOS format files based on the line termination at the start
832 of the file. Files are judged to be DOS format if all of the first five line
833 terminators, within a maximum range, are DOS-style. To change the format in
834 which NEdit writes a file from DOS to Unix or visa versa, use the Save As...
835 command and check or un-check the MS DOS Format button.
837 Wrapping within text files can vary among individual users, as well as from
838 system to system. Both Windows and MacOS make frequent use of plain text
839 files with no implicit right margin. In these files, wrapping is determined
840 by the tool which displays them. Files of this style also exist on Unix
841 systems, despite the fact that they are not supported by all Unix utilities.
842 To display this kind of file properly in NEdit, you have to select the wrap
843 style called Continuous. Wrapping modes are discussed in the sections:
844 Customizing -> Preferences, and Basic Operation -> Shifting and Filling.
846 The last and most minute of format differences is the terminating newline.
847 Some Unix compilers and utilities require a final terminating newline on all
848 files they read and fail in various ways on files which do not have it. Vi
849 and approximately half of Unix editors enforce the terminating newline on all
850 files that they write; Emacs does not enforce this rule. Users are divided
851 on which is best. NEdit makes the final terminating newline optional
852 (Preferences -> Default Settings -> Terminate with Line Break on Save).
853 ----------------------------------------------------------------------
855 Features for Programming
856 ========================
858 Programming with NEdit
859 ----------------------
861 Though general in appearance, NEdit has many features intended specifically
862 for programmers. Major programming-related topics are listed in separate
863 sections under the heading: "Features for Programming": Syntax_Highlighting_,
864 Tabs/Emulated_Tabs_, Finding_Declarations_(ctags)_, Calltips_, and
865 Auto/Smart_Indent_. Minor topics related to programming are discussed below:
869 When NEdit initially reads a file, it attempts to determine whether the file
870 is in one of the computer languages that it knows about. Knowing what language
871 a file is written in allows NEdit to assign highlight patterns and smart indent
872 macros, and to set language specific preferences like word delimiters, tab
873 emulation, and auto-indent. Language mode can be recognized from both the file
874 name and from the first 200 characters of content. Language mode recognition
875 and language-specific preferences are configured in: Preferences -> Default
876 Settings -> Language Modes....
878 You can set the language mode manually for a window, by selecting it from the
879 menu: Preferences -> Language Modes.
881 3>Backlighting [EXPERIMENTAL]
883 NEdit can be made to set the background color of particular classes of
884 characters to allow easy identification of those characters. This is
885 particularly useful if you need to be able to distinguish between tabs
886 and spaces in a file where the difference is important. The colors used
887 for backlighting are specified by a resource, "nedit*backlightCharTypes".
888 You can turn backlighting on and off through the
889 Preferences -> Apply Backlighting menu entry.
891 If you prefer to have backlighting turned on for all new windows, use
892 the Preferences -> Default Settings -> Apply Backlighting menu entry.
893 This settings can be saved along with other preferences using
894 Preferences -> Save Defaults.
896 **Important:** In future versions of NEdit, the backlighting feature will be
897 extended and reworked such that it becomes easier to configure. The current
898 way of controlling it through a resource is generally considered to be below
899 NEdit's usability standards. These future changes are likely to be
900 incompatible with the current format of the "nedit*backlightCharTypes"
901 resource, though. Therefore, it is expected that there will be no automatic
902 migration path for users who customize the resource.
906 To find a particular line in a source file by line number, choose Goto Line
907 #... from the Search menu. You can also directly select the line number text
908 in the compiler message in the terminal emulator window (xterm, decterm,
909 winterm, etc.) where you ran the compiler, and choose Goto Selected from the
912 To find out the line number of a particular line in your file, turn on
913 Statistics Line in the Preferences menu and position the insertion point
914 anywhere on the line. The statistics line continuously updates the line number
915 of the line containing the cursor.
917 To go to a specific column on a given line, choose Goto Line #... from the
918 Search menu and enter a line number and a column number separated by a
919 comma. (e.g. Enter "100,12" for line 100 column 12.) If you want to go to
920 a column on the current line just leave out the line number. (e.g. Enter
921 ",45" to go the column 45 on the current line.)
923 3>Matching Parentheses
925 To help you inspect nested parentheses, brackets, braces, quotes, and other
926 characters, NEdit has both an automatic parenthesis matching mode, and a Goto
927 Matching command. Automatic parenthesis matching is activated when you type,
928 or move the insertion cursor after a parenthesis, bracket, or brace. It
929 momentarily highlights either the opposite character ('Delimiter') or the
930 entire expression ('Range') when the opposite character is visible in the
931 window. To find a matching character anywhere in the file, select it or
932 position the cursor after it, and choose Goto Matching from the Search menu.
933 If the character matches itself, such as a quote or slash, select the first
934 character of the pair. NEdit will match {, (, [, <, ", ', `, /, and \.
935 Holding the Shift key while typing the accelerator key (Shift+Ctrl+M, by
936 default), will select all of the text between the matching characters.
938 When syntax highlighting is enabled, the matching routines can optionally
939 make use of the syntax information for improved accuracy. In that case,
940 a brace inside a highlighted string will not match a brace inside a comment,
943 3>Opening Included Files
945 The Open Selected command in the File menu understands the C preprocessor's
946 #include syntax, so selecting an #include line and invoking Open Selected will
947 generally find the file referred to, unless doing so depends on the settings of
948 compiler switches or other information not available to NEdit.
950 3>Interface to Programming Tools
952 Integrated software development environments such as SGI's CaseVision and
953 Centerline Software's Code Center, can be interfaced directly with NEdit via
954 the client server interface. These tools allow you to click directly on
955 compiler and runtime error messages and request NEdit to open files, and select
956 lines of interest. The easiest method is usually to use the tool's interface
957 for character-based editors like vi, to invoke nc, but programmatic interfaces
958 can also be derived using the source code for nc.
960 There are also some simple compile/review, grep, ctree, and ctags browsers
961 available in the NEdit contrib directory on ftp.nedit.org.
962 ----------------------------------------------------------------------
967 3>Changing the Tab Distance
969 Tabs are important for programming in languages which use indentation to show
970 nesting, as short-hand for producing white-space for leading indents. As a
971 programmer, you have to decide how to use indentation, and how or whether tab
972 characters map to your indentation scheme.
974 Ideally, tab characters map directly to the amount of indent that you use to
975 distinguish nesting levels in your code. Unfortunately, the Unix standard
976 for interpretation of tab characters is eight characters (probably dating
977 back to mechanical capabilities of the original teletype), which is usually
978 too coarse for a single indent.
980 Most text editors, NEdit included, allow you to change the interpretation of
981 the tab character, and many programmers take advantage of this, and set their
982 tabs to 3 or 4 characters to match their programming style. In NEdit you set
983 the hardware tab distance in Preferences -> Tabs... for the current window,
984 or Preferences -> Default Settings -> Tabs... (general), or Preferences ->
985 Default Settings -> Language Modes... (language-specific) to change the
986 defaults for future windows.
988 Changing the meaning of the tab character makes programming much easier while
989 you're in the editor, but can cause you headaches outside of the editor,
990 because there is no way to pass along the tab setting as part of a plain-text
991 file. All of the other tools which display, print, and otherwise process
992 your source code have to be made aware of how the tabs are set, and must be
993 able to handle the change. Non-standard tabs can also confuse other
994 programmers, or make editing your code difficult for them if their text
995 editors don't support changes in tab distance.
999 An alternative to changing the interpretation of the tab character is tab
1000 emulation. In the Tabs... dialog(s), turning on Emulated Tabs causes the Tab
1001 key to insert the correct number of spaces and/or tabs to bring the cursor
1002 the next emulated tab stop, as if tabs were set at the emulated tab distance
1003 rather than the hardware tab distance. Backspacing immediately after entering
1004 an emulated tab will delete the fictitious tab as a unit, but as soon as you
1005 move the cursor away from the spot, NEdit will forget that the collection of
1006 spaces and tabs is a tab, and will treat it as separate characters. To enter
1007 a real tab character with "Emulate Tabs" turned on, use Ctrl+Tab.
1009 It is also possible to tell NEdit not to insert ANY tab characters at all in
1010 the course of processing emulated tabs, and in shifting and rectangular
1011 insertion/deletion operations, for programmers who worry about the
1012 misinterpretation of tab characters on other systems.
1013 ----------------------------------------------------------------------
1017 .. The following Tabs Dialog and Customize Window Title Dialog sections
1018 .. should only appear in the online documentation, and not in any of
1019 .. the other possible forms. The rationale is that they are not directly
1020 .. obtained from the Help menu, but are buried in preference dialogs.
1026 .. The Tabs dialog controls both the operation of the Tab key, and
1027 .. the interpretation of tab characters within a file.
1029 .. The first field, Tab Spacing, controls how NEdit responds to
1030 .. tab characters in a file. On most Unix and VMS systems the
1031 .. conventional interpretation of a tab character is to advance the
1032 .. text position to the nearest multiple of eight characters (a tab
1033 .. spacing of 8). However, many programmers of C and other
1034 .. structured languages, when given the choice, prefer a tab
1035 .. spacing of 3 or 4 characters. Setting a three or four character
1036 .. hardware tab spacing is useful and convenient as long as your
1037 .. other software tools support it. Unfortunately, on Unix and VMS
1038 .. systems, system utilities, such as more, and printing software
1039 .. can't always properly display files with other than eight
1042 .. Selecting "Emulate Tabs" will cause the Tab key to insert the
1043 .. correct number of spaces or tabs to reach the next tab stop, as
1044 .. if the tab spacing were set at the value in the "Emulated tab
1045 .. spacing" field. Backspacing immediately after entering an
1046 .. emulated tab will delete it as a unit, but as soon as you move
1047 .. the cursor away from the spot, NEdit will forget that the
1048 .. collection of spaces and tabs is a tab, and will treat it as
1049 .. separate characters. To enter a real tab character with
1050 .. "Emulate Tabs" turned on, use Ctrl+Tab.
1052 .. In generating emulated tabs, and in Shift Left, Paste Column,
1053 .. and some rectangular selection operations, NEdit inserts blank
1054 .. characters (spaces or tabs) to preserve the alignment of
1055 .. non-blank characters. The bottom toggle button in the Tabs
1056 .. dialog instructs NEdit whether to insert tab characters as
1057 .. padding in such situations. Turning this off, will keep NEdit
1058 .. from automatically inserting tabs. Some software developers
1059 .. prefer to keep their source code free of tabs to avoid its
1060 .. misinterpretation on systems with different tab character
1062 .. ----------------------------------------------------------------------
1064 .. Customize Window Title Dialog
1065 .. -----------------------------
1067 .. The Customize Window Title dialog allows you to customize
1068 .. and test the way information will be displayed in each window's
1071 .. **Definition of the title**
1073 .. The upper half of the dialog can be used to select the various
1074 .. components that should be displayed in the title. The layout can be
1075 .. fine-tuned by editing the printf() like format string below the
1076 .. component buttons: additional characters can be entered, or the
1077 .. order can be changed.
1079 .. The following sequences are interpreted in the format string:
1081 .. %c ClearCase view tag (only relevant when NEdit is
1082 .. used together with ClearCase)
1083 .. %[n]d directory, with one optional numeric digit n
1084 .. specifying the maximum number of trailing directory
1085 .. components to display. Skipped components are
1086 .. replaced by an ellipsis (...).
1087 .. %f file name, without the path name
1089 .. %s NEdit server name (server mode only)
1090 .. %[*]S file status, either verbose (%S) or brief (%*S).
1091 .. In verbose mode the file status is spelled out:
1092 .. read-only, locked, and modified. In brief mode,
1093 .. abbreviations and an asterisk are used for the
1094 .. respective states: RO, LO, *.
1097 .. The format string and the component buttons are continously synchronized.
1099 .. The default format is:
1101 .. {%c} [%s] %f (%S) - %d
1103 .. The resulting title will only contain elements with
1104 .. a value. Hence, the title is compressed as follows:
1106 .. * Elements with no value are removed.
1107 .. * Empty parenthesis pairs i.e. (), [] or {}, or parenthesis pairs containing only space(s), are removed.
1108 .. * Sequences of spaces are replaced with one space.
1109 .. * Leading spaces and dashes are removed.
1110 .. * Trailing spaces and dashes are removed.
1112 .. If the server name and the ClearCase view tag are identical, only
1113 .. the first one specified in the format string will be displayed.
1115 .. **Previewing the settings**
1117 .. The lower part of the dialog can be used to test the selected title
1118 .. under various conditions. For some of the components that are selected
1119 .. for display, various states can be enforced on the preview.
1121 .. For instance, components that are not always active (such the
1122 .. NEdit server name) can be turned on or off in the preview.
1129 Programmers who use structured languages usually require some form of
1130 automatic indent, so that they don't have to continually re-type the
1131 sequences of tabs and/or spaces needed to maintain lengthy running indents.
1132 NEdit therefore offers "smart" indent, in addition to the traditional
1133 automatic indent which simply lines up the cursor position with the previous
1138 Smart indent macros are only available by default for C and C++, and while
1139 these can easily be configured for different default indentation distances,
1140 they may not conform to everyone's exact C programming style. Smart indent
1141 is programmed in terms of macros in the NEdit macro language which can be
1142 entered in: Preferences -> Default Settings -> Indent -> Program Smart
1143 Indent. Hooks are provided for intervening at the point that a newline is
1144 entered, either via the user pressing the Enter key, or through
1145 auto-wrapping; and for arbitrary type-in to act on specific characters typed.
1147 To type a newline character without invoking smart-indent when operating in
1148 smart-indent mode, hold the Shift key while pressing the Return or Enter key.
1152 With Indent set to Auto (the default), NEdit keeps a running indent. When
1153 you press the Return or Enter key, spaces and tabs are inserted to line up
1154 the insert point under the start of the previous line.
1156 Regardless of indent-mode, Ctrl+Return always does the automatic indent;
1157 Shift+Return always does a return without indent.
1159 3>Block Indentation Adjustment
1161 The Shift Left and Shift Right commands as well as rectangular dragging can
1162 be used to adjust the indentation for several lines at once. To shift a
1163 block of text one character to the right, select the text, then choose Shift
1164 Right from the Edit menu. Note that the accelerator keys for these menu
1165 items are Ctrl+9 and Ctrl+0, which correspond to the right and left
1166 parenthesis on most keyboards. Remember them as adjusting the text in the
1167 direction pointed to by the parenthesis character. Holding the Shift key
1168 while selecting either Shift Left or Shift Right will shift the text by one
1169 tab stop (or by one emulated tab stop if tab emulation is turned on). The
1170 help section "Shifting and Filling" under "Basic Operation" has details.
1171 ----------------------------------------------------------------------
1176 Syntax Highlighting means using colors and fonts to help distinguish language
1177 elements in programming languages and other types of structured files.
1178 Programmers use syntax highlighting to understand code faster and better, and
1179 to spot many kinds of syntax errors more quickly.
1181 To use syntax highlighting in NEdit, select Highlight Syntax in the
1182 Preferences menu. If NEdit recognizes the computer language that you are
1183 using, and highlighting rules (patterns) are available for that language, it
1184 will highlight your text, and maintain the highlighting, automatically, as
1187 If NEdit doesn't correctly recognize the type of the file you are editing,
1188 you can manually select a language mode from Language Modes in the
1189 Preferences menu. You can also program the method that NEdit uses to
1190 recognize language modes in Preferences -> Default Settings -> Language
1193 If no highlighting patterns are available for the language that you want to
1194 use, you can create new patterns relatively quickly. The Help section
1195 "Highlighting_Patterns_" under "Customizing", has details.
1197 If you are satisfied with what NEdit is highlighting, but would like it to
1198 use different colors or fonts, you can change these by selecting Preferences
1199 -> Default Settings -> Syntax Highlighting -> Text Drawing Styles.
1200 Highlighting patterns are connected with font and color information through a
1201 common set of styles so that colorings defined for one language will be
1202 similar across others, and patterns within the same language which are meant
1203 to appear identical can be changed in the same place. To understand which
1204 styles are used to highlight the language you are interested in, you may need
1205 to look at "Highlighting_Patterns_" section, as well.
1207 Syntax highlighting is CPU intensive, and under some circumstances can affect
1208 NEdit's responsiveness. If you have a particularly slow system, or work with
1209 very large files, you may not want to use it all of the time. Syntax
1210 highlighting introduces two kinds of delays. The first is an initial parsing
1211 delay, proportional to the size of the file. This delay is also incurred
1212 when pasting large sections of text, filtering text through shell commands,
1213 and other circumstances involving changes to large amounts of text. The
1214 second kind of delay happens when text which has not previously been visible
1215 is scrolled in to view. Depending on your system, and the highlight patterns
1216 you are using, this may or may not be noticeable. A typing delay is also
1217 possible, but unlikely if you are only using the built-in patterns.
1218 ----------------------------------------------------------------------
1220 Finding Declarations (ctags)
1221 ----------------------------
1223 NEdit can process tags files generated using the Unix _ctags command or the
1224 Exuberant Ctags program. Ctags creates index files correlating names of
1225 functions and declarations with their locations in C, Fortran, or Pascal source
1226 code files. (See the ctags manual page for more information). Ctags produces a
1227 file called "tags" which can be loaded by NEdit. NEdit can manage any number
1228 of tags files simultaneously. Tag collisions are handled with a popup menu to
1229 let the user decide which tag to use. In 'Smart' mode NEdit will automatically
1230 choose the desired tag based on the scope of the file or module. Once loaded,
1231 the information in the tags file enables NEdit to go directly to the
1232 declaration of a highlighted function or data structure name with a single
1233 command. To load a tags file, select "Load Tags File" from the File menu and
1234 choose a tags file to load, or specify the name of the tags file on the NEdit
1239 NEdit can also be set to load a tags file automatically when it starts up.
1240 Setting the X resource nedit.tagFile to the name of a tag file tells NEdit to
1241 look for that file at startup time (see "Customizing_NEdit_"). The file name
1242 can be either a complete path name, in which case NEdit will always load the
1243 same tags file, or a file name without a path or with a relative path, in
1244 which case NEdit will load it starting from the current directory. The
1245 second option allows you to have different tags files for different projects,
1246 each automatically loaded depending on the directory you're in when you start
1247 NEdit. Setting the name to "tags" is an obvious choice since this is the
1248 name that ctags uses. NEdit normally evaluates relative path tag file
1249 specifications every time a file is opened. All accessible tag files are
1250 loaded at this time. To disable the automatic loading of tag files specified
1251 as relative paths, set the X resource nedit.alwaysCheckRelativeTagsSpecs to
1254 To unload a tags file, select "Un-load Tags File" from the File menu and
1255 choose from the list of tags files. NEdit will keep track of tags file updates
1256 by checking the timestamp on the files, and automatically update the tags
1259 To find the definition of a function or data structure once a tags file is
1260 loaded, select the name anywhere it appears in your program (see
1261 "Selecting_Text_") and choose "Find Definition" from the Search menu.
1262 ----------------------------------------------------------------------
1267 Calltips are little yellow boxes that pop up to remind you what the arguments
1268 and return type of a function are. More generally, they're a UI mechanism to
1269 present a small amount of crucial information in a prominent location. To
1270 display a calltip, select some text and choose "Show Calltip" from the Search
1271 menu. To kill a displayed calltip, hit Esc.
1273 Calltips get their information from one of two places -- either a tags file (see
1274 "Finding_Declarations_(ctags)_") or a calltips file. First, any loaded calltips
1275 files are searched for a definition, and if nothing is found then the tags
1276 database is searched. If a tag is found that matches the highlighted text then
1277 a calltip is displayed with the first few lines of the definition -- usually
1278 enough to show you what the arguments of a function are.
1280 You can load a calltips file by using choosing "Load Calltips File" from the
1281 File menu. You can unload a calltips file by selecting it from the
1282 "Unload Calltips File" submenu of the File menu. You can also choose one or
1283 more default calltips files to be loaded for each language mode using the
1284 "Default calltips file(s)" field of the Language Modes dialog.
1286 The calltips file format is very simple. calltips files are organized in blocks
1287 separated by blank lines. The first line of the block is the key, which is the
1288 word that is matched when a calltip is requested. The rest of the block is
1289 displayed as the calltip.
1291 Almost any text at all can appear in a calltip key or a calltip. There are no
1292 special characters that need to be escaped. The only issues to note are that
1293 trailing whitespace is ignored, and you cannot have a blank line inside a
1294 calltip. (Use a single period instead -- it'll be nearly invisible.) You should
1295 also avoid calltip keys that begin and end with '@*' characters, since those are
1296 used to mark special blocks.
1298 There are five special block types--comment, include, language, alias, and
1299 version--which are distinguished by their first lines, "@* comment @*",
1300 "@* include @*", "@* language @*", "@* alias @*", and "@* version @*" respectively
1303 Comment blocks are ignored when reading calltips files.
1305 Include blocks specify additional calltips files to load, one per line. The ~
1306 character can be used for your $HOME directory, but other shell shortcuts like
1307 @* and ? can't be used. Include blocks allow you to make a calltips file for your
1308 project that includes, say, the calltips files for C, Motif, and Xt.
1310 Language blocks specify which language mode the calltips should be used with.
1311 When a calltip is requested it won't match tips from languages other than the
1312 current language mode. Language blocks only affect the tips listed after the
1315 Alias blocks allow a calltip to have multiple keys. The first line of the block
1316 is the key for the calltip to be displayed, and the rest of the lines are
1317 additional keys, one per line, that should also show the calltip.
1319 Version blocks are ignored for the time being.
1321 You can use calltips in your own macros using the calltip() and kill_calltip()
1322 macro subroutines and the $calltip_ID macro variable. See the
1323 Macro_Subroutines_ section for details.
1324 ----------------------------------------------------------------------
1329 Basic Regular Expression Syntax
1330 -------------------------------
1332 Regular expressions (regex's) are useful as a way to match inexact sequences
1333 of characters. They can be used in the `Find...' and `Replace...' search
1334 dialogs and are at the core of Color Syntax Highlighting patterns. To specify
1335 a regular expression in a search dialog, simply click on the `Regular
1336 Expression' radio button in the dialog.
1338 A regex is a specification of a pattern to be matched in the searched text.
1339 This pattern consists of a sequence of tokens, each being able to match a
1340 single character or a sequence of characters in the text, or assert that a
1341 specific position within the text has been reached (the latter is called an
1342 anchor.) Tokens (also called atoms) can be modified by adding one of a number
1343 of special quantifier tokens immediately after the token. A quantifier token
1344 specifies how many times the previous token must be matched (see below.)
1346 Tokens can be grouped together using one of a number of grouping constructs,
1347 the most common being plain parentheses. Tokens that are grouped in this way
1348 are also collectively considered to be a regex atom, since this new larger
1349 atom may also be modified by a quantifier.
1351 A regex can also be organized into a list of alternatives by separating each
1352 alternative with pipe characters, `|'. This is called alternation. A match
1353 will be attempted for each alternative listed, in the order specified, until a
1354 match results or the list of alternatives is exhausted (see Alternation_
1357 3>The 'Any' Character
1359 If a dot (`.') appears in a regex, it means to match any character exactly
1360 once. By default, dot will not match a newline character, but this behavior
1361 can be changed (see help topic Parenthetical_Constructs_, under the
1362 heading, Matching Newlines).
1366 A character class, or range, matches exactly one character of text, but the
1367 candidates for matching are limited to those specified by the class. Classes
1368 come in two flavors as described below:
1370 [...] Regular class, match only characters listed.
1371 [^...] Negated class, match only characters ~not~ listed.
1373 As with the dot token, by default negated character classes do not match
1374 newline, but can be made to do so.
1376 The characters that are considered special within a class specification are
1377 different than the rest of regex syntax as follows. If the first character in
1378 a class is the `]' character (second character if the first character is `^')
1379 it is a literal character and part of the class character set. This also
1380 applies if the first or last character is `-'. Outside of these rules, two
1381 characters separated by `-' form a character range which includes all the
1382 characters between the two characters as well. For example, `[^f-j]' is the
1383 same as `[^fghij]' and means to match any character that is not `f', `g',
1388 Anchors are assertions that you are at a very specific position within the
1389 search text. NEdit regular expressions support the following anchor tokens:
1393 < Left word boundary
1394 > Right word boundary
1395 \B Not a word boundary
1397 Note that the \B token ensures that neither the left nor the right character
1398 are delimiters, **or** that both left and right characters are delimiters.
1399 The left word anchor checks whether the previous character is a delimiter and
1400 the next character is not. The right word anchor works in a similar way.
1402 Note that word delimiters are user-settable, and defined by the X resource
1403 wordDelimiters, cf. X_Resources_.
1407 Quantifiers specify how many times the previous regular expression atom may
1408 be matched in the search text. Some quantifiers can produce a large
1409 performance penalty, and can in some instances completely lock up NEdit. To
1410 prevent this, avoid nested quantifiers, especially those of the maximal
1411 matching type (see below.)
1413 The following quantifiers are maximal matching, or "greedy", in that they
1414 match as much text as possible (but don't exclude shorter matches if that
1415 is necessary to achieve an overall match).
1417 * Match zero or more
1421 The following quantifiers are minimal matching, or "lazy", in that they match
1422 as little text as possible (but don't exclude longer matches if that is
1423 necessary to achieve an overall match).
1425 *? Match zero or more
1426 +? Match one or more
1427 ?? Match zero or one
1429 One final quantifier is the counting quantifier, or brace quantifier. It
1430 takes the following basic form:
1432 {min,max} Match from `min' to `max' times the
1433 previous regular expression atom.
1435 If `min' is omitted, it is assumed to be zero. If `max' is omitted, it is
1436 assumed to be infinity. Whether specified or assumed, `min' must be less
1437 than or equal to `max'. Note that both `min' and `max' are limited to
1438 65535. If both are omitted, then the construct is the same as `*'. Note
1439 that `{,}' and `{}' are both valid brace constructs. A single number
1440 appearing without a comma, e.g. `{3}' is short for the `{min,min}' construct,
1441 or to match exactly `min' number of times.
1443 The quantifiers `{1}' and `{1,1}' are accepted by the syntax, but are
1444 optimized away since they mean to match exactly once, which is redundant
1445 information. Also, for efficiency, certain combinations of `min' and `max'
1446 are converted to either `*', `+', or `?' as follows:
1452 Note that {0} and {0,0} are meaningless and will generate an error message at
1453 regular expression compile time.
1455 Brace quantifiers can also be "lazy". For example {2,5}? would try to match
1456 2 times if possible, and will only match 3, 4, or 5 times if that is what is
1457 necessary to achieve an overall match.
1461 A series of alternative patterns to match can be specified by separating them
1462 with vertical pipes, `|'. An example of _alternation would be `a|be|sea'.
1463 This will match `a', or `be', or `sea'. Each alternative can be an
1464 arbitrarily complex regular expression. The alternatives are attempted in
1465 the order specified. An empty alternative can be specified if desired, e.g.
1466 `a|b|'. Since an empty alternative can match nothingness (the empty string),
1467 this guarantees that the expression will match.
1471 Comments are of the form `(?#<comment text>)' and can be inserted anywhere
1472 and have no effect on the execution of the regular expression. They can be
1473 handy for documenting very complex regular expressions. Note that a comment
1474 begins with `(?#' and ends at the first occurrence of an ending parenthesis,
1475 or the end of the regular expression... period. Comments do not recognize
1476 any escape sequences.
1477 ----------------------------------------------------------------------
1482 3>Escaping Metacharacters
1484 In a regular expression (regex), most ordinary characters match themselves.
1485 For example, `ab%' would match anywhere `a' followed by `b' followed by `%'
1486 appeared in the text. Other characters don't match themselves, but are
1487 metacharacters. For example, backslash is a special metacharacter which
1488 'escapes' or changes the meaning of the character following it. Thus, to
1489 match a literal backslash would require a regular expression to have two
1490 backslashes in sequence. NEdit provides the following escape sequences so
1491 that metacharacters that are used by the regex syntax can be specified as
1492 ordinary characters.
1494 \( \) \- \[ \] \< \> \{ \}
1495 \. \| \^ \$ \* \+ \? \& \\
1497 3>Special Control Characters
1499 There are some special characters that are difficult or impossible to type.
1500 Many of these characters can be constructed as a sort of metacharacter or
1501 sequence by preceding a literal character with a backslash. NEdit recognizes
1502 the following special character sequences:
1506 \e ASCII escape character (***)
1507 \f form feed (new page)
1513 *** For environments that use the EBCDIC character set,
1514 when compiling NEdit set the EBCDIC_CHARSET compiler
1515 symbol to get the EBCDIC equivalent escape
1518 3>Octal and Hex Escape Sequences
1520 Any ASCII (or EBCDIC) character, except null, can be specified by using
1521 either an octal escape or a hexadecimal escape, each beginning with \0 or \x
1522 (or \X), respectively. For example, \052 and \X2A both specify the `*'
1523 character. Escapes for null (\00 or \x0) are not valid and will generate an
1524 error message. Also, any escape that exceeds \0377 or \xFF will either cause
1525 an error or have any additional character(s) interpreted literally. For
1526 example, \0777 will be interpreted as \077 (a `?' character) followed by `7'
1527 since \0777 is greater than \0377.
1529 An invalid digit will also end an octal or hexadecimal escape. For example,
1530 \091 will cause an error since `9' is not within an octal escape's range of
1531 allowable digits (0-7) and truncation before the `9' yields \0 which is
1534 3>Shortcut Escape Sequences
1536 NEdit defines some escape sequences that are handy shortcuts for commonly
1537 used character classes.
1540 \l letters a-z, A-Z, and locale dependent letters
1541 \s whitespace \t, \r, \v, \f, and space
1542 \w word characters letters, digits, and underscore, `_'
1544 \D, \L, \S, and \W are the same as the lowercase versions except that the
1545 resulting character class is negated. For example, \d is equivalent to
1546 `[0-9]', while \D is equivalent to `[^0-9]'.
1548 These escape sequences can also be used within a character class. For
1549 example, `[\l_]' is the same as `[a-zA-Z@_]', extended with possible locale
1550 dependent letters. The escape sequences for special characters, and octal
1551 and hexadecimal escapes are also valid within a class.
1553 3>Word Delimiter Tokens
1555 Although not strictly a character class, the following escape sequences
1556 behave similarly to character classes:
1558 \y Word delimiter character
1559 \Y Not a word delimiter character
1561 The `\y' token matches any single character that is one of the characters
1562 that NEdit recognizes as a word delimiter character, while the `\Y' token
1563 matches any character that is ~not~ a word delimiter character. Word
1564 delimiter characters are dynamic in nature, meaning that the user can change
1565 them through preference settings. For this reason, they must be handled
1566 differently by the regular expression engine. As a consequence of this,
1567 `\y' and `\Y' cannot be used within a character class specification.
1568 ----------------------------------------------------------------------
1570 Parenthetical Constructs
1571 ------------------------
1573 3>Capturing Parentheses
1575 Capturing Parentheses are of the form `(<regex>)' and can be used to group
1576 arbitrarily complex regular expressions. Parentheses can be nested, but the
1577 total number of parentheses, nested or otherwise, is limited to 50 pairs.
1578 The text that is matched by the regular expression between a matched set of
1579 parentheses is captured and available for text substitutions and
1580 backreferences (see below.) Capturing parentheses carry a fairly high
1581 overhead both in terms of memory used and execution speed, especially if
1582 quantified by `*' or `+'.
1584 3>Non-Capturing Parentheses
1586 Non-Capturing Parentheses are of the form `(?:<regex>)' and facilitate
1587 grouping only and do not incur the overhead of normal capturing parentheses.
1588 They should not be counted when determining numbers for capturing parentheses
1589 which are used with backreferences and substitutions. Because of the limit
1590 on the number of capturing parentheses allowed in a regex, it is advisable to
1591 use non-capturing parentheses when possible.
1593 3>Positive Look-Ahead
1595 Positive look-ahead constructs are of the form `(?=<regex>)' and implement a
1596 zero width assertion of the enclosed regular expression. In other words, a
1597 match of the regular expression contained in the positive look-ahead
1598 construct is attempted. If it succeeds, control is passed to the next
1599 regular expression atom, but the text that was consumed by the positive
1600 look-ahead is first unmatched (backtracked) to the place in the text where
1601 the positive look-ahead was first encountered.
1603 One application of positive look-ahead is the manual implementation of a
1604 first character discrimination optimization. You can include a positive
1605 look-ahead that contains a character class which lists every character that
1606 the following (potentially complex) regular expression could possibly start
1607 with. This will quickly filter out match attempts that cannot possibly
1610 3>Negative Look-Ahead
1612 Negative look-ahead takes the form `(?!<regex>)' and is exactly the same as
1613 positive look-ahead except that the enclosed regular expression must NOT
1614 match. This can be particularly useful when you have an expression that is
1615 general, and you want to exclude some special cases. Simply precede the
1616 general expression with a negative look-ahead that covers the special cases
1617 that need to be filtered out.
1619 3>Positive Look-Behind
1621 Positive look-behind constructs are of the form `(?<=<regex>)' and implement
1622 a zero width assertion of the enclosed regular expression in front of the
1623 current matching position. It is similar to a positive look-ahead assertion,
1624 except for the fact that the match is attempted on the text preceding the
1625 current position, possibly even in front of the start of the matching range
1626 of the entire regular expression.
1628 A restriction on look-behind expressions is the fact that the expression
1629 must match a string of a bounded size. In other words, `*', `+', and `{n,}'
1630 quantifiers are not allowed inside the look-behind expression. Moreover,
1631 matching performance is sensitive to the difference between the upper and
1632 lower bound on the matching size. The smaller the difference, the better the
1633 performance. This is especially important for regular expressions used in
1636 Positive look-behind has similar applications as positive look-ahead.
1638 3>Negative Look-Behind
1640 Negative look-behind takes the form `(?<!<regex>)' and is exactly the same as
1641 positive look-behind except that the enclosed regular expression must
1642 ~not~ match. The same restrictions apply.
1644 Note however, that performance is even more sensitive to the distance
1645 between the size boundaries: a negative look-behind must not match for
1646 **any** possible size, so the matching engine must check **every** size.
1650 There are two parenthetical constructs that control case sensitivity:
1652 (?i<regex>) Case insensitive; `AbcD' and `aBCd' are
1655 (?I<regex>) Case sensitive; `AbcD' and `aBCd' are
1658 Regular expressions are case sensitive by default, that is, `(?I<regex>)' is
1659 assumed. All regular expression token types respond appropriately to case
1660 insensitivity including character classes and backreferences. There is some
1661 extra overhead involved when case insensitivity is in effect, but only to the
1662 extent of converting each character compared to lower case.
1666 NEdit regular expressions by default handle the matching of newlines in a way
1667 that should seem natural for most editing tasks. There are situations,
1668 however, that require finer control over how newlines are matched by some
1669 regular expression tokens.
1671 By default, NEdit regular expressions will ~not~ match a newline character for
1672 the following regex tokens: dot (`.'); a negated character class (`[^...]');
1673 and the following shortcuts for character classes:
1675 `\d', `\D', `\l', `\L', `\s', `\S', `\w', `\W', `\Y'
1677 The matching of newlines can be controlled for the `.' token, negated
1678 character classes, and the `\s' and `\S' shortcuts by using one of the
1679 following parenthetical constructs:
1681 (?n<regex>) `.', `[^...]', `\s', `\S' match newlines
1683 (?N<regex>) `.', `[^...]', `\s', `\S' don't match
1686 `(?N<regex>)' is the default behavior.
1688 3>Notes on New Parenthetical Constructs
1690 Except for plain parentheses, none of the parenthetical constructs capture
1691 text. If that is desired, the construct must be wrapped with capturing
1692 parentheses, e.g. `((?i<regex))'.
1694 All parenthetical constructs can be nested as deeply as desired, except for
1695 capturing parentheses which have a limit of 50 sets of parentheses,
1696 regardless of nesting level.
1700 Backreferences allow you to match text captured by a set of capturing
1701 parenthesis at some later position in your regular expression. A
1702 backreference is specified using a single backslash followed by a single
1703 digit from 1 to 9 (example: \3). Backreferences have similar syntax to
1704 substitutions (see below), but are different from substitutions in that they
1705 appear within the regular expression, not the substitution string. The number
1706 specified with a backreference identifies which set of text capturing
1707 parentheses the backreference is associated with. The text that was most
1708 recently captured by these parentheses is used by the backreference to
1709 attempt a match. As with substitutions, open parentheses are counted from
1710 left to right beginning with 1. So the backreference `\3' will try to match
1711 another occurrence of the text most recently matched by the third set of
1712 capturing parentheses. As an example, the regular expression `(\d)\1' could
1713 match `22', `33', or `00', but wouldn't match `19' or `01'.
1715 A backreference must be associated with a parenthetical expression that is
1716 complete. The expression `(\w(\1))' contains an invalid backreference since
1717 the first set of parentheses are not complete at the point where the
1718 backreference appears.
1722 Substitution strings are used to replace text matched by a set of capturing
1723 parentheses. The substitution string is mostly interpreted as ordinary text
1726 The escape sequences described above for special characters, and octal and
1727 hexadecimal escapes are treated the same way by a substitution string. When
1728 the substitution string contains the `&' character, NEdit will substitute the
1729 entire string that was matched by the `Find...' operation. Any of the first
1730 nine sub-expressions of the match string can also be inserted into the
1731 replacement string. This is done by inserting a `\' followed by a digit from
1732 1 to 9 that represents the string matched by a parenthesized expression
1733 within the regular expression. These expressions are numbered left-to-right
1734 in order of their opening parentheses.
1736 The capitalization of text inserted by `&' or `\1', `\2', ... `\9' can be
1737 altered by preceding them with `\U', `\u', `\L', or `\l'. `\u' and `\l'
1738 change only the first character of the inserted entity, while `\U' and `\L'
1739 change the entire entity to upper or lower case, respectively.
1740 ----------------------------------------------------------------------
1747 Regular expression substitution can be used to program automatic editing
1748 operations. For example, the following are search and replace strings to find
1749 occurrences of the `C' language subroutine `get_x', reverse the first and
1750 second parameters, add a third parameter of NULL, and change the name to
1753 Search string: `get_x *\( *([^ ,]*), *([^\)]*)\)'
1754 Replace string: `new_get_x(\2, \1, NULL)'
1758 If a regular expression could match two different parts of the text, it will
1759 match the one which begins earliest. If both begin in the same place but
1760 match different lengths, or match the same length in different ways, life
1761 gets messier, as follows.
1763 In general, the possibilities in a list of alternatives are considered in
1764 left-to-right order. The possibilities for `*', `+', and `?' are considered
1765 longest-first, nested constructs are considered from the outermost in, and
1766 concatenated constructs are considered leftmost-first. The match that will be
1767 chosen is the one that uses the earliest possibility in the first choice that
1768 has to be made. If there is more than one choice, the next will be made in
1769 the same manner (earliest possibility) subject to the decision on the first
1770 choice. And so forth.
1772 For example, `(ab|a)b*c' could match `abc' in one of two ways. The first
1773 choice is between `ab' and `a'; since `ab' is earlier, and does lead to a
1774 successful overall match, it is chosen. Since the `b' is already spoken for,
1775 the `b*' must match its last possibility, the empty string, since it must
1776 respect the earlier choice.
1778 In the particular case where no `|'s are present and there is only one `*',
1779 `+', or `?', the net effect is that the longest possible match will be
1780 chosen. So `ab*', presented with `xabbbby', will match `abbbb'. Note that
1781 if `ab*' is tried against `xabyabbbz', it will match `ab' just after `x', due
1782 to the begins-earliest rule. (In effect, the decision on where to start the
1783 match is the first choice to be made, hence subsequent choices must respect
1784 it even if this leads them to less-preferred alternatives.)
1788 An excellent book on the care and feeding of regular expressions is
1790 Mastering Regular Expressions, 3rd Edition
1791 Jeffrey E. F. Friedl
1792 August 2006, O'Reilly & Associates
1795 The first end second editions of this book are still useful for basic
1796 introduction to regexes and contain many useful tips and tricks.
1797 ----------------------------------------------------------------------
1799 Example Regular Expressions
1800 ---------------------------
1802 The following are regular expression examples which will match:
1810 * Whitespace on a line.
1813 * Whitespace across lines.
1816 * Whitespace that spans at least two lines. Note minimal matching `*?' quantifier.
1819 * IP address (not robust).
1820 ! (?:\d{1,3}(?:\.\d{1,3}){3})
1822 * Two character US Postal state abbreviations (includes territories).
1823 ! [ACDF-IK-PR-W][A-Z]
1826 ! (?:http://)?www\.\S+
1828 * Case insensitive double words across line breaks.
1829 ! (?i(?n<(\S+)\s+\1>))
1831 * Upper case words with possible punctuation.
1834 ----------------------------------------------------------------------
1836 Macro/Shell Extensions
1837 ======================
1839 Shell Commands and Filters
1840 --------------------------
1842 The Shell menu (Unix versions only) allows you to execute Unix shell commands
1843 from within NEdit. You can add items to the menu to extend NEdit's command
1844 set or to incorporate custom automatic editing features using shell commands
1845 or editing languages like awk and sed. To add items to the menu, select
1846 Preferences -> Default Settings Customize Menus -> Shell Menu. NEdit comes
1847 pre-configured with a few useful Unix commands like spell and sort, but we
1848 encourage you to add your own custom extensions.
1850 Filter Selection... prompts you for a Unix command to use to process the
1851 currently selected text. The output from this command replaces the contents
1854 Execute Command... prompts you for a Unix command and replaces the current
1855 selection with the output of the command. If there is no selection, it
1856 deposits the output at the current insertion point. In the Shell Command
1857 field, the % character expands to the name (including directory path), and
1858 the # character expands to the current line number of the file in the window.
1859 To include a % or # character in the command, use %% or ##, respectively.
1861 Execute Command Line uses the position of the cursor in the window to
1862 indicate a line to execute as a shell command line. The cursor may be
1863 positioned anywhere on the line. This command allows you to use an NEdit
1864 window as an editable command window for saving output and saving commands
1865 for re-execution. Note that the same character expansions described above
1866 in Execute Command also occur with this command.
1868 The X resource called nedit.shell (See "Customizing_NEdit_") determines which
1869 Unix shell is used to execute commands. The default value for this resource
1870 is the user's login shell.
1871 ----------------------------------------------------------------------
1876 Selecting Learn Keystrokes from the Macro menu puts NEdit in learn mode. In
1877 learn mode, keystrokes and menu commands are recorded, to be played back
1878 later, using the Replay Keystrokes command, or pasted into a macro in the
1879 Macro Commands dialog of the Default Settings menu in Preferences.
1881 Note that only keyboard and menu commands are recorded, not mouse clicks or
1882 mouse movements since these have no absolute point of reference, such as
1883 cursor or selection position. When you do a mouse-based operation in learn
1884 mode, NEdit will beep (repeatedly) to remind you that the operation was not
1887 Learn mode is also the quickest and easiest method for writing macros. The
1888 dialog for creating macro commands contains a button labeled "Paste Learn /
1889 Replay Macro", which will deposit the last sequence learned into the body of
1892 3>Repeating Actions and Learn/Replay Sequences
1894 You can repeat the last (keyboard-based) command, or learn/replay sequence
1895 with the Repeat... command in the Macro menu. To repeat an action, first do
1896 the action (that is, insert a character, do a search, move the cursor), then
1897 select Repeat..., decide how or how many times you want it repeated, and
1898 click OK. For example, to move down 30 lines through a file, you could type:
1899 <Down Arrow> Ctrl+, 29 <Return>. To repeat a learn/replay sequence, first
1900 learn it, then select Repeat..., click on Learn/Replay and how you want it
1901 repeated, then click OK.
1903 If the commands you are repeating advance the cursor through the file, you
1904 can also repeat them within a range of characters, or from the current cursor
1905 position to the end of the file. To iterate over a range of characters, use
1906 the primary selection (drag the left mouse button over the text) to mark the
1907 range you want to operate on, and select "In Selection" in the Repeat dialog.
1909 When using In "Selection" or "To End" with a learned sequence, try to do
1910 cursor movement as the last step in the sequence, since testing of the cursor
1911 position is only done at the end of the sequence execution. If you do cursor
1912 movement first, for example searching for a particular word then doing a
1913 modification, the position of the cursor won't be checked until the sequence
1914 has potentially gone far beyond the end of your desired range.
1916 It's easy for a repeated command to get out of hand, and you can easily
1917 generate an infinite loop by using range iteration on a command which doesn't
1918 progress. To cancel a repeating command in progress, type Ctrl+. (period),
1919 or select Cancel Macro from the Macro menu.
1920 ----------------------------------------------------------------------
1925 Macros can be called from Macro menu commands, window background menu
1926 commands, within the smart-indent framework, from the autoload macro file,
1927 cf. Preferences_, and from the command line.
1928 Macro menu and window background menu commands are defined under Preferences
1929 -> Default Settings -> Customize Menus. Help on creating items in these
1930 menus can be found in the section Preferences_.
1932 NEdit's macro language is a simple interpreter with integer arithmetic,
1933 dynamic strings, and C-style looping constructs (very similar to the
1934 procedural portion of the Unix awk program). From the macro language, you
1935 can call the same action routines which are bound to keyboard keys and menu
1936 items, as well additional subroutines for accessing and manipulating editor
1937 data, which are specific to the macro language (these are listed in the
1938 sections titled "Macro_Subroutines_", and "Action_Routines_").
1943 An NEdit macro language program consists of a list of statements, each
1944 terminated by a newline. Groups of statements which are executed together
1945 conditionally, such as the body of a loop, are surrounded by curly braces
1948 Blank lines and comments are also allowed. Comments begin with a "#" and end
1949 with a newline, and can appear either on a line by themselves, or at the end
1952 Statements which are too long to fit on a single line may be split across
1953 several lines, by placing a backslash "\" character at the end of each line
1959 The NEdit macro language recognizes only three data types, dynamic character
1960 strings, integer values and associative arrays. In general strings and
1961 integers can be used interchangeably. If a string represents an integer
1962 value, it can be used as an integer. Integers can be compared and
1963 concatenated with strings. Arrays may contain integers, strings, or arrays.
1964 Arrays are stored key/value pairs. Keys are always stored as strings.
1968 Integers are non-fractional numbers in the range of -2147483647 to
1969 2147483647. Integer constants must be in decimal. For example:
1974 4>Character String Constants
1976 Character string constants are enclosed in double quotes. For example:
1979 dialog("Hi there!", "OK")
1981 Strings may also include C-language style escape sequences:
1983 \\ Backslash \t Tab \f Form feed
1984 \" Double quote \b Backspace \a Alert
1985 \n Newline \r Carriage return \v Vertical tab
1987 Also allowed is the escape control character sequence:
1989 \e Escape (ASCII or EBCDIC,
1990 depending on NEdit compilation settings)
1992 For example, to send output to the terminal from which NEdit was started, a
1993 newline character is necessary because, like printf, t_print requires
1994 explicit newlines, and also buffers its output on a per-line basis:
1996 t_print("a = " a "\n")
1998 Other characters can be expressed as backslash-escape sequences in macro
1999 strings. The format is the same as for regular expressions, described in the
2000 paragraphs headed "Octal and Hex Escape Sequences" of the section
2001 "Metacharacters_", except that an octal escape sequence can start with any
2002 octal digit, not just 0, so the single character string "\0033" is the same
2003 as "\33", "\x1B" and "\e" (for an ASCII version of NEdit).
2005 Note that if you want to define a regular expression in a macro string,
2006 you need to "double-up" the backslashes for the metacharacters with
2007 special meaning in regular expressions. For example, the expression
2009 (?N(\s|/\*(?n(?:(?!\*/).)*)\*/|//.*\n|\n)+)
2011 which matches whitespace or C/C++/Java-style comments, should be written as
2014 "(?N(\\s|/\\*(?n(?:(?!\\*/).)*)\\*/|//.*\n|\n)+)"
2016 (The "\n"s towards the end add literal newline characters to the string. The
2017 regular expression interpretation treats the newlines as themselves. It can
2018 also interpret the sequence "\\n" as a newline, although the macro string here
2019 would then contain a literal backslash followed by a lowercase `N'.)
2024 Variable names must begin either with a letter (local variables), or a $
2025 (global variables). Beyond the first character, variables may also contain
2026 numbers and underscores `_'. Variables are called in to existence just by
2027 setting them (no explicit declarations are necessary).
2029 Local variables are limited in scope to the subroutine (or menu item
2030 definition) in which they appear. Global variables are accessible from all
2031 routines, and their values persist beyond the call which created them, until
2034 4>Built-in Variables
2036 NEdit has a number of permanently defined variables, which are used to access
2037 global editor information and information about the window in which the
2038 macro is executing. These are listed along with the built in functions in
2039 the section titled "Macro_Subroutines_".
2042 3>Functions and Subroutines
2044 The syntax of a function or subroutine call is:
2046 function_name(arg1, arg2, ...)
2048 where arg1, arg2, etc. represent the argument values which are passed to
2049 the routine being called. A function or subroutine call can be on a line by
2050 itself, as above, or if it returns a value, can be invoked within a character
2051 or numeric expression:
2053 a = fn1(b, c) + fn2(d)
2054 dialog("fn3 says: " fn3())
2056 Arguments are passed by value. This means that you cannot return values via
2057 the argument list, only through the function value or indirectly through
2058 agreed-upon global variables.
2060 4>Built-in Functions
2062 NEdit has a wide range of built in functions which can be called from the
2063 macro language. These routines are divided into two classes, macro-language
2064 functions, and editor action routines. Editor action routines are more
2065 flexible, in that they may be called either from the macro language, or bound
2066 directly to keys via translation tables. They are also limited, however, in
2067 that they cannot return values. Macro language routines can return values,
2068 but cannot be bound to keys in translation tables.
2070 Nearly all of the built-in subroutines operate on an implied window, which is
2071 initially the window from which the macro was started. To manipulate the
2072 contents of other windows, use the focus_window subroutine to change the
2073 focus to the ones you wish to modify. focus_window can also be used to
2074 iterate over all of the currently open windows, using the special keyword
2075 names, "last" and "next".
2077 For backwards compatibility, hyphenated action routine names are allowed, and
2078 most of the existing action routines names which contain underscores have an
2079 equivalent version containing hyphens ('-') instead of underscores. Use of
2080 these names is discouraged. The macro parser resolves the ambiguity between
2081 '-' as the subtraction/negation operator, and - as part of an action routine
2082 name by assuming subtraction unless the symbol specifically matches an action
2085 4>User Defined Functions
2087 Users can define their own macro subroutines, using the define keyword:
2089 define subroutine_name {
2090 < body of subroutine >
2093 Subroutine definitions cannot appear within other definitions, nor within
2094 macro menu item definitions. They can only appear in (macro) files, such as
2095 the autoload macro file, cf. Preferences_. Macro files can be loaded with
2096 File -> Load Macro File or with the load_macro_file() action.
2098 The arguments with which a user-defined subroutine or function was invoked,
2099 are presented as $1, $2, ... , $9 or $args[expr], where expr can be evaluated
2100 to an integer from 1 to the number of arguments. The number of arguments can
2101 be read from $n_args or $args[]. The array $args[expr] is the only way to
2102 access arguments beyond the first 9.
2104 To return a value from a subroutine, and/or to exit from the subroutine
2105 before the end of the subroutine body, use the return statement:
2107 return <value to return>
2110 3>Operators and Expressions
2112 Operators have the same meaning and precedence that they do in C, except for
2113 ^, which raises a number to a power (y^x means y to the x power), rather than
2114 bitwise exclusive OR. The table below lists operators in decreasing order of
2117 Operators Associativity
2123 > >= < <= == != left to right
2128 (concatenation) left to right
2129 = += -= *= /= %=, &= |= right to left
2131 The order in which operands are evaluated in an expression is undefined,
2132 except for && and ||, which like C, evaluate operands left to right, but stop
2133 when further evaluation would no longer change the result.
2135 4>Numerical Operators
2137 The numeric operators supported by the NEdit macro language are listed below:
2140 - subtraction or negation
2148 Increment (++) and decrement (--) operators can also be appended or prepended
2149 to variables within an expression. Prepended increment/decrement operators
2150 act before the variable is evaluated. Appended increment/decrement operators
2151 act after the variable is evaluated.
2153 4>Logical and Comparison Operators
2155 Logical operations produce a result of 0 (for false) or 1 (for true). In a
2156 logical operation, any non-zero value is recognized to mean true. The
2157 logical and comparison operators allowed in the NEdit macro language are
2167 == equal (integers and/or strings)
2168 != not equal (integers and/or strings)
2170 4>Character String Operators
2172 The "operator" for concatenating two strings is the absence of an operator.
2173 Adjoining character strings with no operator in between means concatenation:
2176 t_print("the value of a is: " a)
2178 Comparison between character strings is done with the == and != operators,
2179 (as with integers). There are a number of useful built-in routines for
2180 working with character strings, which are listed in the section called
2181 "Macro_Subroutines_".
2183 4>Arrays and Array Operators
2185 Arrays may contain either strings, integers, or other arrays. Arrays are
2186 associative, which means that they relate two pieces of information, the key
2187 and the value. The key is always a string; if you use an integer it is
2188 converted to a string.
2190 To determine if a given key is in an array, use the 'in' keyword.
2195 If the left side of the in keyword is an array, the result is true if every
2196 key in the left array is in the right array. Array values are not compared.
2198 To iterate through all the keys of an array use the 'for' looping construct.
2199 Keys are not guaranteed in any particular order:
2204 Elements can be removed from an array using the delete command:
2206 delete x[3] # deletes element with key 3
2207 delete x[] # deletes all elements
2209 The number of elements in an array can be determined by referencing the
2210 array with no indices:
2212 dialog("array x has " x[] " elements", "OK")
2214 Arrays can be combined with some operators. All the following operators only
2215 compare the keys of the arrays.
2217 result = x + y (Merge arrays)
2219 The 'result' is a new array containing keys from both x and y. If
2220 duplicates are present values from y are used.
2222 result = x - y (Remove keys)
2224 The 'result' is a new array containing all keys from x that are not in y.
2226 result = x & y (Common keys)
2228 The 'result' is a new array containing all keys which are in both x and y.
2229 The values from y are used.
2231 result = x | y (Unique keys)
2233 The 'result' is a new array containing keys which exist in either x or y,
2236 When duplicate keys are encountered using the + and & operators, the values
2237 from the array on the right side of the operators are used for the result.
2238 All of the above operators are array only, meaning both the left and right
2239 sides of the operator must be arrays. The results are also arrays.
2241 Array keys can also contain multiple dimensions:
2243 x[1, 1, 1] = "string"
2245 These are used in the expected way, e.g.:
2247 for (i = 1; i < 3; i++)
2249 for (j = 1; j < 3; j++)
2255 gives the following array:
2262 Internally all indices are part of one string, separated by the string
2263 $sub_sep (ASCII 0x1c, 'FS'). The first key in the above example is in
2268 If you need to extract one of the keys, you can use split(), using
2269 $sub_sep as the separator.
2271 You can also check for the existence of multi-dimensional array by
2272 looking for $sub_sep in the key.
2274 Last, you need $sub_sep if you want to use the 'in' keyword.
2276 if ((1,2) in myArray)
2281 if (("1" $sub_sep "2") in myArray)
2286 3>Looping and Conditionals
2288 NEdit supports looping constructs: for and while, and conditional statements:
2289 if and else, with essentially the same syntax as C:
2291 for (<init>, ...; <condition>; <increment>, ...) <body>
2293 while (<condition>) <body>
2295 if (<condition>) <body>
2297 if (<condition>) <body> else <body>
2299 <body>, as in C, can be a single statement, or a list of statements enclosed
2300 in curly braces ({}). <condition> is an expression which must evaluate to
2301 true for the statements in <body> to be executed. for loops may also contain
2302 initialization statements, <init>, executed once at the beginning of the
2303 loop, and increment/decrement statements (or any arbitrary statement), which
2304 are executed at the end of the loop, before the condition is evaluated again.
2308 for (i=0; i<100; i++)
2311 for (i=0, j=20; i<20; i++, j--) {
2327 Loops may contain break and continue statements. A **break** statement
2328 causes an exit from the innermost loop, a **continue** statement transfers
2329 control to the end of the loop.
2330 ----------------------------------------------------------------------
2335 3>Built in Variables
2337 These variables are read-only and cannot be changed by direct assignment.
2339 **$1**, **$2**, **$3**, **$4**, **$5**, **$6**, **$7**, **$8**, **$9**
2342 Argument information. The first 9 arguments (if there are that many) can
2343 be referenced as read-only values using the shorthand form. All arguments
2344 can be accessed as values in the **$args** array, using a numeric index
2345 starting at 1. The total number of arguments received by a function is
2346 given by **$n_args** or **$args[]**.
2349 Index of the current pane.
2352 Contains the current preference for auto indent.
2353 Can be "off", "on", or "smart".
2356 Equals the ID of the currently displayed calltip, or 0 if no calltip is
2360 Position of the cursor in the current window.
2363 Column number of the cursor position in the current window.
2366 Width of the current pane in pixels.
2369 If tab emulation is turned on in the Tabs...
2370 dialog of the Preferences menu, the value is the
2371 distance between emulated tab stops. If tab
2372 emulation is turned off, the value is 0.
2375 An array with no elements. This can be used to initialize
2376 an array to an empty state.
2379 Current newline format that the file will be saved with. Can
2380 be "unix", "dos" or "macintosh".
2383 Name of the file being edited in the current
2384 window, stripped of directory component.
2387 Directory component of file being edited in the current window.
2390 Contains the current plain text font name.
2393 Contains the current bold text font name.
2395 **$font_name_bold_italic**
2396 Contains the current bold-italic text font name.
2398 **$font_name_italic**
2399 Contains the current italic text font name.
2401 **$highlight_syntax**
2402 Whether syntax highlighting is turned on.
2404 **$incremental_backup**
2405 Contains 1 if incremental auto saving is on, otherwise 0.
2407 **$incremental_search_line**
2408 Has a value of 1 if the preference is
2409 selected to always show the incremental search line, otherwise 0.
2412 Name of language mode set in the current window.
2415 Line number of the cursor position in the current window.
2418 True if the file has been locked by the user.
2420 **$make_backup_copy**
2421 Has a value of 1 if original file is kept in a
2422 backup file on save, otherwise 0.
2425 The maximum font width of all the active styles.
2426 Syntax highlighting styles are only considered if syntax highlighting
2430 The minimum font width of all the active styles.
2431 Syntax highlighting styles are only considered if syntax highlighting
2435 True if the file in the current window has
2436 been modified and the modifications have not
2440 Returns NEdit's version number ('5006' for NEdit 5.6).
2442 **$n_display_lines**
2443 The number of lines visible in the currently active pane.
2446 The number of panes in the current window.
2449 True if in Overtype mode.
2452 True if the file is read only.
2454 **$selection_start, $selection_end**
2455 Beginning and ending positions of the
2456 primary selection in the current window, or
2457 -1 if there is no text selected in the current window.
2459 **$selection_left, $selection_right**
2460 Left and right character offsets of the rectangular (primary) selection in
2461 the current window, or -1 if there is no selection or it is not rectangular.
2464 Name of the current NEdit server.
2466 **$show_line_numbers**
2467 Whether line numbers are shown next to the text.
2470 Contains the current preference for showing matching pairs,
2471 such as "[]" and "{}" pairs. Can be "off", "delimiter", or "range".
2473 **$match_syntax_based**
2474 Whether pair matching should use syntax information, if available.
2476 **$statistics_line**
2477 Has a value of 1 if the statistics line is shown, otherwise 0.
2480 Contains the value of the array sub-script separation string.
2483 The distance between tab stops for a
2484 hardware tab character, as set in the
2485 Tabs... dialog of the Preferences menu.
2488 The length of the text in the current document.
2491 The line number of the top line of the currently active pane.
2494 Whether the user is allowing the NEdit to insert tab characters to maintain
2495 spacing in tab emulation and rectangular dragging operations. (The setting of
2496 the "Use tab characters in padding and emulated tabs" button in the Tabs...
2497 dialog of the Preferences menu.)
2500 The right margin in the current window for text wrapping and filling.
2503 The current wrap text mode. Values are "none", "auto" or "continuous".
2505 ..Disabled for 5.4 release.
2506 ..**$backlight_string**
2507 .. The current value of the window's backlighting specification. This is empty
2508 .. if backlighting is turned off. It can be changed through calls to the
2509 .. built-in macro function set_backlight_string().
2512 3>Built-in Subroutines
2514 **append_file( string, filename )**
2515 Appends a string to a named file. Returns 1 on successful write, or 0 if
2521 **calltip( "text_or_key" [, pos [, mode or position_modifier, ...]] )**
2522 Pops up a calltip. <pos> is an optional position in the buffer where the tip
2523 will be displayed. Passing -1 for <pos> is equivalent to not specifying a
2524 position, and it guarantees that the tip will appear on-screen somewhere even
2525 if the cursor is not. The upper-left corner of the calltip will appear below
2526 where the cursor would appear if it were at this position.
2528 <mode> is one of "tipText" (default), "tipKey", or "tagKey". "tipText"
2529 displays the text as-is, "tagKey" uses it as the key to look up a tag, then
2530 converts the tag to a calltip, and "tipKey" uses it as the key to look up a
2531 calltip, then falls back to "tagKey" behavior if that fails. You'll usually
2532 use "tipKey" or "tipText".
2534 Finally, you can modify the placement of the calltip relative to the cursor
2535 position (or <pos>) with one or more of these optional position modifiers:
2536 "center" aligns the center of the calltip with the position. "right" aligns
2537 the right edge of the calltip with the position. ("center" and "right" may
2538 not both be used.) "above" places the calltip above the position. "strict"
2539 does not allow the calltip to move from its position in order to avoid going
2540 off-screen or obscuring the cursor.
2542 Returns the ID of the calltip if it was found and/or displayed correctly,
2545 **clipboard_to_string()**
2546 Returns the contents of the clipboard as a macro string. Returns empty
2549 **dialog( message, btn_1_label, btn_2_label, ... )**
2550 Pop up a dialog for querying and presenting information to the user. First
2551 argument is a string to show in the message area of the dialog.
2552 Additional optional arguments represent labels for buttons to appear along
2553 the bottom of the dialog. Returns the number of the button pressed (the
2554 first button is number 1), or 0 if the user closed the dialog via the window
2557 **filename_dialog( [title[, mode[, defaultPath[, filter[, defaultName]]]]] )**
2558 Presents a file selection dialog with the given title to the user that
2559 prompts for a new or existing file.
2561 Options are: ~title~ will be the title of the dialog, defaults to "Choose
2562 file". If ~mode~ is set to "exist" (default), the "New File Name"TextField
2563 of the FSB will be unmanaged. If "new", the TextField will be managed.
2564 ~defaultPath~ is the default path to use. Default (or "") will use the
2565 active document's directory. ~filter~ is the file glob which determines
2566 which files to display. Is set to "*" if filter is "" and by default.
2567 ~defaultName~ is the default filename that is filled in automatically.
2568 (**Note** that the default_filename argument does not work on all Motif
2571 Returns "" if the user cancelled the dialog, otherwise returns the
2572 fully-qualified path, including the filename.
2574 **focus_window( window_name )**
2575 Sets the window on which subsequent macro commands operate. window_name can
2576 be either a fully qualified file name, or a relative filename (which will
2577 be completed from NEdit's working directory) or one of "last" for the last
2578 window created, or "next" for the next window in the chain from the currently
2579 focused window (the first window being the one returned from calling
2580 focus_window("last"). Returns the name of the newly-focused window, or an
2581 empty string if the requested window was not found.
2583 **get_character( position )**
2584 Returns the single character at the position
2585 indicated by the first argument to the routine from the current window.
2587 **get_range( start, end )**
2588 Returns the text between a starting and ending position from the current
2592 Returns a string containing the text currently selected by the primary
2593 selection either from the current window (no keyword), or from anywhere on
2594 the screen (keyword "any").
2597 Gets the value of an environment variable.
2599 **kill_calltip( [calltip_ID] )**
2600 Kills any calltip that is being displayed in the window in which the macro is
2601 running. If there is no displayed calltip this does nothing. If a calltip
2602 ID is supplied then the calltip is killed only if its ID is calltip_ID.
2604 **length( string )**
2605 Returns the length of a string
2607 **list_dialog( message, text, btn_1_label, btn_2_label, ... )**
2608 Pop up a dialog for prompting the user to choose a line from the given text
2609 string. The first argument is a message string to be used as a title for the
2610 fixed text describing the list. The second string provides the list data:
2611 this is a text string in which list entries are separated by newline
2612 characters. Additional optional arguments represent labels for
2613 buttons to appear along the bottom of the dialog. Returns the line of text
2614 selected by the user as the function value (without any newline separator) or
2615 the empty string if none was selected, and number of the button pressed (the
2616 first button is number 1), in $list_dialog_button. If the user closes the
2617 dialog via the window close box, the function returns the empty string, and
2618 $list_dialog_button returns 0.
2620 **max( n1, n2, ... )**
2621 Returns the maximum value of all of its arguments
2623 **min( n1, n2, ... )**
2624 Returns the minimum value of all of its arguments
2626 **read_file( filename )**
2627 Reads the contents of a text file into a string. On success, returns 1 in
2628 $read_status, and the contents of the file as a string in the subroutine
2629 return value. On failure, returns the empty string "" and an 0 $read_status.
2631 **replace_in_string( string, search_for, replace_with [, type, "copy"] )**
2632 Replaces all occurrences of a search string in a string with a replacement
2633 string. Arguments are 1: string to search in, 2: string to search for, 3:
2634 replacement string. There are two optional arguments. One is a search type,
2635 either "literal", "case", "word", "caseWord", "regex", or "regexNoCase".
2636 The default search type is "literal". If the optional "copy" argument is
2637 specified, a copy of the input string is returned when no replacements were
2638 performed. By default an empty string ("") will be returned in this case.
2639 Returns a new string with all of the replacements done.
2641 **replace_range( start, end, string )**
2642 Replaces all the text between two positions in the current window. If the
2643 cursor position is between start and end it will be set to start.
2645 **replace_selection( string )**
2646 Replaces the primary-selection selected text in the current window.
2648 **replace_substring( string, start, end, replace_with )**
2649 Replacing a substring between two positions in a string within another string.
2651 **revert_to_saved()**
2652 Reloads the file, discarding all changes done to the document by the user
2653 since the last save.
2655 **search( search_for, start [, search_type, wrap, direction] )**
2656 Searches silently in a window without dialogs, beeps, or changes to the
2657 selection. Arguments are: 1: string to search for, 2: starting position.
2658 Optional arguments may include the strings: "wrap" to make the search wrap
2659 around the beginning or end of the string, "backward" or "forward" to change
2660 the search direction ("forward" is the default), "literal", "case", "word",
2661 "caseWord", "regex", or "regexNoCase" to change the search type (default is
2662 "literal"). Returns the starting position of the match, or -1 if nothing
2663 matched. Also returns the ending position of the match in $search_end.
2665 **search_string( string, search_for, start [, search_type, direction] )**
2666 Built-in macro subroutine for searching a string. Arguments are 1: string to
2667 search in, 2: string to search for, 3: starting position. Optional arguments
2668 may include the strings: "wrap" to make the search wrap around the beginning
2669 or end of the string, "backward" or "forward" to change the search direction
2670 ("forward" is the default), "literal", "case", "word", "caseWord", "regex",
2671 or "regexNoCase" to change the search type (default is "literal"). Returns
2672 the starting position of the match, or -1 if nothing matched. Also returns
2673 the ending position of the match in $search_end.
2675 **select( start, end )**
2676 Selects (with the primary selection) text in the current buffer between a
2677 starting and ending position.
2679 **select_rectangle( start, end, left, right )**
2680 Selects a rectangular area of text between a starting and ending position,
2681 and confined horizontally to characters displayed between positions "left",
2684 ..Disabled for 5.4 release.
2685 ..**set_backlight_string( [string] )**
2686 .. Applies the given string, which should be in the format of the
2687 .. nedit*backlightCharTypes X resource, to the current text window, turning on
2688 .. backlighting. If the value of the string passed is "default", or if no
2689 .. parameter is passed, the nedit.backlightCharTypes X resource's own value will
2690 .. be used. If the empty string, "", is passed, backlighting will be turned
2693 **set_cursor_pos( position )**
2694 Set the cursor position for the current window.
2696 **shell_command( command, input_string )**
2697 Executes a shell command, feeding it input from input_string. On completion,
2698 output from the command is returned as the function value, and the command's
2699 exit status is returned in the global variable $shell_cmd_status.
2701 **split(string, separation_string [, search_type])**
2702 Splits a string using the separator specified. Optionally the search_type
2703 argument can specify how the separation_string is interpreted. The default
2704 is "literal". The returned value is an array with keys beginning at 0.
2706 **string_dialog( message, btn_1_label, btn_2_label, ... )**
2707 Pops up a dialog prompting the user to enter information. The first argument
2708 is a string to show in the message area of the dialog. Additional
2709 optional arguments represent labels for buttons to appear along the bottom of
2710 the dialog. Returns the string entered by the user as the function value,
2711 and number of the button pressed (the first button is number 1), in
2712 $string_dialog_button. If the user closes the dialog via the window close
2713 box, the function returns the empty string, and $string_dialog_button returns
2716 **string_compare(string1, string2 [, consider-case])**
2717 Compare two strings and return 0 if they are equal, -1 if string1 is less
2718 than string2 or 1 if string1 is greater than string2. The values for the
2719 optional consider-case argument is either "case" or "nocase". The default
2720 is to do a case sensitive comparison.
2722 **string_to_clipboard( string )**
2723 Copy the contents of a macro string to the clipboard.
2725 **substring( string, start [, end] )**
2726 Returns the portion of a string between a start and end position (with the
2727 position of the beginning of the string being 0). If end is missing, the
2728 position of the end of the string is used. If either of the positions are
2729 negative, they are treated as relative to the end of the string. A position
2730 specified either before the start of the string or after the end of the string
2731 is repositioned to the nearest valid string position. If the start position
2732 is beyond the end position, the empty string is returned.
2734 **t_print( string1, string2, ... )**
2735 Writes strings to the terminal (stdout) from which NEdit was started.
2737 **tolower( string )**
2738 Return an all lower-case version of string.
2740 **toupper( string )**
2741 Return an all upper-case version of string.
2743 **valid_number( string )**
2744 Returns 1 if the string can be converted to a number without error
2745 following the same rules that the implicit conversion would. Otherwise 0.
2747 **write_file( string, filename )**
2748 Writes a string (parameter 1) to a file named in parameter 2. Returns 1 on
2749 successful write, or 0 if unsuccessful.
2752 3>Deprecated Functions
2754 Some functions are included only for supporting legacy macros. You should not
2755 use any of these functions in any new macro you write. Among these are all
2756 action routines with hyphens in their names; use underscores instead
2757 ('find-dialog' -> 'find_dialog').
2760 **DEPRECATED** Use select_to_matching() instead.
2762 ----------------------------------------------------------------------
2767 Rangesets are a tool of the macro language to tag parts, or ranges, of the
2768 text, which shall be viewed as a group. A range is merely a contiguous range
2769 of characters between a start and an end position in the document, and a set
2770 of ranges belonging together is called a rangeset. So, a rangeset is nothing
2771 but an in general non-contiguous part of the text.
2773 Rangesets can be assigned a background color to make them visible: characters
2774 within all ranges of a rangeset will have the background color of the
2775 rangeset. (If more than one rangeset includes a given character, its
2776 background color will be that of the most recently created rangeset which has
2779 Applications of rangesets are for example:
2781 * Showing differences between two versions of a file. Then, one rangeset would be those parts of the current file that are not in the prior version.
2782 * Highlighting all occurrences of a particular pattern, e.g. showing all the strings 'foobar' in the file.
2783 * Highlighting spelling mistakes found by a spell-checker.
2785 Rangesets are manipulated only through macro routines. Rangesets must be
2786 created first using the rangeset_create() function, which will return an
2787 identifier for the newly-created (empty) rangeset. This identifier is then
2788 passed to the other rangeset functions to manipulate the rangeset. For
2789 example, ranges are added to a rangeset with the rangeset_add() function.
2791 Notice that the ranges inside a rangeset do not have a particular identity.
2792 Only, they are given a (dynamically changing) numeric index, counting from 1,
2793 in the order of appearance in the text buffer. The ranges are adjusted when
2794 modifications are made to the text buffer: they shift around when characters
2795 are added or deleted staying with the original strings of characters.
2796 However, ranges within a set will coalesce if the characters between them are
2797 removed, or a new range is added to the set which bridges or overlaps
2798 others. For more on this, see "How rangesets change with modifications".
2800 There is a limit to the number of rangesets which can exist at any time -
2801 currently up to 63 in each document. Care should be taken to destroy any
2802 rangesets which are no longer needed, by using the rangeset_destroy()
2803 function, if this limit is attained.
2805 Rangesets can be named: this is useful for macros which need a fixed
2806 identification for rangesets which are used for the same purpose in different
2807 documents. Although a new rangeset's number is arbitrary, its name can be
2808 fixed. This is done using the rangeset_set_name() function. Note that
2809 rangeset names within a particular document may not be unique. For this
2810 reason, the rangeset_get_by_name() function returns an array of identifiers,
2811 which will be empty if the name has not been associated with a rangeset.
2813 4>How rangesets change with modifications
2815 When changes are made to the document text, ranges within each set are altered
2816 with it, according to their behavioral mode. If changes are made outside of
2817 the ranges in a rangeset, each range simply maintains its size and adjusts its
2818 position to match the changes. When text within a range is deleted, the
2819 range's length is reduced by the same amount. When changes involving new text
2820 are made within a range of the set, or to one of the extremities of a range,
2821 different behaviours may be desirable. The rangeset_set_mode() function allows
2822 these modes to be chosen.
2824 Note that the precise behaviour of these modes may change in future versions
2827 The available modes are:
2829 **maintain** or **ins_del** -
2830 Both these modes have the same behaviour. New text added at the front of a
2831 range in a set is not added to the range; new text added within the range or
2832 at the end extends the range. Replacement overlapping an extremity of the
2833 set acts as if the new text were added first, then the old text deleted.
2834 This causes curtailment at the front of the range, extension at the end.
2835 Replacement of the full text of the range removes the range from the set.
2836 The default behaviour for a newly created rangeset is **maintain**.
2839 New text added at the front or end of a range in a set is not added to the
2840 range; new text added within the range extends the range. Replacement
2841 overlapping an extremity of the set acts as if the old text were deleted
2842 first, then the new text added. This causes curtailment at either end.
2843 Replacement of the full text of the range removes the range from the set.
2846 New text added at the front or end of a range in a set extends the range, as
2847 does new text added within the range. Replacement overlapping an extremity
2848 of the set acts as if the new text were added first, then the old text
2849 deleted. This causes curtailment at the front of the range, extension at
2850 the end. Replacement of the full text of the range adds the new text to the
2851 range if the start position of the replacement is at the range's start
2855 New text added at the front or end of a range in a set does not extend the
2856 range; new text added within the range extends the range. Replacement
2857 overlapping an extremity causes curtailment of the range. Replacement of
2858 the full text of the range removes the range from the set.
2861 New text added at the front or end of a range in a set does not extend the
2862 range; new text added within the range will split the range. Replacement
2863 overlapping an extremity causes curtailment of the range. Replacement of
2864 the full text of the range removes the range from the set.
2868 A rangeset is manipulated ~only~ through macro routines. Rangesets
2869 can easily become very large, and may exceed the capacity of the running
2870 process. Coloring relies on proper color names or specifications (such as
2871 the "#rrggbb" hexadecimal digit strings), and appropriate hardware support. If
2872 an invalid color name is given, the default background color is used instead.
2873 Behaviours set using rangeset_set_mode() are subject to change in future
2876 3>Rangeset read-only variables
2879 array of active rangeset identifiers, with integer keys starting at 0,
2880 in the order the rangesets were defined.
2882 3>Rangeset functions
2884 **rangeset_create()**
2885 **rangeset_create( n )**
2886 Creates one or more new rangesets. The first form creates a single range
2887 set and returns its identifier; if there are no rangesets available it
2888 returns 0. The second form creates n new rangesets, and returns an array
2889 of the rangeset identifiers with keys beginning at 0. If the requested
2890 number of rangesets is not available it returns an empty array.
2892 **rangeset_destroy( r )**
2893 **rangeset_destroy( array )**
2894 Deletes all information about a rangeset or a number of rangesets. The
2895 first form destroys the rangeset identified by r. The second form should
2896 be passed an array of rangeset identifiers with keys beginning at 0 (i.e.
2897 the same form of array returned by rangeset_create(n); it destroys all the
2898 rangesets appearing in the array. If any of the rangesets do not exist,
2899 the function continues without errors. Does not return a value.
2901 **rangeset_add( r )**
2902 **rangeset_add( r, start, end )**
2903 **rangeset_add( r, r0 )**
2904 Adds to the rangeset r. The first form adds the range identified by the
2905 current primary selection to the rangeset, unless the selection is
2906 rectangular. The second form adds the range defined by the start and end
2907 positions given. The third form adds all ranges in the rangeset r0 to the
2908 rangeset r, and returns 0.
2910 Returns the index of the newly-added range within the rangeset.
2912 **rangeset_subtract( r, [start, end] )**
2913 **rangeset_subtract( r, r0 )**
2914 Removes from the rangeset r. The first form removes the range identified by
2915 the current primary selection from the rangeset, unless start and end are
2916 defined, in which case the range they define is removed. The second form
2917 removes all ranges in the rangeset r0 from the rangeset r. Does not return
2920 **rangeset_invert( r )**
2921 Changes the rangeset r so that it contains all ranges not in r. Does not
2924 **rangeset_get_by_name( name )**
2925 Returns an array of active rangeset identifiers, with integer keys starting at 0,
2926 whose name matches name.
2928 **rangeset_info( r )**
2929 Returns an array containing information about the rangeset r. The array
2930 has the following keys: **defined** (whether a rangeset with identifier
2931 r is defined), **count** (the number of ranges in the rangeset), **color**
2932 (the current background color of the rangeset, an empty string if the
2933 rangeset has no color), **name** (the user supplied name of the rangeset,
2934 an empty string if the rangeset has no name), and **mode** (the name of the
2935 modify-response mode of the rangeset).
2937 **rangeset_range( r, [index] )**
2938 Returns details of a specific range in the rangeset r. The range is
2939 specified by index, which should be between 1 and n (inclusive), where
2940 n is the number of ranges in the rangeset. The return value is an array
2941 containing the keys **start** (the start position of the range) and **end**
2942 (the end position of the range). If index is not supplied, the region
2943 returned is the span of the entire rangeset (the region starting at the
2944 start of the first range and ending at the end of the last). If index
2945 is outside the correct range of values, the function returns an empty array.
2947 **rangeset_includes( r, pos )**
2948 Returns the index of the range in rangeset r which includes pos; returns
2949 0 if pos is not contained in any of the ranges of r. This can also be used
2950 as a simple true/false function which returns true if pos is contained in
2953 **rangeset_set_color( r, color )**
2954 Attempts to apply the color as a background color to the ranges of r. If
2955 color is at empty string, removes the coloring of r. No check is made
2956 regarding the validity of color: if the color is invalid (a bad name,
2957 or not supported by the hardware) this has unpredictable effects.
2959 **rangeset_set_name( r, name )**
2960 Apply the name to the rangeset r.
2962 **rangeset_set_mode( r, type )**
2963 Changes the behaviour of the rangeset r when modifications to the text
2964 buffer occur. type can be one of the following: "maintain" (the default),
2965 "break", "include", "exclude", "ins_del" or "del_ins". (These modes are
2968 Highlighting Information
2969 ------------------------
2971 The user can interrogate the current window to determine the color
2972 highlighting used on a particular piece of text. The following functions
2973 provide information on the highlighting pattern against which text at a
2974 particular position has been matched, its style, color and font attributes
2975 (whether the font is supposed to be bold and/or italic).
2977 These macro functions permit macro writers to generate formatted output which
2978 allows NEdit highlighting to be reproduced. This is suitable for the
2979 generation of HTML or Postscript output, for example.
2981 Note that if any of the functions is used while in Plain mode or while syntax
2982 highlighting is off, the behaviour is undefined.
2984 **get_pattern_by_name( pattern_name )**
2985 Returns an array containing the pattern attributes for pattern 'pattern_name'.
2986 The elements in this array are:
2988 * **style** -- Highlight style name
2990 If 'pattern_name' is invalid, an empty array is returned.
2992 **get_pattern_at_pos( pos )**
2993 Returns an array containing the pattern attributes of the character at
2994 position 'pos'. The elements in this array are:
2996 * **pattern** -- Highlight pattern name
2997 * **style** -- Highlight style name
2998 * **extent** -- The length in the text which uses the same highlighting pattern
3000 The 'extent' value is measured from position 'pos' going right/down (forward
3003 If 'pos' is invalid, an empty array is returned.
3005 **get_style_by_name( style_name )**
3006 Returns an array containing the style attributes for style 'style_name'.
3007 The elements in this array are:
3009 * **bold** -- '1' if style is bold, '0' otherwise
3010 * **italic** -- '1' if style is italic, '0' otherwise
3011 * **color** -- Name of the style's color
3012 * **background** -- Name of the background color, if any
3014 The colors use the names specified in the color definitions for the style.
3015 These will either be names matching those the X server recognises, or RGB
3016 (red/green/blue) specifications.
3018 If 'style_name' is invalid, an empty array is returned.
3020 **get_style_at_pos( pos )**
3021 Returns an array containing the style attributes of the character at
3022 position 'pos'. The elements in this array are:
3024 * **style** -- Name of the highlight style
3025 * **bold** -- '1' if style is bold, '0' otherwise
3026 * **italic** -- '1' if style is italic, '0' otherwise
3027 * **color** -- Name of the style's color
3028 * **rgb** -- Color's RGB values ('#rrggbb')
3029 * **background** -- Name of the background color, if any
3030 * **back_rgb** -- Background color's RGB values ('#rrggbb')
3031 * **extent** -- The length in the text which uses the same highlight style
3033 The colors use the names specified in the color definitions for the style.
3034 These will either be names matching those the X server recognises, or RGB
3035 specifications. The values for 'rgb' and 'back_rgb' contain the actual color
3036 values allocated by the X server for the window. If the X server cannot
3037 allocate the specified (named) color exactly, the RGB values in these
3038 entries may not match the specified ones.
3040 The 'extent' value is measured from position 'pos' going right/down (forward
3043 If 'pos' is invalid, an empty array is returned.
3045 ----------------------------------------------------------------------
3050 All of the editing capabilities of NEdit are represented as a special type of
3051 subroutine, called an action routine, which can be invoked from both macros
3052 and translation table entries (see "Key_Binding_" in the
3053 Customizing section of the Help menu).
3056 3>Actions Representing Menu Commands
3058 File Menu Search Menu
3059 ----------------------- -------------------------
3061 open() find_dialog()
3062 open_dialog() find_again()
3063 open_selected() find_selection()
3065 save() replace_dialog()
3066 save_as() replace_all()
3067 save_as_dialog() replace_in_selection()
3068 revert_to_saved_dialog() replace_again()
3069 include_file() goto_line_number()
3070 include_file_dialog() goto_line_number_dialog()
3071 load_macro_file() goto_selected()
3072 load_macro_file_dialog() mark()
3073 load_tags_file() mark_dialog()
3074 load_tags_file_dialog() goto_mark()
3075 unload_tags_file() goto_mark_dialog()
3076 load_tips_file() goto_matching()
3077 load_tips_file_dialog() select_to_matching()
3078 unload_tips_file() find_definition()
3082 -------------------------
3083 Edit Menu filter_selection_dialog()
3084 ----------------------- filter_selection()
3085 undo() execute_command()
3086 redo() execute_command_dialog()
3087 delete() execute_command_line()
3088 select_all() shell_menu_command()
3090 shift_left_by_tab() Macro Menu
3091 shift_right() -------------------------
3092 shift_right_by_tab() macro_menu_command()
3093 uppercase() repeat_macro()
3094 lowercase() repeat_dialog()
3096 control_code_dialog() Windows Menu
3097 -------------------------
3101 move_document_dialog()
3104 An action representing a menu command is usually named the same as its
3105 corresponding menu item except that all punctuation is removed, all letters
3106 are changed to lower case, and spaces are replaced with underscores. To
3107 present a dialog to ask the user for input, use the actions with the
3108 `_dialog` suffix. Actions without the `_dialog` suffix take the information
3109 from the routine's arguments (see below).
3111 3>Menu Action Routine Arguments
3113 Arguments are text strings enclosed in quotes. Below are the menu action
3114 routines which take arguments. Optional arguments are enclosed in [].
3116 **new**( ["tab" | "window" | "prefs" | "opposite"] )
3118 **close**( ["prompt" | "save" | "nosave"] )
3120 **execute_command**( shell-command )
3122 **filter_selection**( shell-command )
3124 **find**( search-string [, ~search-direction~] [, ~search-type~]
3127 **find_again**( [~search-direction~] [, ~search-wrap~] )
3129 **find_definition**( [tag-name] )
3131 **find_dialog**( [~search-direction~] [, ~search-type~]
3134 **find_selection**( [~search-direction~] [, ~search-wrap~]
3135 [, ~non-regex-search-type~] )
3137 **goto_line_number**( [~line-number~] [, ~column-number~] )
3139 **goto_mark**( ~mark-letter~ )
3141 **include_file**( ~filename~ )
3143 **load_tags_file**( ~filename~ )
3145 **macro_menu_command**( ~macro-menu-item-name~ )
3147 **mark**( ~mark-letter~ )
3149 **open**( ~filename~ )
3151 **replace**( search-string, replace-string,
3152 [, ~search-direction~] [, ~search-type~] [, ~search-wrap~] )
3154 **replace_again**( [~search-direction~] [, ~search-wrap~] )
3156 **replace_all**( search-string, replace-string [, ~search-type~] )
3158 **replace_dialog**( [~search-direction~] [, ~search-type~]
3161 **replace_in_selection**( search-string,
3162 replace-string [, ~search-type~] )
3164 **save_as**( ~filename~ )
3166 **shell_menu_command**( ~shell-menu-item-name~ )
3168 **unload_tags_file**( ~filename~ )
3170 **----------- Some notes on argument types above -----------**
3172 ~Arguments to new()~
3173 "tab": Open a new tab
3174 "window": Open a new window
3175 "prefs": Follow the user's tab/window
3177 "opposite": Opposite of user's tab/window
3179 Default behaviour is "prefs".
3181 ~filename~ Path names are relative to the directory from
3182 which NEdit was started. Shell interpreted
3183 wildcards and `~' are not expanded.
3185 ~keep-dialog~ Either "keep" or "nokeep".
3187 ~mark-letter~ The mark command limits users to single letters. Inside
3188 of macros, single digits are allowed as marks. These
3189 won't interfere with marks set by the user.
3191 ~macro-menu-item-name~
3192 Name of the command exactly as specified in
3193 the Macro Menu dialogs.
3195 ~non-regex-search-type~
3196 Either "literal", "case", "word", or
3200 Either "forward" or "backward".
3202 ~search-type~ Either "literal", "case", "word",
3203 "caseWord", "regex", or "regexNoCase".
3205 ~search-wrap~ Either "wrap" or "nowrap".
3207 ~shell-menu-item-name~
3208 Name of the command exactly as specified in
3209 the Shell Menu dialogs.
3211 3>Window Preferences Actions
3213 **set_auto_indent( "off" | "on" | "smart" )**
3214 Set auto indent mode for the current window.
3216 **set_em_tab_dist( em-tab-distance )**
3217 Set the emulated tab size. An em-tab-distance value of
3218 0 or less translates to no emulated tabs. Em-tab-distance must
3219 be smaller than 1000.
3221 **set_fonts( font-name, italic-font-name, bold-font-name, bold-italic-font-name )**
3222 Set all the fonts used for the current window.
3224 **set_highlight_syntax( [0 | 1] )**
3225 Set syntax highlighting mode for the current window.
3226 A value of 0 turns it off and a value of 1 turns it on.
3227 If no parameters are supplied the option is toggled.
3229 **set_incremental_backup( [0 | 1] )**
3230 Set incremental backup mode for the current window.
3231 A value of 0 turns it off and a value of 1 turns it on.
3232 If no parameters are supplied the option is toggled.
3234 **set_incremental_search_line( [0 | 1] )**
3235 Show or hide the incremental search line for the current window.
3236 A value of 0 turns it off and a value of 1 turns it on.
3237 If no parameters are supplied the option is toggled.
3239 **set_language_mode( language-mode )**
3240 Set the language mode for the current window. If the language mode is
3241 "" or unrecognized, it will be set to Plain.
3243 **set_locked( [0 | 1] )**
3244 This only affects the locked status of a file, not its read-only
3245 status. Permissions are ~not~ changed.
3246 A value of 0 turns it off and a value of 1 turns it on.
3247 If no parameters are supplied the option is toggled.
3249 **set_make_backup_copy( [0 | 1] )**
3250 Set whether backup copies are made during saves for the current window.
3251 A value of 0 turns it off and a value of 1 turns it on.
3252 If no parameters are supplied the option is toggled.
3254 **set_overtype_mode( [0 | 1] )**
3255 Set overtype mode for the current window.
3256 A value of 0 turns it off and a value of 1 turns it on.
3257 If no parameters are supplied the option is toggled.
3259 **set_show_line_numbers( [0 | 1] )**
3260 Show or hide line numbers for the current window.
3261 A value of 0 turns it off and a value of 1 turns it on.
3262 If no parameters are supplied the option is toggled.
3264 **set_show_matching( "off" | "delimiter" | "range" )**
3265 Set show matching (...) mode for the current window.
3267 **set_match_syntax_based( [0 | 1] )**
3268 Set whether matching should be syntax based for the current window.
3270 **set_statistics_line( [0 | 1] )**
3271 Show or hide the statistics line for the current window.
3272 A value of 0 turns it off and a value of 1 turns it on.
3273 If no parameters are supplied the option is toggled.
3275 **set_tab_dist( tab-distance )**
3276 Set the size of hardware tab spacing. Tab-distance must
3277 be a value greater than 0 and no greater than 20.
3279 **set_use_tabs( [0 | 1] )**
3280 Set whether tab characters are used for the current window. A value of 0
3281 turns it off (using space characters instead) and a value of 1 turns it on.
3282 If no parameters are supplied the option is toggled.
3284 **set_wrap_margin( wrap-width )**
3285 Set the wrap width for text wrapping of the current window. A value
3286 of 0 means to wrap at window width.
3288 **set_wrap_text( "none" | "auto" | "continuous" )**
3289 Set wrap text mode for the current window.
3291 3>Keyboard-Only Actions
3293 In addition to the arguments listed in the call descriptions below, any
3294 routine involving cursor movement can take the argument "extend", meaning,
3295 adjust the primary selection to the new cursor position. Routines which take
3296 the "extend" argument as well as mouse dragging operations for both primary
3297 and secondary selections can take the optional keyword "rect", meaning, make
3298 the selection rectangular. Any routine that accepts the "scrollbar" argument
3299 will move the display but not the cursor or selection. Routines that accept
3300 the "nobell" argument will fail silently without beeping, when that argument
3303 **backward_character( ["nobell"] )**
3304 Moves the cursor one character to the left.
3306 **backward_paragraph(["nobell"] )**
3307 Moves the cursor to the beginning of the paragraph, or
3308 if the cursor is already at the beginning of a paragraph, moves the cursor to
3309 the beginning of the previous paragraph. Paragraphs are defined as regions
3310 of text delimited by one or more blank lines.
3312 **backward_word( ["nobell"] )**
3313 Moves the cursor to the beginning of a word, or, if the
3314 cursor is already at the beginning of a word, moves the cursor to the
3315 beginning of the previous word. Word delimiters are user-settable, and
3316 defined by the X resource wordDelimiters.
3318 **beginning_of_file( ["scrollbar"] )**
3319 Moves the cursor to the beginning of the file.
3321 **beginning_of_line( ["absolute"] )**
3322 Moves the cursor to the beginning of the line. If
3323 "absolute" is given, always moves to the absolute beginning of line,
3324 regardless of the text wrapping mode.
3326 **beginning_of_selection()**
3327 Moves the cursor to the beginning of the selection
3328 without disturbing the selection.
3330 **copy_clipboard()**
3331 Copies the current selection to the clipboard.
3334 Copies the primary selection to the cursor.
3337 If a secondary selection exists, copies the secondary selection to
3338 the cursor. If no secondary selection exists, copies the primary selection
3339 to the pointer location.
3341 **copy_to_or_end_drag()**
3342 Completes either a secondary selection operation, or a
3343 primary drag. If the user is dragging the mouse to adjust a secondary
3344 selection, the selection is copied and either inserted at the cursor
3345 location, or, if pending-delete is on and a primary selection exists in the
3346 window, replaces the primary selection. If the user is dragging a block of
3347 text (primary selection), completes the drag operation and leaves the text at
3348 its current location.
3351 Deletes the text in the primary selection and places it in
3355 Copies the primary selection to the cursor and deletes it at
3356 its original location.
3358 **delete_selection()**
3359 Deletes the contents of the primary selection.
3361 **delete_next_character( ["nobell"] )**
3362 If a primary selection exists, deletes its contents.
3363 Otherwise, deletes the character following the cursor.
3365 **delete_previous_character( ["nobell"] )**
3366 If a primary selection exists, deletes its
3367 contents. Otherwise, deletes the character before the cursor.
3369 **delete_next_word( ["nobell"] )**
3370 If a primary selection exists, deletes its contents.
3371 Otherwise, deletes the word following the cursor.
3373 **delete_previous_word( ["nobell"] )**
3374 If a primary selection exists, deletes its contents.
3375 Otherwise, deletes the word before the cursor.
3377 **delete_to_start_of_line( ["nobell", "wrap"] )**
3378 If a primary selection exists, deletes its contents. Otherwise, deletes the
3379 characters between the cursor and the start of the line. If "wrap" is
3380 given, deletes to the previous wrap point or beginning of line, whichever
3383 **delete_to_end_of_line( ["nobell", "absolute"] )**
3384 If a primary selection exists, deletes its contents.
3385 Otherwise, deletes the characters between the cursor and the end of the line.
3386 If "absolute" is given, always deletes to the absolute end of line, regardless
3387 of the text wrapping mode.
3390 De-selects the primary selection.
3392 **end_of_file( ["scrollbar"] )**
3393 Moves the cursor to the end of the file.
3395 **end_of_line( ["absolute"] )**
3396 Moves the cursor to the end of the line. If
3397 "absolute" is given, always moves to the absolute end of line, regardless
3398 of the text wrapping mode.
3400 **end_of_selection()**
3401 Moves the cursor to the end of the selection without
3402 disturbing the selection.
3404 **exchange( ["nobell"] )**
3405 Exchange the primary and secondary selections.
3408 Attached mouse-movement events to begin a selection between
3409 the cursor and the mouse, or extend the primary selection to the mouse
3413 Completes a primary drag-selection operation.
3416 Begins a selection between the cursor and the mouse. A
3417 drag-selection operation can be started with either extend_start or
3420 **focus_pane( [relative-pane] | [positive-index] | [negative-index] )**
3421 Move the focus to the requested pane.
3422 Arguments can be specified in the form of a relative-pane
3423 ("first", "last", "next", "previous"), a positive-index
3424 (numbers greater than 0, 1 is the same as "first") or a
3425 negative-index (numbers less than 0, -1 is the same as "last").
3427 **forward_character()**
3428 Moves the cursor one character to the right.
3430 **forward_paragraph( ["nobell"] )**
3431 Moves the cursor to the beginning of the next paragraph.
3432 Paragraphs are defined as regions of text delimited by one or more blank
3435 **forward_word( ["tail"] ["nobell"] )**
3436 Moves the cursor to the beginning of the next word. Word
3437 delimiters are user-settable, and defined by the X resource wordDelimiters.
3438 If the "tail" argument is supplied the cursor will be moved to
3439 the end of the current word or the end of the next word, if the
3440 cursor is between words.
3443 Moves the cursor to the mouse pointer location, and prepares for
3444 a possible drag-selection operation (bound to extend_adjust), or multi-click
3445 operation (a further grab_focus action). If a second invocation of grab
3446 focus follows immediately, it selects a whole word, or a third, a whole line.
3448 **insert_string( "string" )**
3449 If pending delete is on and the cursor is inside the
3450 selection, replaces the selection with "string". Otherwise, inserts "string"
3451 at the cursor location.
3453 **key_select( "direction" [,"nobell"] )**
3454 Moves the cursor one character in "direction"
3455 ("left", "right", "up", or "down") and extends the selection. Same as
3456 forward/backward-character("extend"), or process-up/down("extend"), for
3457 compatibility with previous versions.
3459 **move-destination()**
3460 Moves the cursor to the pointer location without
3461 disturbing the selection. (This is an unusual way of working. We left it in
3462 for compatibility with previous versions, but if you actually use this
3463 capability, please send us some mail, otherwise it is likely to disappear in
3467 If a secondary selection exists, deletes the contents of the
3468 secondary selection and inserts it at the cursor, or if pending-delete is on
3469 and there is a primary selection, replaces the primary selection. If no
3470 secondary selection exists, moves the primary selection to the pointer
3471 location, deleting it from its original position.
3473 **move_to_or_end_drag()**
3474 Completes either a secondary selection operation, or a
3475 primary drag. If the user is dragging the mouse to adjust a secondary
3476 selection, the selection is deleted and either inserted at the cursor
3477 location, or, if pending-delete is on and a primary selection exists in the
3478 window, replaces the primary selection. If the user is dragging a block of
3479 text (primary selection), completes the drag operation and deletes the text
3480 from its current location.
3483 Inserts a newline character. If Auto Indent is on, lines up the
3484 indentation of the cursor with the current line.
3486 **newline_and_indent()**
3487 Inserts a newline character and lines up the indentation
3488 of the cursor with the current line, regardless of the setting of Auto
3491 **newline_no_indent()**
3492 Inserts a newline character, without automatic
3493 indentation, regardless of the setting of Auto Indent.
3495 **next_page( ["stutter"] ["column"] ["scrollbar"] ["nobell"] )**
3496 Moves the cursor and scroll forward one page.
3497 The parameter "stutter" moves the cursor to the bottom of the display,
3498 unless it is already there, otherwise it will page down.
3499 The parameter "column" will maintain the preferred column while
3502 **page_left( ["scrollbar"] ["nobell"] )**
3503 Move the cursor and scroll left one page.
3505 **page_right( ["scrollbar"] ["nobell"] )**
3506 Move the cursor and scroll right one page.
3508 **paste_clipboard()**
3509 Insert the contents of the clipboard at the cursor, or if
3510 pending delete is on, replace the primary selection with the contents of the
3513 **previous_page( ["stutter"] ["column"] ["scrollbar"] ["nobell"] )**
3514 Moves the cursor and scroll backward one page.
3515 The parameter "stutter" moves the cursor to the top of the display,
3516 unless it is already there, otherwise it will page up.
3517 The parameter "column" will maintain the preferred column while
3521 Same as secondary_or_drag_start for compatibility with previous versions.
3523 **process_cancel()**
3524 Cancels the current extend_adjust, secondary_adjust, or
3525 secondary_or_drag_adjust in progress.
3527 **process_down( ["nobell", "absolute"] )**
3528 Moves the cursor down one line. If "absolute" is given, always moves to the
3529 next line in the text buffer, regardless of wrapping.
3531 **process_return()**
3532 Same as newline for compatibility with previous versions.
3534 **process_shift_down( ["nobell", "absolute"] )**
3535 Same as process_down("extend") for compatibility with previous versions.
3537 **process_shift_up( ["nobell", "absolute"] )**
3538 Same as process_up("extend") for compatibility with previous versions.
3541 If tab emulation is turned on, inserts an emulated tab,
3542 otherwise inserts a tab character.
3544 **process_up( ["nobell", "absolute"] )**
3545 Moves the cursor up one line. If "absolute" is given, always moves to the
3546 previous line in the text buffer, regardless of wrapping.
3548 **raise_window([relative-window] | [positive-index] | [negative-index] [, "focus" | "nofocus"])**
3549 Raise the current focused window to the front if no argument is supplied.
3550 Arguments can be specified in the form of a relative-window
3551 ("first", "last", "next", "previous"), a positive-index
3552 (numbers greater than 0, 1 is the same as "last") or a
3553 negative-index (numbers less than 0, -1 is the same as "first").
3555 Moreover, it can be specified whether or not the raised window should
3556 request the X input focus. By default, it depends on the setting of the
3557 nedit.focusOnRaise resource (see the section "X_Resources_") whether or not
3558 the input focus is requested.
3560 **scroll_down( nUnits, ["lines" | "pages"] )**
3561 Scroll the display down (towards the end of the file) by a given
3562 number of units, units being lines or pages. Default units are lines.
3564 **scroll_left( nPixels )**
3565 Scroll the display left by nPixels.
3567 **scroll_right( nPixels )**
3568 Scroll the display right by nPixels.
3570 **scroll_up( nUnits, ["lines" | "pages"] )**
3571 Scroll the display up (towards the beginning of the file) by a given
3572 number of units, units being lines or pages. Default units are lines.
3574 **scroll_to_line( lineNum )**
3575 Scroll to position line number lineNum at the top of
3576 the pane. The first line of a file is line 1.
3578 **secondary_adjust()**
3579 Attached mouse-movement events to extend the secondary
3580 selection to the mouse position.
3582 **secondary_or_drag_adjust()**
3583 Attached mouse-movement events to extend the
3584 secondary selection, or reposition the primary text being dragged. Takes two
3585 optional arguments, "copy", and "overlay". "copy" leaves a copy of the
3586 dragged text at the site at which the drag began. "overlay" does the drag in
3587 overlay mode, meaning the dragged text is laid on top of the existing text,
3588 obscuring and ultimately deleting it when the drag is complete.
3590 **secondary_or_drag_start()**
3591 To be attached to a mouse down event. Begins drag
3592 selecting a secondary selection, or dragging the contents of the primary
3593 selection, depending on whether the mouse is pressed inside of an existing
3596 **secondary_start()**
3597 To be attached to a mouse down event. Begin drag selecting
3598 a secondary selection.
3601 Select the entire file.
3604 To be attached to a key-press event, inserts the character
3605 equivalent of the key pressed.
3607 ----------------------------------------------------------------------
3615 NEdit can be customized in many different ways. The most important
3616 user-settable options are presented in the Preferences menu, including all
3617 options that users might need to change during an editing session. Options
3618 set in the Default Settings sub-menu of the Preferences menu can be preserved
3619 between sessions by selecting Save Defaults, which writes the changes to the
3620 preferences file. See the section titled "Preferences_" for more details.
3622 User defined commands can be added to NEdit's Shell, Macro, and window
3623 background menus. Dialogs for creating items in these menus can be found
3624 under Customize Menus in the Default Settings sub menu of the Preferences
3627 For users who depend on NEdit every day and want to tune every excruciating
3628 detail, there are also X resources for tuning a vast number of such details,
3629 down to the color of each individual button. See the section "X_Resources_"
3630 for more information, as well as a list of selected resources.
3632 The most common reason for customizing your X resources for NEdit, however, is
3633 key binding. While limited key binding can be done through Preferences
3634 settings (Preferences -> Default Settings -> Customize Menus), you can really
3635 only add keys this way, and each key must have a corresponding menu item.
3636 Any significant changes to key binding should be made via the Translations
3637 resource and menu accelerator resources. The sections titled "Key_Binding_"
3638 and "X_Resources_" have more information.
3639 ----------------------------------------------------------------------
3644 The Preferences menu allows you to set options for both the current editing
3645 window, and default values for newly created windows and future NEdit
3646 sessions. Options in the Preferences menu itself (not in the Default
3647 Settings sub-menu) take effect immediately and refer to the current window
3648 only. Options in the Default Settings sub-menu provide initial settings for
3649 future windows created using the New or Open commands; options affecting all
3650 windows are also set here.
3652 Preferences set in the Default Settings sub-menu are saved in a file that
3653 NEdit reads at startup time, cf. Autoload_Files_, by selecting Save Defaults.
3657 **Default Settings**
3658 Menu of initial settings for future windows. Generally the same as the
3659 options in the main part of the menu, but apply as defaults for future
3660 windows created during this NEdit session. These settings can be saved using
3661 the Save Defaults command below, to be loaded automatically each time NEdit
3665 Save the default options as set under Default Settings for future NEdit
3669 Show the full file name, line number, and length of the file being edited.
3671 **Incremental Search Line**
3672 Keep the incremental search bar (Search -> Find Incremental) permanently
3673 displayed at the top of the window.
3675 **Show Line Numbers**
3676 Display line numbers to the right of the text.
3679 Tells NEdit what language (if any) to assume, for selecting language-specific
3680 features such as highlight patterns and smart indent macros, and setting
3681 language specific preferences like word delimiters, tab emulation, and
3682 auto-indent. See Programming_with_NEdit_ for more information.
3685 Setting Auto Indent "on" maintains a running indent (pressing the Return key
3686 will line up the cursor with the indent level of the previous line). If
3687 smart indent macros are available for the current language mode, smart indent
3688 can be selected and NEdit will attempt to guess proper language indentation
3689 for each new line, cf. Auto/Smart_Indent_.
3692 Choose between two styles of automatic wrapping or none. Auto Newline wrap,
3693 wraps text at word boundaries when the cursor reaches the right margin, by
3694 replacing the space or tab at the last word boundary with a newline
3695 character. Continuous Wrap wraps long lines which extend past the right
3696 margin. Continuous Wrap mode is typically used to produce files where
3697 newlines are omitted within paragraphs, to make text filling automatic (a
3698 kind of poor-man's word processor). Text of this style is common on Macs and
3699 PCs but is not necessarily supported very well under Unix (except in programs
3700 which deal with e-mail, for which it is often the format of choice).
3703 Set margin for Auto Newline Wrap, Continuous Wrap, and Fill Paragraph. Lines
3704 may, be wrapped at the right margin of the window, or the margin can be set
3705 at a specific column.
3708 Set the tab distance (number of characters between tab stops) for tab
3709 characters, and control tab emulation and use of tab characters in padding
3713 Change the font(s) used to display text (fonts for menus and dialogs must be
3714 set using X resources for the text area of the window). See below for more
3717 **Highlight Syntax**
3718 If NEdit recognizes the language being edited, and highlighting patterns are
3719 available for that language, use fonts and colors to enhance viewing of the
3720 file. (See Syntax_Highlighting_ for more information.)
3722 **Make Backup Copy**
3723 On Save, write a backup copy of the file as it existed before the Save
3724 command with the extension .bck (Unix only).
3726 **Incremental Backup**
3727 Periodically make a backup copy of the file being edited under the name
3728 `~filename` on Unix or `_filename` on VMS (see Crash_Recovery_).
3730 **Show Matching (..)**
3731 Momentarily highlight matching parenthesis, brackets, and braces, or the
3732 range between them, when one of these characters is typed, or when the
3733 insertion cursor is positioned after it. Delimiter only highlights the
3734 matching delimiter, while Range highlights the whole range of text between
3735 the matching delimiters.
3737 Optionally, the matching can make use of syntax information if syntax
3738 highlighting is enabled. Alternatively, the matching is purely character
3739 based. In general, syntax based matching results in fewer false matches.
3742 In overtype mode, new characters entered replace the characters in front of
3743 the insertion cursor, rather than being inserted before them.
3746 Lock the file against accidental modification. This temporarily prevents the
3747 file from being modified in this NEdit session. Note that this is different
3748 from setting the file protection.
3750 3>Preferences -> Default Settings Menu
3752 Options in the Preferences -> Default Settings menu have the same meaning as
3753 those in the top-level Preferences menu, except that they apply to future
3754 NEdit windows and future NEdit sessions if saved with the Save Defaults
3755 command. Additional options which appear in this menu are:
3758 Define language recognition information (for determining language mode from
3759 file name or content) and set language specific preferences.
3762 How to react to multiple tags for the same name. Tags are described in the
3763 section: Finding_Declarations_(ctags)_. In Show All mode, all matching tags
3764 are displayed in a dialog. In Smart mode, if one of the matching tags is in
3765 the current window, that tag is chosen, without displaying the dialog.
3767 **Command Shell...**
3768 Set the shell used to run programs from the shell_command() macro function
3769 and from the Shell menu. This defaults to the user's login shell.
3772 Change the colors used to display text. The "Matching (..)" fields change the
3773 colors that matching parens, brackets and braces are flashed when the "Show
3774 Matching (..)" option is enabled. Note that the foreground colors for plain
3775 text, selected text, and matching paren flashing only apply when syntax
3776 highlighting is disabled. When syntax highlighting is enabled, text (even
3777 text that appears plain) will always be colored according to its highlighting
3778 style. (For information on changing syntax highlighting styles and matching
3779 patterns use see Syntax_Highlighting_.)
3782 Add/remove items from the Shell, Macro, and window background menus (see
3785 **Customize Window Title**
3786 Opens a dialog where the information to be displayed in the window's title
3787 field can be defined and tested. The dialog contains a Help button, providing
3788 further information about the options available.
3791 Options for controlling the behavior of Find and Replace commands:
3794 Presents search results in dialog form, asks before wrapping a
3795 search back around the beginning (or end) of the file
3796 (unless Beep On Search Wrap is turned on).
3799 Search and Replace operations wrap around the beginning (or end) of the file.
3801 ~Beep On Search Wrap~ -
3802 Beep when Search and Replace operations wrap around the beginning (or end) of
3803 the file (only if Wrap Around is turned on).
3806 Don't pop down Replace and Find boxes after searching.
3808 ~Default Search Style~ -
3809 Initial setting for search type in Find and Replace dialogs.
3811 ~Default Replace Scope~ -
3812 [THIS OPTION IS ONLY PRESENT WHEN NEDIT WAS COMPILED WITH THE
3813 -DREPLACE_SCOPE FLAG TO SELECT AN ALTERNATIVE REPLACE DIALOG LAYOUT.]
3815 Initial setting for the scope in the Replace/Find dialog, when a selection
3816 exists. It can be either "In Window", "In Selection", or "Smart". "Smart"
3817 results in "In Window" if the size of the selection is smaller than 1 line,
3818 and to "In Selection" otherwise.
3820 **Syntax Highlighting**
3821 Program and configure enhanced text display for new or supported languages.
3822 (See Syntax_Highlighting_.)
3825 Options for controlling the tabbed interface:
3827 ~Open File in New Tab~ -
3828 Open files in new tabs, else open files in new windows.
3831 Show/Hide the tab bar.
3833 ~Hide Tab Bar when only one Document is open~
3835 ~Next/Prev Tabs Across Windows~ -
3836 Suppose there are two windows with three tabs in the first window and two tabs in
3837 the second window. Enabling this option, if you are on the third tab in the
3838 first window, hitting Ctrl+PageDown would switch to the first tab in the second
3839 window (instead of switching to the first tab in the first window).
3841 ~Sort Tabs Alphabetically~
3844 Show file name and path in a tooltip when moving the mouse pointer over a tab.
3845 (See Tabbed_Editing_.)
3847 **Terminate with Line Break on Save**
3848 Some UNIX tools expect that files end with a line feed. If this option is
3849 activated, NEdit will append one if required.
3851 **Sort Open Prev. Menu**
3852 Option to order the File -> Open Previous menu alphabetically, versus in
3853 order of last access.
3855 **Popups Under Pointer**
3856 Display pop-up dialogs centered on the current mouse position, as opposed to
3857 centered on the parent window. This generally speeds interaction, and is
3858 essential for users who set their window managers so keyboard focus
3861 **Auto-Scroll Near Window Top/Bottom**
3862 When this option is enabled the window will automatically scroll when the
3863 cursor comes 4 lines from the top or bottom of the window (except at the
3864 beginning of the file). The number of lines can be customized with the
3865 nedit.autoScrollVPadding resource.
3868 Options for controlling the popping up of warning dialogs:
3870 ~File Modified Externally~ -
3871 Pop up a warning dialog when files get changed external to NEdit.
3873 ~Check Modified File Contents~ -
3874 If external file modification warnings are requested, also check the file
3875 contents iso. only the modification date.
3878 Ask before exiting when two or more files are open in an NEdit session
3879 or before closing a window with two or more tabs.
3881 **Initial Window Size**
3882 Default size for new windows.
3886 The font used to display text in NEdit is set under Preferences -> Text Font
3887 (for the current window), or Preferences -> Default Settings Text Font (for
3888 future windows). These dialogs also allow you to set fonts for syntax
3889 highlighting. If you don't intend to use syntax highlighting, you can ignore
3890 most of the dialog, and just set the field labeled Primary Font.
3892 Unless you are absolutely certain about the types of files that you will be
3893 editing with NEdit, you should choose a fixed-spacing font. Many, if not
3894 most, plain-text files are written expecting to be viewed with fixed
3895 character spacing, and will look wrong with proportional spacing. NEdit's
3896 filling, wrapping, and rectangular operations will also work strangely if you
3897 choose a proportional font.
3899 Note that in the font browser (the dialog brought up by the Browse...
3900 button), the subset of fonts which are shown is narrowed depending on the
3901 characteristics already selected. It is therefore important to know that you
3902 can unselect characteristics from the lists by clicking on the selected items
3905 Fonts for syntax highlighting should ideally match the primary font in both
3906 height and spacing. A mismatch in spacing will result in similar distortions
3907 as choosing a proportional font: column alignment will sometimes look wrong,
3908 and rectangular operations, wrapping, and filling will behave strangely. A
3909 mismatch in height will cause windows to re-size themselves slightly when
3910 syntax highlighting is turned on or off, and increase the inter-line spacing
3911 of the text. Unfortunately, on some systems it is hard to find sets of fonts
3912 which match exactly in height.
3916 You can add or change items in the Shell, Macro, and window background menus
3917 under Preferences -> Default Settings -> Customize Menus. When you choose
3918 one of these, you will see a dialog with a list of the current
3919 user-configurable items from the menu on the left. To change an existing
3920 item, select it from the list, and its properties will appear in the
3921 remaining fields of the dialog, where you may change them. Selecting the
3922 item "New" from the list allows you to enter new items in the menu.
3924 Hopefully most of the characteristics are self explanatory, but here are a
3927 Accelerator keys are keyboard shortcuts which appear on the right hand side
3928 of the menus, and allow you avoid pulling down the menu and activate the
3929 command with a single keystroke. Enter accelerators by typing the keys
3930 exactly as you would to activate the command.
3932 Mnemonics are a single letter which should be part of the menu item name,
3933 which allow users to traverse and activate menu items by typing keys when the
3934 menu is pulled down.
3936 In the Shell Command field of the Shell Commands dialog, the % character
3937 expands to the name (including directory path) of the file in the window. To
3938 include a % character in the command, use %%.
3940 The Menu Entry field can contain special characters for constructing
3941 hierarchical sub-menus, and for making items which appear only in certain
3942 language modes. The right angle bracket character ">" creates a sub-menu.
3943 The name of the item itself should be the last element of the path formed
3944 from successive sub-menu names joined with ">". Menu panes are called in to
3945 existence simply by naming them as part of a Menu Entry name. To put several
3946 items in the same sub-menu, repeat the same hierarchical sequence for each.
3947 For example, in the Macro Commands dialog, two items with menu entries: a>b>c
3948 and a>b>d would create a single sub menu under the macro menu called "a",
3949 which would contain a single sub-menu, b, holding the actual items, c and d:
3956 To qualify a menu entry with a language mode, simply add an at-sign "@@" at
3957 the end of the menu command, followed (no space) by a language mode name. To
3958 make a menu item which appears in several language modes, append additional
3959 @@s and language mode names. For example, an item with the menu entry:
3961 Make C Prototypes@@C@@C++
3963 would appear only in C and C++ language modes, and:
3965 Make Class Template@@C++
3967 would appear only in C++ mode.
3969 Menu items with no qualification appear in all language modes.
3971 If a menu item is followed by the single language qualification "@@*", that
3972 item will appear only if there are no applicable language-specific items of
3973 the same name in the same submenu. For example, if you have the following
3974 three entries in the same menu:
3976 Make Prototypes@@C@@C++
3977 Make Prototypes@@Java
3980 The first will be available when the language mode is C or C++, the second
3981 when the language mode is Java, and for all other language modes (including
3982 the "Plain" non-language mode). If the entry:
3986 also exists, this will always appear, meaning that the menu will always have
3987 two "Make Prototypes" entries, whatever the language mode.
3989 3>The NEdit Autoload Files
3991 At startup time, NEdit _automatically reads the preferences file
3992 `nedit.rc', the autoload macro file `autoload.nm', and the history data base
3993 `nedit.history'. The preferences file contains saved preferences (menu
3994 settings) in the format of an X resource file. The autoload macro file is a
3995 macro file containing macro commands and definitions that NEdit will
3996 execute at startup. (NEdit doesn't create this file automatically.)
3997 Moreover, NEdit saves a list of the recently opened files, which appear under
3998 the Open Previous menu, in the history data base.
4000 By default the location of these files is '$HOME/.nedit/'. A different
4001 directory can be given by letting the environment variable NEDIT_HOME
4004 Notice that NEdit still supports the older names for these files, which are
4005 `$HOME/.nedit', `$HOME/.neditmacro', and `$HOME/.neditdb', respectively. This
4006 old naming scheme will be used if NEdit detects that `$HOME/.nedit' is a
4007 regular file and NEDIT_HOME isn't set.
4009 (For VMS, the location of these files is '$NEDIT_HOME/' if NEDIT_HOME is set,
4010 and 'SYS$LOGIN:' otherwise.)
4012 The contents of the preferences file can be moved into another X resource
4013 file (see X_Resources_). One reason for doing so would be to attach server
4014 specific preferences, such as a default font, to a particular X server.
4015 Another reason for moving preferences into an X resource file would be to
4016 keep preferences menu options and X resource settable options together in
4017 one place. Though the files are the same format, additional resources
4018 should not be added to the preferences file, since NEdit modifies that file
4019 by overwriting it completely. Note also that the contents of the
4020 preferences file takes precedence over the values in an X resource file.
4021 Using Save Defaults after moving the contents of your preferences file to
4022 your .Xdefaults file will re-create the preferences file, interfering with
4023 the options that you have moved.
4027 3>Sharing Customizations with Other NEdit Users
4029 If you have written macro or shell menu commands, highlight patterns, or
4030 smart-indent macros that you want to share with other NEdit users, you can
4031 make a file which they can load into their NEdit environment.
4033 To load such a file, start NEdit with the command:
4035 nedit -import <file>
4037 In the new NEdit session, verify that the imported patterns or macros do what
4038 you want, then select Preferences -> Save Defaults. Saving incorporates the
4039 changes into the NEdit preferences file, so the next time you run NEdit, you
4040 will not have to import the distribution file.
4042 Loading a customization file is automated, but creating one is not. To
4043 produce a file to be imported by other users, you must make a copy of your own
4044 preferences file, and edit it, by hand, to remove everything but the
4045 few items of interest to the recipient. Leave only the individual
4046 resource(s), and within those resources, only the particular macro, pattern,
4047 style, etc, that you wish to exchange.
4049 For example, to share a highlighting pattern set, you would include the
4050 patterns, any new styles you added, and language mode information only if the
4051 patterns are intended to support a new language rather than updating an
4052 existing one. For example:
4054 nedit.highlightPatterns:\
4056 Comment:"#":"$"::Comment::\n\
4057 Loop Header:"^[ \\t]*loop:":::Loop::\n\
4059 nedit.languageModes: My Language:.my::::::
4060 nedit.styles: Loop:blue:Bold
4062 Resources are in the format of X resource files, but the format of text
4063 within multiple-item resources like highlight patterns, language modes,
4064 macros, styles, etc., are private to NEdit. Each resource is a string which
4065 ends at the first newline character not escaped with \, so you must be
4066 careful about how you treat ends of lines. While you can generally just cut
4067 and paste indented sections, if something which was originally in the middle
4068 of a resource string is now at the end, you must remove the \ line
4069 continuation character(s) so it will not join the next line into the
4070 resource. Conversely, if something which was originally at the end of a
4071 resource is now in the middle, you'll have to add continuation character(s)
4072 to make sure that the resource string is properly continued from beginning to
4073 end, and possibly newline character(s) (\n) to make sure that it is properly
4074 separated from the next item.
4075 ----------------------------------------------------------------------
4080 NEdit has additional options to those provided in the Preferences menu which
4081 are set using X resources. Like most other X programs, NEdit can be
4082 customized to vastly unnecessary proportions, from initial window positions
4083 down to the font and shadow colors of each individual button (A complete
4084 discussion of how to do this is left to books on the X Window System). Key
4085 binding (see "Key_Binding_" is one of the most useful of these resource
4088 X resources are usually specified in a file called .Xdefaults or .Xresources
4089 in your home directory (on VMS this is sys$login:decw$xdefaults.dat). On
4090 some systems, this file is read and its information attached to the X server
4091 (your screen) when you start X. On other systems, the .Xdefaults file is
4092 read each time you run an X program. When X resource values are attached to
4093 the X server, changes to the resource file are not available to application
4094 programs until you either run the xrdb program with the appropriate file as
4095 input, or re-start the X server.
4097 3>Selected X Resource Names
4099 The following are selected NEdit resource names and default values for NEdit
4100 options not settable via the Preferences menu (for preference resource names,
4101 see your NEdit preference file):
4103 **nedit.tagFile**: (not defined)
4105 This can be the name of a file, or multiple files separated by a colon (:)
4106 character, of the type produced by Exuberant Ctags or the Unix ctags
4107 command, which NEdit will load at startup time (see ctags_support_). The tag
4108 file provides a database from which NEdit can automatically open files
4109 containing the definition of a particular subroutine or data type.
4111 **nedit.alwaysCheckRelativeTagsSpecs: True**
4113 When this resource is set to True, and there are tag files specified (with
4114 the nedit.tagFile resource, see above) as relative paths, NEdit will evaluate
4115 these tag value paths whenever a file is opened. All accessible tag files
4116 will be loaded at this time. When this resource value is False, relative path
4117 tag specifications will only be evaluated at NEdit startup time.
4119 **nedit.wordDelimiters**: .,/\\`'!@@#%^&*()-=+{}[]":;<>?
4121 The set of characters which mark the boundaries between words. In addition
4122 to these, spaces, tabs, and newlines are always word boundaries.
4124 These boundaries take effect for the move-by-word (Ctrl+Arrow) and
4125 select-word (double click) commands, and for doing regex searches using the
4128 Note that this default value may be overridden by the setting in
4129 Preferences -> Default Settings -> Language Modes....
4131 **nedit.remapDeleteKey**: False
4133 Setting this resource to True forcibly maps the delete key to backspace. This
4134 can be helpful on systems where the bindings have become tangled, and in
4135 environments which mix systems with PC style keyboards and systems with DEC
4136 and Macintosh keyboards. Theoretically, these bindings should be made using
4137 the standard X/Motif mechanisms, outside of NEdit. In practice, some
4138 environments where users access several different systems remotely, can be
4139 very hard to configure. If you've given up and are using a backspace key
4140 halfway off the keyboard because you can't figure out the bindings, set this
4143 **nedit.typingHidesPointer**: False
4145 Setting this resource to True causes the mouse pointer to be hidden when you
4146 type in the text area. As soon as the mouse pointer is moved, it will
4147 reappear. This is useful to stop the mouse pointer from obscuring text.
4149 **nedit.overrideDefaultVirtualKeyBindings**: Auto
4151 Motif uses a virtual key binding mechanism that shares the bindings between
4152 different Motif applications. When a first Motif application is started, it
4153 installs some default virtual key bindings and any other Motif application
4154 that runs afterwards, simply reuses them. Obviously, if the first
4155 application installs an invalid set, all others applications may have
4158 In the past, NEdit has been the victim of invalid bindings installed by other
4159 applications several times. Through this resource, NEdit can be instructed
4160 to ignore the bindings installed by other applications, and use its own
4161 private bindings. By default, NEdit tries to detect invalid bindings
4162 and ignore them automatically (Auto). Optionally, NEdit can be told to
4163 always keep the installed bindings (Never), or to always override them
4166 **nedit.stdOpenDialog**: False
4168 Setting this resource to True restores the standard Motif style of Open
4169 dialog. NEdit file open dialogs are missing a text field at the bottom of
4170 the dialog, where the file name can be entered as a string. The field is
4171 removed in NEdit to encourage users to type file names in the list, a
4172 non-standard, but much faster method for finding files.
4174 **nedit.bgMenuButton**: @~Shift@~Ctrl@~Meta@~Alt<Btn3Down>
4176 Specification for mouse button / key combination to post the background menu
4177 (in the form of an X translation table event specification). The event
4178 specification should be as specific as possible, since it will override less
4179 specific translation table entries.
4181 **nedit.maxPrevOpenFiles**: 30
4183 Number of files listed in the Open Previous sub-menu of the File menu.
4184 Setting this to zero disables the Open Previous menu item and maintenance of
4185 the NEdit file history file.
4187 **nedit.printCommand**: (system specific)
4189 Command used by the print dialog to print a file, such as, lp, lpr, etc..
4190 The command must be capable of accepting input via stdin (standard input).
4192 **nedit.printCopiesOption**: (system specific)
4194 Option name used to specify multiple copies to the print command. If the
4195 option should be separated from its argument by a space, leave a trailing
4196 space. If blank, no "Number of Copies" item will appear in the print dialog.
4198 **nedit.printQueueOption**: (system specific)
4200 Option name used to specify a print queue to the print command. If the
4201 option should be separated from its argument by a space, leave a trailing
4202 space. If blank, no "Queue" item will appear in the print dialog.
4204 **nedit.printNameOption**: (system specific)
4206 Option name used to specify a job name to the print command. If the option
4207 should be separated from its argument by a space, leave a trailing space. If
4208 blank, no job or file name will be attached to the print job or banner page.
4210 **nedit.printHostOption**: (system specific)
4212 Option name used to specify a host name to the print command. If the option
4213 should be separated from its argument by a space, leave a trailing space. If
4214 blank, no "Host" item will appear in the print dialog.
4216 **nedit.printDefaultQueue**: (system specific)
4218 The name of the default print queue. Used only to display in the print
4219 dialog, and has no effect on printing.
4221 **nedit.printDefaultHost**: (system specific)
4223 The node name of the default print host. Used only to display in the print
4224 dialog, and has no effect on printing.
4226 **nedit.visualID**: Best
4228 If your screen supports multiple visuals (color mapping models), this
4229 resource allows you to manually choose among them. The default value of
4230 "Best" chooses the deepest (most colors) visual available. Since NEdit does
4231 not depend on the specific characteristics of any given color model, Best
4232 probably IS the best choice for everyone, and the only reason for setting
4233 this resource would be to patch around some kind of X server problem. The
4234 resource may also be set to "Default", which chooses the screen's default
4235 visual (often a color-mapped, PseudoColor, visual for compatibility with
4236 older X applications). It may also be set to a numeric visual-id value (use
4237 xdpyinfo to see the list of visuals supported by your display), or a visual
4238 class name: PseudoColor, DirectColor, TrueColor, etc..
4240 If you are running under a themed environment (like KDE or CDE) that places
4241 its colors in a shallow visual, and you'd rather have that color scheme
4242 instead of more colors available, then you may need set the visual to
4243 "Default" so that NEdit doesn't choose one with more colors. (The reason
4244 for this is: if the "best" visual is not the server's default, then NEdit
4245 cannot use the colors provided by your environment. NEdit will fall back to
4246 its own default color scheme.)
4248 **nedit.installColormap**: False
4250 Force the installation of a private colormap. If you have a humble 8-bit
4251 color display, and netscape is hogging all of the color cells, you may want
4252 to try turning this on. On most systems, this will result in colors flashing
4253 wildly when you switch between NEdit and other applications. But a few
4254 systems (SGI) have hardware support for multiple simultaneous colormaps, and
4255 applications with installed colormaps are well behaved.
4257 **nedit.findReplaceUsesSelection**: False
4259 Controls if the Find and Replace dialogs are automatically loaded with the
4260 contents of the primary selection.
4262 **nedit.stickyCaseSenseButton**: True
4264 Controls if the "Case Sensitive" buttons in the Find and Replace dialogs and
4265 the incremental search bar maintain a separate state for literal and regular
4266 expression searches. Moreover, when set to True, by default literal searches
4267 are case insensitive and regular expression searches are case sensitive. When
4268 set to False, the "Case Sensitive" buttons are independent of the "Regular
4271 **nedit.multiClickTime**: (system specific)
4273 Maximum time in milliseconds allowed between mouse clicks within double and
4274 triple click actions.
4276 **nedit.undoModifiesSelection**: True
4278 By default, NEdit selects any text inserted or changed through a undo/redo
4279 action. Set this resource to False if you don't want your selection to be
4282 **nedit@*scrollBarPlacement**: BOTTOM_RIGHT
4284 How scroll bars are placed in NEdit windows, as well as various lists and
4285 text fields in the program. Other choices are: BOTTOM_LEFT, TOP_LEFT, or
4288 **nedit@*text.autoWrapPastedText**: False
4290 When Auto Newline Wrap is turned on, apply automatic wrapping (which
4291 normally only applies to typed text) to pasted text as well.
4293 **nedit@*text.heavyCursor**: False
4295 For monitors with poor resolution or users who have difficulty seeing the
4296 cursor, makes the cursor in the text editing area of the window heavier and
4299 **nedit.autoScrollVPadding**: 4
4301 Number of lines to keep the cursor away from the top or bottom line of the
4302 window when the "Auto-Scroll Near Window Top/Bottom" feature is enabled.
4303 Keyboard operations that would cause the cursor to get closer than
4304 this distance cause the window to scroll up or down instead, except at the
4305 beginning of the file. Mouse operations are not affected.
4307 **nedit@*text.blinkRate**: 500
4309 Blink rate of the text insertion cursor in milliseconds. Set to zero to stop
4312 **nedit@*text.Translations**:
4314 Modifies key bindings (see "Key_Binding_").
4316 **nedit@*foreground**: black
4318 Default foreground color for menus, dialogs, scroll bars, etc..
4320 **nedit@*background**: #b3b3b3
4322 Default background color for menus, dialogs, scroll bars, etc..
4324 **nedit@*calltipForeground**: black
4326 Foreground color for calltips
4328 **nedit@*calltipBackground**: LemonChiffon1
4330 Background color for calltips
4332 **nedit@*XmLFolder.inactiveForeground**: #666
4334 Foreground color for inactive tabs.
4336 **nedit@*fontList**: helvetica medium 12 points
4338 Default font for menus, dialogs, scroll bars, etc..
4340 **nedit.helpFont**: helvetica medium 12 points
4342 Font used for displaying online help.
4344 **nedit.boldHelpFont**: helvetica bold 12 points
4346 Bold font for online help.
4348 **nedit.italicHelpFont**: helvetica italic 12 points
4350 Italic font for online help.
4352 **nedit.fixedHelpFont**: courier medium 12 points
4354 Fixed font for online help.
4356 **nedit.boldFixedHelpFont**: courier bold 12 points
4358 Fixed bold for online help.
4360 **nedit.italicFixedHelpFont**: courier italic 12 points
4362 Fixed italic font for online help.
4364 **nedit.h1HelpFont**: helvetica bold 14 points
4366 Font for level-1 titles in help text.
4368 **nedit.h2HelpFont**: helvetica bold italic 12 points
4370 Font for level-2 titles in help text.
4372 **nedit.h3HelpFont**: courier bold 12 points
4374 Font for level-3 titles in help text.
4376 **nedit.helpLinkFont**: helvetica medium 12 points
4378 Font for hyperlinks in the help text
4380 **nedit.helpLinkColor**: #009900
4382 Color for hyperlinks in the help text
4384 **nedit.backlightCharTypes**: 0-8,10-31,127:red;9:#dedede;32,160-255:#f0f0f0;128-159:orange
4386 **NOTE: backlighting is ~experimental~** (see "Programming_with_NEdit_").
4388 A string specifying character classes as ranges of ASCII values followed by
4389 the color to be used as their background colors. The format is:
4391 low[-high]{,low[-high]}:color{;low-high{,low[-high]}:color}
4393 where low and high are ASCII values.
4396 32-255:#f0f0f0;1-31,127:red;128-159:orange;9-13:#e5e5e5
4399 .. The macro built-in function set_backlight_string() allows these strings to be
4400 .. set for a particular window.
4402 **nedit.focusOnRaise**: False
4404 This resource determines whether new text windows and text windows that are
4405 raised, should also request the input focus. Conventionally, it is the task
4406 of the window manager to decide on which window gets the input focus.
4407 Therefore, NEdit's default behaviour is not to request the input focus
4410 **nedit.forceOSConversion**: True
4412 By default, NEdit converts texts in DOS or Mac format to an internal
4413 format using simple newlines as line dividers. This is sometimes not
4414 wanted by the user and can be prevented by setting this resource to
4417 Note: Setting this to False would supress newlines in Mac files entirely,
4418 leaving the control character <cr> where every line feed would be. Mac OS
4419 X uses Unix files and is not affected.
4421 Note: Setting this to False while the option 'Terminate with Line Break
4422 on Save' is active could lead to file corruption.
4424 **nedit.truncSubstitution**: Fail
4426 NEdit has a fixed limit on substitution result string length. This
4427 resource modifies the behaviour if this limit is exceeded. Possible
4428 values are ~Silent~ (will silently fail the operation), ~Fail~ (will fail
4429 the operation and pop up a dialog informing the user), ~Warn~ (pops up a
4430 dialog warning the user, offering to cancel the operation) and ~Ignore~
4431 (will silently conclude the operation).
4433 **WARNING**: Setting this to 'Ignore' will destroy data without warning!
4435 **nedit.honorSymlinks**: True
4437 If set to True, NEdit will open a requested file on disk even if it is a
4438 symlink pointing to a file already opened in another window. If set to false,
4439 NEdit will try to detect these cases and just pop up the already opened
4442 **nc.autoStart**: True
4444 Whether the nc program should automatically start an NEdit server (without
4445 prompting the user) if an appropriate server is not found.
4447 **nc.serverCommand**: nedit -server
4449 Command used by the nc program to start an NEdit server.
4453 Basic time-out period used in communication with an NEdit server (seconds).
4455 ----------------------------------------------------------------------
4456 ~The following are Selected widget names (to which you may append~
4457 ~.background, .foreground, .fontList, etc., to change colors, fonts~
4458 ~ and other characteristics):~
4460 **nedit@*statsAreaForm**
4462 Statistics line and incremental search bar. To get consistent results across
4463 the entire stats line and the incremental search bar, use '*' rather than '.'
4464 to separate the resource name. For example, to set the foreground color of
4465 both components use:
4466 nedit*statsAreaForm*foreground
4468 nedit*statsAreaForm.foreground
4472 Top-of-window menu-bar.
4474 **nedit@*textHorScrollBar**
4476 Horizontal scroll bar.
4478 **nedit@*textVertScrollBar**
4480 Vertical scroll bar.
4481 ----------------------------------------------------------------------
4486 There are several ways to change key bindings in NEdit. The easiest way to
4487 add a new key binding in NEdit is to define a macro in Preferences -> Default
4488 Settings -> Customize Menus -> Macro Menu. However, if you want to change
4489 existing bindings or add a significant number of new key bindings you will
4490 need to do so via X resources.
4492 Before reading this section, you must understand how to set X resources (see
4493 the help section "X_Resources_"). Since setting X resources is tricky, it is
4494 also helpful when working on key-binding, to set some easier-to-verify
4495 resource at the same time, as a simple check that the NEdit program is
4496 actually seeing your changes. The appres program is also very helpful in
4497 checking that the resource settings that you make, actually reach the program
4498 for which they are intended in the correct form.
4500 3>Key Binding in General
4502 Keyboard commands are associated with editor action routines through two
4503 separate mechanisms in NEdit. Commands which appear in pull-down menus have
4504 individual resources designating a keyboard equivalent to the menu command,
4505 called an accelerator key. Commands which do not have an associated menu
4506 item are bound to keys via the X toolkit translation mechanism. The methods
4507 for changing these two kinds of bindings are quite different.
4509 3>Key Binding Via Translations
4511 The most general way to bind actions to keys in NEdit is to use the
4512 translation table associated with the text widget. To add a binding to Alt+Y
4513 to insert the string "Hi!", for example, add lines similar to the following
4514 to your X resource file:
4516 NEdit*text.Translations: #override \n\
4517 Alt<Key>y: insert_string("Hi!") \n
4519 The Help topic "Action_Routines_" lists the actions available to be bound.
4521 Translation tables map key and mouse presses, window operations, and other
4522 kinds of events, to actions. The syntax for translation tables is
4523 simplified here, so you may need to refer to a book on the X window system
4524 for more detailed information.
4526 Note that accelerator resources (discussed below) override translations, and
4527 that most Ctrl+letter and Alt+letter combinations are already bound to an
4528 accelerator key. To use one of these combinations from a translation table,
4529 therefore, you must first un-bind the original menu accelerator.
4531 A resource for changing a translation table consists of a keyword; #override,
4532 #augment, or #replace; followed by lines (separated by newline characters)
4533 pairing events with actions. Events begin with modifiers, like Ctrl, Shift,
4534 or Alt, followed by the event type in <>. BtnDown, Btn1Down, Btn2Down,
4535 Btn1Up, Key, KeyUp are valid event types. For key presses, the event type is
4536 followed by the name of the key. You can specify a combination of events,
4537 such as a sequence of key presses, by separating them with commas. The other
4538 half of the event/action pair is a set of actions. These are separated from
4539 the event specification by a colon and from each other by spaces. Actions
4540 are names followed by parentheses, optionally containing one or more
4541 parameters separated by comas.
4543 3>Changing Menu Accelerator Keys
4545 The menu shortcut keys shown at the right of NEdit menu items can also be
4546 changed via X resources. Each menu item has two resources associated with
4547 it, accelerator, the event to trigger the menu item; and acceleratorText, the
4548 string shown in the menu. The form of the accelerator resource is the same
4549 as events for translation table entries discussed above, though multiple keys
4550 and other subtleties are not allowed. The resource name for a menu is the
4551 title in lower case, followed by "Menu", the resource name of menu item is
4552 the name in lower case, run together, with words separated by caps, and all
4553 punctuation removed. For example, to change Cut to Ctrl+X, you would add the
4554 following to your .Xdefaults file:
4556 nedit*editMenu.cut.accelerator: Ctrl<Key>x
4557 nedit*editMenu.cut.acceleratorText: Ctrl+X
4559 Accelerator keys with optional shift key modifiers, like Find..., have an
4560 additional accelerator resource with Shift appended to the name. For
4563 nedit*searchMenu.find.acceleratorText: [Shift]Alt+F
4564 nedit*searchMenu.find.accelerator: Alt<Key>f
4565 nedit*searchMenu.findShift.accelerator: Shift Alt<Key>f
4566 ----------------------------------------------------------------------
4568 Highlighting Patterns
4569 ---------------------
4571 3>Writing Syntax Highlighting Patterns
4573 Patterns are the mechanism by which language syntax highlighting is
4574 implemented in NEdit (see Syntax_Highlighting_ under the heading of Features
4575 for Programming). To create syntax highlighting patterns for a new
4576 language, or to modify existing patterns, select "Recognition Patterns" from
4577 "Syntax Highlighting" sub-section of the "Default Settings" sub-menu of the
4580 First, a word of caution. As with regular expression matching in general, it
4581 is quite possible to write patterns which are so inefficient that they
4582 essentially lock up the editor as they recursively re-examine the entire
4583 contents of the file thousands of times. With the multiplicity of patterns,
4584 the possibility of a lock-up is significantly increased in syntax
4585 highlighting. When working on highlighting patterns, be sure to save your
4588 NEdit's syntax highlighting is unusual in that it works in real-time (as you
4589 type), and yet is completely programmable using standard regular expression
4590 notation. Other syntax highlighting editors usually fall either into the
4591 category of fully programmable but unable to keep up in real-time, or
4592 real-time but limited programmability. The additional burden that NEdit
4593 places on pattern writers in order to achieve this speed/flexibility mix, is
4594 to force them to state self-imposed limitations on the amount of context that
4595 patterns may examine when re-parsing after a change. While the "Pattern
4596 Context Requirements" heading is near the end of this section, it is not
4597 optional, and must be understood before making any serious effort at
4600 In its simplest form, a highlight pattern consists of a regular expression to
4601 match, along with a style representing the font an color for displaying any
4602 text which matches that expression. To bold the word, "highlight", wherever
4603 it appears the text, the regular expression simply would be the word
4604 "highlight". The style (selected from the menu under the heading of
4605 "Highlight Style") determines how the text will be drawn. To bold the text,
4606 either select an existing style, such as "Keyword", which bolds text, or
4607 create a new style and select it under Highlight Style.
4609 The full range of regular expression capabilities can be applied in such a
4610 pattern, with the single caveat that the expression must conclusively match
4611 or not match, within the pre-defined context distance (as discussed below
4612 under Pattern Context Requirements).
4614 To match longer ranges of text, particularly any constructs which exceed the
4615 requested context, you must use a pattern which highlights text between a
4616 starting and ending regular expression match. To do so, select "Highlight
4617 text between starting and ending REs" under "Matching", and enter both a
4618 starting and ending regular expression. For example, to highlight everything
4619 between double quotes, you would enter a double quote character in both the
4620 starting and ending regular expression fields. Patterns with both a
4621 beginning and ending expression span all characters between the two
4622 expressions, including newlines.
4624 Again, the limitation for automatic parsing to operate properly is that both
4625 expressions must match within the context distance stated for the pattern
4628 With the ability to span large distances, comes the responsibility to recover
4629 when things go wrong. Remember that syntax highlighting is called upon to
4630 parse incorrect or incomplete syntax as often as correct syntax. To stop a
4631 pattern short of matching its end expression, you can specify an error
4632 expression, which stops the pattern from gobbling up more than it should.
4633 For example, if the text between double quotes shouldn't contain newlines,
4634 the error expression might be "$". As with both starting and ending
4635 expressions, error expressions must also match within the requested context
4638 4>Coloring Sub-Expressions
4640 It is also possible to color areas of text within a regular expression
4641 match. A pattern of this type associates a style with sub-expressions
4642 references of the parent pattern (as used in regular expression substitution
4643 patterns, see the NEdit Help menu item on Regular_Expressions_).
4644 Sub-expressions of both the starting and ending patterns may be colored. For
4645 example, if the parent pattern has a starting expression "\<", and end
4646 expression "\>", (for highlighting all of the text contained within angle
4647 brackets), a sub-pattern using "&" in both the starting and ending expression
4648 fields could color the brackets differently from the intervening text. A
4649 quick shortcut to typing in pattern names in the Parent Pattern field is to
4650 use the middle mouse button to drag them from the Patterns list.
4652 In some cases, there can be interference between coloring sub-patterns and
4653 hierarchical sub-patterns (discussed next). How this is resolved, is
4656 4>Hierarchical Patterns
4658 A hierarchical sub-pattern, is identical to a top level pattern, but is
4659 invoked only between the starting and ending expression matches of its
4660 parent pattern or, in case the parent pattern consists of a single
4661 expression, inside the text area matching that expression. Like the
4662 sub-expression coloring patterns discussed above, it is associated with a
4663 parent pattern using the Parent Pattern field in the pattern specification.
4664 Pattern names can be dragged from the pattern list with the middle mouse
4665 button to the Parent Pattern field.
4667 The matching behaviour for sub-patterns is slightly different, depending on
4668 whether the parent pattern consists of a single expression or has both a
4669 starting and an ending expression.
4671 In case the parent pattern consists of a single expression, and the syntax
4672 highlighting parser finds a match for that expression, sub-patterns are
4673 matched between the start and the end of the parent match. Sub-patterns
4674 cannot extend beyond the boundaries of the parent's match nor can they
4675 affect those boundaries (the latter can happen for starting/ending parent
4676 patterns, see below). Note that sub-patterns can ~peek~ beyond the
4677 parent's matching boundaries by means of look-ahead or look-behind
4680 In case the parent pattern is a starting/ending style pattern, after the
4681 start expression of the parent pattern matches, the syntax highlighting
4682 parser searches for either the parent's end pattern or a matching
4683 sub-pattern. When a sub-pattern matches, control is not returned to the
4684 parent pattern until the entire sub-pattern has been parsed, regardless of
4685 whether the parent's end pattern appears in the text matched by the
4686 sub-pattern. In this way, matching of the parent's ending pattern can be
4687 postponed, in contrast to the case where the parent pattern consists of a
4688 single expression. Note that, in this case, parsing of sub-patterns starts
4689 **after** the match of the parent pattern's starting expression, also in
4690 contrast to the single-expression case.
4692 The most common use for this capability is for coloring sub-structure of
4693 language constructs (smaller patterns embedded in larger patterns).
4694 Hierarchical patterns can also simplify parsing by having sub-patterns "hide"
4695 special syntax from parent patterns, such as special escape sequences or
4698 There is no depth limit in nesting hierarchical sub-patterns, but beyond the
4699 third level of nesting, automatic re-parsing will sometimes have to re-parse
4700 more than the requested context distance to guarantee a correct parse (which
4701 can slow down the maximum rate at which the user can type if large sections
4702 of text are matched only by deeply nested patterns).
4704 While this is obviously not a complete hierarchical language parser it is
4705 still useful in many text coloring situations. As a pattern writer, your
4706 goal is not to completely cover the language syntax, but to generate
4707 colorings that are useful to the programmer. Simpler patterns are usually
4708 more efficient and also more robust when applied to incorrect code.
4710 Note that in case of a single-expression parent pattern, there is a
4711 potential for conflicts between coloring-only sub-patterns and hierarchical
4712 sub-patterns (which cannot happen for starting/ending type of patterns,
4713 because sub-patterns are matched **between** the starting and ending pattern
4714 (not included)). Due to the different nature of these two kinds of
4715 sub-patterns, it is technically infeasible to follow the standard matching
4716 precedence rules, where a sub-pattern has precedence over the sub-patterns
4717 following it. Instead, coloring-only sub-patterns are always colored last,
4718 ie., they may override the coloring for overlapping sibling sub-patterns in
4719 the overlapping parts of the matches.
4721 4>Deferred (Pass-2) Parsing
4723 NEdit does pattern matching for syntax highlighting in two passes. The first
4724 pass is applied to the entire file when syntax highlighting is first turned
4725 on, and to new ranges of text when they are initially read or pasted in. The
4726 second pass is applied only as needed when text is exposed (scrolled in to
4729 If you have a particularly complex set of patterns, and parsing is beginning
4730 to add a noticeable delay to opening files or operations which change large
4731 regions of text, you can defer some of that parsing from startup time, to
4732 when it is actually needed for viewing the text. Deferred parsing can only
4733 be used with single expression patterns, or begin/end patterns which match
4734 entirely within the requested context distance. To defer the parsing of a
4735 pattern to when the text is exposed, click on the Pass-2 pattern type button
4736 in the highlight patterns dialog.
4738 Sometimes a pattern can't be deferred, not because of context requirements,
4739 but because it must run concurrently with pass-1 (non-deferred) patterns. If
4740 they didn't run concurrently, a pass-1 pattern might incorrectly match some
4741 of the characters which would normally be hidden inside of a sequence matched
4742 by the deferred pattern. For example, C has character constants enclosed in
4743 single quotes. These typically do not cross line boundaries, meaning they
4744 can be parsed entirely within the context distance of the C pattern set and
4745 should be good candidates for deferred parsing. However, they can't be
4746 deferred because they can contain sequences of characters which can trigger
4747 pass-one patterns. Specifically, the sequence, '\"', contains a double quote
4748 character, which would be matched by the string pattern and interpreted as
4749 introducing a string.
4751 4>Pattern Context Requirements
4753 The context requirements of a pattern set state how much additional text
4754 around any change must be examined to guarantee that the patterns will match
4755 what they are intended to match. Context requirements are a promise by NEdit
4756 to the pattern writer, that the regular expressions in his/her patterns will
4757 be matched against at least <line context> lines and <character context>
4758 characters, around any modified text. Combining line and character
4759 requirements guarantee that both will be met.
4761 Automatic re-parsing happens on EVERY KEYSTROKE, so the amount of context
4762 which must be examined is very critical to typing efficiency. The more
4763 complicated your patterns, the more critical the context becomes. To cover
4764 all of the keywords in a typical language, without affecting the maximum rate
4765 at which users can enter text, you may be limited to just a few lines and/or
4766 a few hundred characters of context.
4768 The default context distance is 1 line, with no minimum character
4769 requirement. There are several benefits to sticking with this default. One
4770 is simply that it is easy to understand and to comply with. Regular
4771 expression notation is designed around single line matching. To span lines
4772 in a regular expression, you must explicitly mention the newline character
4773 "\n", and matches which are restricted to a single line are virtually immune
4774 to lock-ups. Also, if you can code your patterns to work within a single
4775 line of context, without an additional character-range context requirement,
4776 the parser can take advantage the fact that patterns don't cross line
4777 boundaries, and nearly double its efficiency over a one-line and 1-character
4778 context requirement. (In a single line context, you are allowed to match
4779 newlines, but only as the first and/or last character.)
4780 ----------------------------------------------------------------------
4785 Smart indent macros can be written for any language, but are usually more
4786 difficult to write than highlighting patterns. A good place to start, of
4787 course, is to look at the existing macros for C and C++.
4789 Smart indent macros for a language mode consist of standard NEdit macro
4790 language code attached to any or all of the following three activation
4791 conditions: 1) When smart indent is first turned on for a text window
4792 containing code of the language, 2) When a newline is typed and smart indent
4793 is expected, 3) after any character is typed. To attach macro code to any of
4794 these code "hooks", enter it in the appropriate section in the Preferences ->
4795 Default Settings -> Auto Indent -> Program Smart Indent dialog.
4797 Typically most of the code should go in the initialization section, because
4798 that is the appropriate place for subroutine definitions, and smart indent
4799 macros are complicated enough that you are not likely to want to write them
4800 as one monolithic run of code. You may also put code in the Common/Shared
4801 Initialization section (accessible through the button in the upper left
4802 corner of the dialog). Unfortunately, since the C/C++ macros also reside in
4803 the common/shared section, when you add code there, you run some risk of
4804 missing out on future upgrades to these macros, because your changes will
4805 override the built-in defaults.
4807 The newline macro is invoked after the user types a newline, but before the
4808 newline is entered in the buffer. It takes a single argument ($1) which is
4809 the position at which the newline will be inserted. It must return the
4810 number of characters of indentation the line should have, or -1. A return
4811 value of -1 means to do a standard auto-indent. You must supply a newline
4812 macro, but the code: "return -1" (auto-indent), or "return 0" (no indent) is
4815 The type-in macro takes two arguments. $1 is the insert position, and $2 is
4816 the character just typed, and does not return a value. It also is invoked
4817 before the character is inserted into the buffer. You can do just about
4818 anything here, but keep in mind that this macro is executed for every
4819 keystroke typed, so if you try to get too fancy, you may degrade performance.
4820 ----------------------------------------------------------------------
4825 .. ? help !!#ifndef VMS
4826 **nedit** [-**read**] [-**create**] [-**line** n | +n] [-**server**]
4827 [-**do** command] [-**tags** file] [-**tabs** n] [-**wrap**]
4828 [-**nowrap**] [-**autowrap**] [-**autoindent**] [-**noautoindent**]
4829 [-**autosave**] [-**noautosave**] [-**rows** n] [-**columns** n]
4830 [-**font** font] [-**lm** languagemode] [-**geometry** geometry]
4831 [-**iconic**] [-**noiconic**] [-**display** [host]:server[.screen]
4832 [-**xrm** resourcestring] [-**svrname** name] [-**import** file]
4833 [-**background** color] [-**foreground** color] [-**h**|-**help**]
4834 [-**tabbed**] [-**untabbed**] [-**group**] [-**V**|-**version**]
4838 Open the file Read Only regardless of the actual file protection.
4841 Don't warn about file creation when a file doesn't exist.
4847 Designate this session as an NEdit server, for processing commands from the
4848 nc program. nc can be used to interface NEdit to code development
4849 environments, mailers, etc., or just as a quick way to open files from the
4850 shell command line without starting a new NEdit session.
4853 Execute an NEdit macro or action on the file following the -do argument on
4854 the command line. -do is particularly useful from the nc program, where
4855 nc -do can remotely execute commands in an NEdit -server session.
4858 Load a file of directions for finding definitions of program subroutines and
4859 data objects. The file must be of the format generated by Exuberant Ctags,
4860 or the standard Unix ctags command.
4863 Set tab stops every n characters.
4866 Wrap long lines at the right edge of the window rather than continuing them
4867 past it. (Continuous Wrap mode)
4869 **-autowrap, -noautowrap**
4870 Wrap long lines when the cursor reaches the right edge of the window by
4871 inserting newlines at word boundaries. (Auto Newline Wrap mode)
4873 **-autoindent, -noautoindent**
4874 Maintain a running indent.
4876 **-autosave, -noautosave**
4877 Maintain a backup copy of the file being edited under the name '~filename'.
4880 Default height in characters for an editing window.
4883 Default width in characters for an editing window.
4885 **-font font (or -fn font)**
4886 Font for text being edited (Font for menus and dialogs can be set with -xrm
4889 **-lm languagemode**
4890 Initial language mode used for editing succeeding files.
4892 **-geometry geometry (or -g geometry)**
4893 The initial size and/or location of editor windows. The argument geometry
4896 [<width>x<height>][+|-][<xoffset>[+|-]<yoffset>]
4898 where <width> and <height> are the desired width and height of the window,
4899 and <xoffset> and <yoffset> are the distance from the edge of the screen to
4900 the window, + for top or left, - for bottom or right. -geometry can be
4901 specified for individual files on the command line.
4903 **-iconic, -noiconic**
4904 Initial window state for succeeding files.
4906 **-display [host]:server[.screen]**
4907 The name of the X server to use. host specifies the machine, server
4908 specifies the display server number, and screen specifies the screen number.
4909 host or screen can be omitted and default to the local machine, and screen 0.
4911 **-background color (or -bg color)**
4912 User interface background color. (Background color for text can be set
4913 separately with -xrm "nedit.textBgColor: color" or using the Preferences ->
4916 **-foreground color (or -fg color)**
4917 User interface foreground color. (Foreground color for text can be set
4918 separately with -xrm "nedit.textFgColor: color" or using the Preferences
4922 Open all subsequent files in new tabs. Resets -group option.
4925 Open all subsequent files in new windows. Resets -group option. Note
4926 that this only works on subsequent files in this command and does not put
4927 NEdit in tab-less mode; for that you can use the command
4928 nedit -xrm "nedit.openInTab: False" -xrm "nedit.tabBarHideOne: True"
4929 This will affect your default settings for the session, and will be saved
4930 if Preferences->Save Defaults... is used, which may not be desired.
4933 Open all subsequent files as tabs in a new window.
4935 **-xrm resourcestring**
4936 Set the value of an X resource to override a default
4937 value (see "Customizing_NEdit_").
4940 When starting NEdit in server mode, name the server, such that it responds to
4941 requests only when nc is given a corresponding -svrname argument. By naming
4942 servers, you can run several simultaneously, and direct files and commands
4943 specifically to any one. Specifying a non-empty name automatically designates
4944 this session as an NEdit server, as though -server were specified.
4947 Loads an additional preferences file on top of the existing defaults saved in
4948 your preferences file. To incorporate macros, language modes, and highlight
4949 patterns and styles written by other users, run NEdit with -import <file>,
4950 then re-save your preferences file with Preferences -> Save Defaults.
4953 Prints out the NEdit version information. The -V option is synonymous.
4956 Prints out the NEdit command line help. The -h option is synonymous.
4959 Treats all subsequent arguments as file names, even if they start with a
4960 dash. This is so NEdit can access files that begin with the dash character.
4965 .. This documentation for VMS NEdit usage should only appear in the
4966 .. generated help code, not in any of the printed documentation.
4967 .. Reasoning is that VMS usage is diminishing and there is a desire
4968 .. to not clutter up the printed documentation here.
4970 NEDIT [filespec[,...]]
4972 The following qualifiers are accepted:
4975 Open the file Read Only regardless of the actual file protection.
4978 Don't warn about file creation when a file doesn't exist.
4984 Designate this session as an NEdit server for processing commands from the nc
4985 program. The nc program can be used to interface NEdit to code development
4986 environments, mailers, etc., or just as a quick way to open files from the
4987 shell command line without starting a new NEdit session.
4990 Execute an NEdit action routine. on each file following the /do argument on
4991 the command line. /do is particularly useful from the nc program, where nc
4992 /do can remotely execute commands in an nedit /server session.
4995 Load a file of directions for finding definitions of program subroutines and
4996 data objects. The file must be of the format generated by the Unix ctags
5000 Wrap long lines at the right edge of the window rather than continuing them
5001 past it. (Continuous Wrap mode)
5003 **/autowrap, /noautowrap**
5004 Wrap long lines when the cursor reaches the right edge of the window by
5005 inserting newlines at word boundaries. (Auto Newline Wrap mode)
5007 **/autoindent, /noautoindent**
5008 Maintain a running indent.
5010 **/autosave, /noautosave**
5011 Maintain a backup copy of the file being edited under the name '_filename'.
5014 Default width in characters for an editing window.
5017 Default height in characters for an editing window.
5019 **/font=font (or /fn=font)**
5020 Font for text being edited (Font for menus and dialogs can be set with
5021 /xrm="*fontList:font").
5023 **/display [host]:server[.screen]**
5024 The name of the X server to use. host specifies the machine, server
5025 specifies the display server number, and screen specifies the screen number.
5026 host or screen can be omitted and default to the local machine, and screen 0.
5028 **/geometry=geometry (or /g=geometry)**
5029 The initial size and/or location of editor windows. The argument geometry
5032 [<width>x<height>][+|-][<xoffset>[+|-]<yoffset>]
5034 where <width> and <height> are the desired width and height of the window,
5035 and <xoffset> and <yoffset> are the distance from the edge of the screen to
5036 the window, + for top or left, - for bottom or right.
5038 **/background=color (or /bg=color)**
5040 Background color. (background color for text can be set separately with
5041 /xrm="nedit:textBgColor color" or using the Preferences ->
5044 **/foreground=color (or /fg=color)**
5045 Foreground color. (foreground color for text can be set separately with
5046 /xrm="nedit:textFgColor color" or using the Preferences ->
5050 Open all subsequent files in new tabs. Resets /group option.
5053 Open all subsequent files in new windows. Resets /group option.
5056 Open all subsequent files as tabs in a new window.
5058 **/xrm=resourcestring**
5059 Set the value of an X resource to override a default value
5060 (see Customizing NEdit).
5063 When starting nedit in server mode, name the server, such that it responds to
5064 requests only when nc is given a corresponding -svrname argument. By naming
5065 servers, you can run several simultaneously, and direct files and commands
5066 specifically to any one.
5069 Loads an additional preferences file on top of the existing defaults saved in
5070 your .nedit file. To incorporate macros, language modes, and highlight
5071 patterns and styles written by other users, run nedit with /import=<file>,
5072 then re-save your .nedit file with Preferences -> Save Defaults.
5074 Unix-style command lines (but not file names) are also acceptable:
5076 nedit -rows 20 -wrap file1.c file2.c
5080 nedit /rows=20/wrap file1.c, file2.c",
5083 ----------------------------------------------------------------------
5088 NEdit can be operated on its own, or as a two-part client/server
5089 application. Client/server mode is useful for integrating NEdit with
5090 software development environments, mailers, and other programs; or just as a
5091 quick way to open files from the shell command line without starting a new
5094 To run NEdit in server mode, type:
5098 NEdit can also be started in server mode via the NEdit Client program
5099 (**nc**) when no servers are available.
5101 The nc program, which is distributed along with NEdit, sends commands to
5102 an NEdit server to open files or execute editor actions. It can also be
5103 used on files that are already opened.
5105 Listing a file on the nc command line means: Open it if it is not already
5106 open and bring the window to the front.
5109 nc supports the following command line options:
5111 **nc** [**-read**] [**-create**]
5112 [**-line** n | **+**n] [**-do** command] [**-lm** languagemode]
5113 [**-svrname** name] [**-svrcmd** command]
5114 [**-ask**] [**-noask**] [**-timeout** seconds]
5115 [**-geometry** geometry | **-g** geometry] [**-icon** | **-iconic**]
5116 [-**tabbed**] [-**untabbed**] [-**group**] [**-wait**]
5117 [**-V** | **-version**]
5118 [**-xrm** resourcestring] [**-display** [host]:server[.screen]]
5122 Open the file read-only regardless of its actual permissions. There is no
5123 effect if the file is already open.
5126 Don't warn about file creation when a file doesn't exist.
5129 Go to line number n. This will also affect files which are already open.
5132 Execute an NEdit macro or action on the file following the -do argument
5133 on the command line.
5135 If you use this command without a filename, nc would randomly choose one
5136 window to focus and execute the macro in.
5138 **-lm** languagemode
5139 Initial language mode used.
5142 Explicitly instructs nc which server to connect to, an instance of
5143 nedit(1) with a corresponding -svrname argument. By naming servers, you
5144 can run several simultaneously, and direct files and commands
5145 specifically to any one.
5148 The command which nc uses to start an NEdit server. It is also settable
5149 via the X resource `nc.serverCommand' (see X_Resources_). Defaults to
5152 **-ask**, **-noask**
5153 Instructs nc to automatically start a server if one is not available. This
5154 overrides the X resource `nc.autoStart' (see X_Resources_).
5156 **-timeout** seconds
5157 Basic time-out period used in communication with an NEdit server. The
5158 default is 10 seconds. Also settable via the X resource `nc.timeOut'.
5160 Under rare conditions (such as a slow connection), it may be necessary to
5161 increase the time-out period. In most cases, the default is fine.
5163 **-geometry** geometry, **-g** geometry
5164 The initial size and/or location of editor windows. See
5165 NEdit_Command_Line_ for details.
5167 **-icon**, **-iconic**
5168 Initial window state.
5171 Open all subsequent files in new tabs. Resets -group option.
5174 Open all subsequent files in new windows. Resets -group option.
5177 Open all subsequent files as tabs in a new window.
5180 Instructs nc not to return to the shell until all files given are closed.
5182 Normally, nc returns once the files given in its command line are opened
5183 by the server. When this option is given, nc returns only after the last
5184 file given in this call is closed.
5186 Note that this option affects all files in the command line, not only the
5187 ones following this option.
5189 Note that nc will wait for all files given in the command line, even if
5190 the files were already opened.
5192 **-version**, **-V**
5193 Prints nc's version and build information.
5195 **-xrm** resourcestring
5196 Contains the resourcestring passed to a newly started server. This option
5197 has no effect if the server is already started.
5199 **-display** [<host>]:<server>[.<screen>]
5200 The name of the X server to use. See NEdit_Command_Line_ for details.
5203 4>Command Line Arguments
5205 In typical Unix style, arguments affect the files which follow them on the
5206 command line, for example:
5208 incorrect: nc file.c -line 25
5209 correct: nc -line 25 file.c
5211 -read, -create, and -line affect all of the files which follow them on the
5214 The -do macro is executed only once, on the next file on the line. -do
5215 without a file following it on the command line, executes the macro on the
5216 first available window (presumably when you give a -do command without a
5217 corresponding file or window, you intend it to do something independent of
5218 the window in which it happens to execute).
5220 The -wait option affects all files named in the command line.
5224 Sometimes it is useful to have more than one NEdit server running, for
5225 example to keep mail and programming work separate. The option, -svrname, to
5226 both nedit and nc, allows you to start, and communicate with, separate named
5227 servers. A named server responds only to requests with the corresponding
5228 -svrname argument. If you use ClearCase and are within a ClearCase view, the
5229 server name will default to the name of the view (based on the value of the
5230 CLEARCASE_ROOT environment variable).
5234 Communication between nc and nedit is done through the X display. So as long
5235 as the X Window System is set up and working properly, nc will work properly
5236 as well. nc uses the DISPLAY environment variable, the machine name and your
5237 user name to find the appropriate server, meaning, if you have several
5238 machines sharing a common file system, nc will not be able to find a server
5239 that is running on a machine with a different host name, even though it may
5240 be perfectly appropriate for editing a given file.
5242 The command which nc uses to start an nedit server is settable via the X
5243 resource nc.serverCommand, by default, "nedit -server".
5244 ----------------------------------------------------------------------
5249 If a system crash, network failure, X server crash, or program error should
5250 happen while you are editing a file, you can still recover most of your
5251 work. NEdit maintains a backup file which it updates periodically (every 8
5252 editing operations or 80 characters typed). This file has the same name
5253 as the file that you are editing, but with the character `~' (tilde) on Unix
5254 or `_' (underscore) on VMS prefixed to the name. To recover a file after a
5255 crash, simply rename the file to remove the tilde or underscore character,
5256 replacing the older version of the file. (Because several of the Unix shells
5257 consider the tilde to be a special character, you may have to prefix the
5258 character with a `\' (backslash) when you move or delete an NEdit backup
5261 Example, to recover the file called "help.c" on Unix type the command:
5265 A minor caveat, is that if the file you were editing was in MS DOS format,
5266 the backup file will be in Unix format, and you will need to open the backup
5267 file in NEdit and change the file format back to MS DOS via the Save As...
5268 dialog (or use the Unix unix2dos command outside of NEdit).
5269 ----------------------------------------------------------------------
5280 .. There is build time versioning information that is handled specially
5281 .. inside help.c for this section. It needs to have a '%s' string
5282 .. made available for it to appear in the on-line help.
5286 .. ======================================================================
5287 .. The policy for credit so far is this:
5289 .. You get "written by" credit if you have CVS commit privileges, and you
5290 .. participated in the current release.
5292 .. You will be "retired" once we realize you haven't been around for a
5293 .. while... please come back someday and be active again!
5295 .. The order is alphabetical, not political or time-ordered. The list
5296 .. of patch authors is too large to include here, and we probably won't
5297 .. get it right unless they are diligent about adding credits to the
5298 .. contributed files.
5300 .. You get a syntax/indent credit if your pattern is compiled into the
5302 .. ======================================================================
5304 Active developers: Tony Balinski, Arne Førlie, Nathaniel Gray, Eddy De
5305 Greef, Thorsten Haude, Andrew Hood, Scott Tringali, and TK Soh.
5307 Retired developers: Mark Edel, Joy Kyriakopulos, Christopher Conrad, Jim
5308 Clark, Arnulfo Zepeda-Navratil, Suresh Ravoor, Max Vohlken, Yunliang Yu,
5309 Donna Reid, Steve Haehn, Steve LoBasso, and Alexander Mai.
5311 The regular expression matching routines used in NEdit are adapted (with
5312 permission) from original code written by Henry Spencer at the
5313 University of Toronto.
5315 The Microline widgets are inherited from the Mozilla project.
5317 Syntax highlighting patterns and smart indent macros were contributed by:
5318 Simon T. MacDonald, Maurice Leysens, Matt Majka, Alfred Smeenk,
5319 Alain Fargues, Christopher Conrad, Scott Markinson, Konrad Bernloehr,
5320 Ivan Herman, Patrice Venant, Christian Denat, Philippe Couton,
5321 Max Vohlken, Markus Schwarzenberg, Himanshu Gohel, Steven C. Kapp,
5322 Michael Turomsha, John Fieber, Chris Ross, Nathaniel Gray, Joachim Lous,
5323 Mike Duigou, Seak Teng-Fong, Joor Loohuis, Mark Jones,
5324 and Niek van den Berg.
5326 NEdit sources, executables, additional documentation, and contributed
5327 software are available from the NEdit web site at http://www.nedit.org_.
5329 This program is free software; you can redistribute it and/or
5330 modify it under the terms of the GNU_General_Public_License_
5331 as published by the Free Software Foundation; either version 2
5332 of the License, or (at your option) any later version.
5334 In addition, as a special exception to the GNU GPL, the copyright holders
5335 give permission to link the code of this program with the Motif and Open
5336 Motif libraries (or with modified versions of these that use the same
5337 license), and distribute linked combinations including the two. You must
5338 obey the GNU General Public License in all respects for all of the code
5339 used other than linking with Motif/Open Motif. If you modify this file,
5340 you may extend this exception to your version of the file, but you are
5341 not obligated to do so. If you do not wish to do so, delete this
5342 exception statement from your version.
5344 This program is distributed in the hope that it will be useful,
5345 but WITHOUT ANY WARRANTY; without even the implied warranty of
5346 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5347 section on the GNU_General_Public_License_ for more details.
5348 ----------------------------------------------------------------------
5350 GNU General Public License
5353 GNU GENERAL PUBLIC LICENSE
5355 Version 2, June 1991
5357 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
5358 Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
5359 verbatim copies of this license document, but changing it is not allowed.
5363 The licenses for most software are designed to take away your freedom to
5364 share and change it. By contrast, the GNU General Public License is intended
5365 to guarantee your freedom to share and change free software--to make sure the
5366 software is free for all its users. This General Public License applies to
5367 most of the Free Software Foundation's software and to any other program
5368 whose authors commit to using it. (Some other Free Software Foundation
5369 software is covered by the GNU Library General Public License instead.) You
5370 can apply it to your programs, too.
5372 When we speak of free software, we are referring to freedom, not price. Our
5373 General Public Licenses are designed to make sure that you have the freedom
5374 to distribute copies of free software (and charge for this service if you
5375 wish), that you receive source code or can get it if you want it, that you
5376 can change the software or use pieces of it in new free programs; and that
5377 you know you can do these things.
5379 To protect your rights, we need to make restrictions that forbid anyone to
5380 deny you these rights or to ask you to surrender the rights. These
5381 restrictions translate to certain responsibilities for you if you distribute
5382 copies of the software, or if you modify it.
5384 For example, if you distribute copies of such a program, whether gratis or
5385 for a fee, you must give the recipients all the rights that you have. You
5386 must make sure that they, too, receive or can get the source code. And you
5387 must show them these terms so they know their rights.
5389 We protect your rights with two steps: (1) copyright the software, and (2)
5390 offer you this license which gives you legal permission to copy, distribute
5391 and/or modify the software.
5393 Also, for each author's protection and ours, we want to make certain that
5394 everyone understands that there is no warranty for this free software. If the
5395 software is modified by someone else and passed on, we want its recipients to
5396 know that what they have is not the original, so that any problems introduced
5397 by others will not reflect on the original authors' reputations.
5399 Finally, any free program is threatened constantly by software patents. We
5400 wish to avoid the danger that redistributors of a free program will
5401 individually obtain patent licenses, in effect making the program
5402 proprietary. To prevent this, we have made it clear that any patent must be
5403 licensed for everyone's free use or not licensed at all.
5405 The precise terms and conditions for copying, distribution and modification
5408 GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
5411 0. This License applies to any program or other work which contains a notice
5412 placed by the copyright holder saying it may be distributed under the terms
5413 of this General Public License. The "Program", below, refers to any such
5414 program or work, and a "work based on the Program" means either the Program
5415 or any derivative work under copyright law: that is to say, a work containing
5416 the Program or a portion of it, either verbatim or with modifications and/or
5417 translated into another language. (Hereinafter, translation is included
5418 without limitation in the term "modification".) Each licensee is addressed as
5421 Activities other than copying, distribution and modification are not covered
5422 by this License; they are outside its scope. The act of running the Program
5423 is not restricted, and the output from the Program is covered only if its
5424 contents constitute a work based on the Program (independent of having been
5425 made by running the Program). Whether that is true depends on what the
5428 1. You may copy and distribute verbatim copies of the Program's source code
5429 as you receive it, in any medium, provided that you conspicuously and
5430 appropriately publish on each copy an appropriate copyright notice and
5431 disclaimer of warranty; keep intact all the notices that refer to this
5432 License and to the absence of any warranty; and give any other recipients of
5433 the Program a copy of this License along with the Program.
5435 You may charge a fee for the physical act of transferring a copy, and you may
5436 at your option offer warranty protection in exchange for a fee.
5438 2. You may modify your copy or copies of the Program or any portion of it,
5439 thus forming a work based on the Program, and copy and distribute such
5440 modifications or work under the terms of Section 1 above, provided that you
5441 also meet all of these conditions:
5443 a) You must cause the modified files to carry prominent notices stating
5444 that you changed the files and the date of any change.
5446 b) You must cause any work that you distribute or publish, that in whole or
5447 in part contains or is derived from the Program or any part thereof, to be
5448 licensed as a whole at no charge to all third parties under the terms of
5451 c) If the modified program normally reads commands interactively when run,
5452 you must cause it, when started running for such interactive use in the
5453 most ordinary way, to print or display an announcement including an
5454 appropriate copyright notice and a notice that there is no warranty (or
5455 else, saying that you provide a warranty) and that users may redistribute
5456 the program under these conditions, and telling the user how to view a copy
5457 of this License. (Exception: if the Program itself is interactive but does
5458 not normally print such an announcement, your work based on the Program is
5459 not required to print an announcement.)
5461 These requirements apply to the modified work as a whole. If identifiable
5462 sections of that work are not derived from the Program, and can be reasonably
5463 considered independent and separate works in themselves, then this License,
5464 and its terms, do not apply to those sections when you distribute them as
5465 separate works. But when you distribute the same sections as part of a whole
5466 which is a work based on the Program, the distribution of the whole must be
5467 on the terms of this License, whose permissions for other licensees extend to
5468 the entire whole, and thus to each and every part regardless of who wrote it.
5470 Thus, it is not the intent of this section to claim rights or contest your
5471 rights to work written entirely by you; rather, the intent is to exercise the
5472 right to control the distribution of derivative or collective works based on
5475 In addition, mere aggregation of another work not based on the Program with
5476 the Program (or with a work based on the Program) on a volume of a storage or
5477 distribution medium does not bring the other work under the scope of this
5480 3. You may copy and distribute the Program (or a work based on it, under
5481 Section 2) in object code or executable form under the terms of Sections 1
5482 and 2 above provided that you also do one of the following:
5484 a) Accompany it with the complete corresponding machine-readable source
5485 code, which must be distributed under the terms of Sections 1 and 2 above
5486 on a medium customarily used for software interchange; or,
5488 b) Accompany it with a written offer, valid for at least three years, to
5489 give any third party, for a charge no more than your cost of physically
5490 performing source distribution, a complete machine-readable copy of the
5491 corresponding source code, to be distributed under the terms of Sections 1
5492 and 2 above on a medium customarily used for software interchange; or,
5494 c) Accompany it with the information you received as to the offer to
5495 distribute corresponding source code. (This alternative is allowed only for
5496 noncommercial distribution and only if you received the program in object
5497 code or executable form with such an offer, in accord with Subsection b
5500 The source code for a work means the preferred form of the work for making
5501 modifications to it. For an executable work, complete source code means all
5502 the source code for all modules it contains, plus any associated interface
5503 definition files, plus the scripts used to control compilation and
5504 installation of the executable. However, as a special exception, the source
5505 code distributed need not include anything that is normally distributed (in
5506 either source or binary form) with the major components (compiler, kernel,
5507 and so on) of the operating system on which the executable runs, unless that
5508 component itself accompanies the executable.
5510 If distribution of executable or object code is made by offering access to
5511 copy from a designated place, then offering equivalent access to copy the
5512 source code from the same place counts as distribution of the source code,
5513 even though third parties are not compelled to copy the source along with the
5516 4. You may not copy, modify, sublicense, or distribute the Program except as
5517 expressly provided under this License. Any attempt otherwise to copy, modify,
5518 sublicense or distribute the Program is void, and will automatically
5519 terminate your rights under this License. However, parties who have received
5520 copies, or rights, from you under this License will not have their licenses
5521 terminated so long as such parties remain in full compliance.
5523 5. You are not required to accept this License, since you have not signed it.
5524 However, nothing else grants you permission to modify or distribute the
5525 Program or its derivative works. These actions are prohibited by law if you
5526 do not accept this License. Therefore, by modifying or distributing the
5527 Program (or any work based on the Program), you indicate your acceptance of
5528 this License to do so, and all its terms and conditions for copying,
5529 distributing or modifying the Program or works based on it.
5531 6. Each time you redistribute the Program (or any work based on the Program),
5532 the recipient automatically receives a license from the original licensor to
5533 copy, distribute or modify the Program subject to these terms and conditions.
5534 You may not impose any further restrictions on the recipients' exercise of
5535 the rights granted herein. You are not responsible for enforcing compliance
5536 by third parties to this License.
5538 7. If, as a consequence of a court judgment or allegation of patent
5539 infringement or for any other reason (not limited to patent issues),
5540 conditions are imposed on you (whether by court order, agreement or
5541 otherwise) that contradict the conditions of this License, they do not excuse
5542 you from the conditions of this License. If you cannot distribute so as to
5543 satisfy simultaneously your obligations under this License and any other
5544 pertinent obligations, then as a consequence you may not distribute the
5545 Program at all. For example, if a patent license would not permit
5546 royalty-free redistribution of the Program by all those who receive copies
5547 directly or indirectly through you, then the only way you could satisfy both
5548 it and this License would be to refrain entirely from distribution of the
5551 If any portion of this section is held invalid or unenforceable under any
5552 particular circumstance, the balance of the section is intended to apply and
5553 the section as a whole is intended to apply in other circumstances.
5555 It is not the purpose of this section to induce you to infringe any patents
5556 or other property right claims or to contest validity of any such claims;
5557 this section has the sole purpose of protecting the integrity of the free
5558 software distribution system, which is implemented by public license
5559 practices. Many people have made generous contributions to the wide range of
5560 software distributed through that system in reliance on consistent
5561 application of that system; it is up to the author/donor to decide if he or
5562 she is willing to distribute software through any other system and a licensee
5563 cannot impose that choice.
5565 This section is intended to make thoroughly clear what is believed to be a
5566 consequence of the rest of this License.
5568 8. If the distribution and/or use of the Program is restricted in certain
5569 countries either by patents or by copyrighted interfaces, the original
5570 copyright holder who places the Program under this License may add an
5571 explicit geographical distribution limitation excluding those countries, so
5572 that distribution is permitted only in or among countries not thus excluded.
5573 In such case, this License incorporates the limitation as if written in the
5574 body of this License.
5576 9. The Free Software Foundation may publish revised and/or new versions of
5577 the General Public License from time to time. Such new versions will be
5578 similar in spirit to the present version, but may differ in detail to address
5579 new problems or concerns.
5581 Each version is given a distinguishing version number. If the Program
5582 specifies a version number of this License which applies to it and "any later
5583 version", you have the option of following the terms and conditions either of
5584 that version or of any later version published by the Free Software
5585 Foundation. If the Program does not specify a version number of this License,
5586 you may choose any version ever published by the Free Software Foundation.
5588 10. If you wish to incorporate parts of the Program into other free programs
5589 whose distribution conditions are different, write to the author to ask for
5590 permission. For software which is copyrighted by the Free Software
5591 Foundation, write to the Free Software Foundation; we sometimes make
5592 exceptions for this. Our decision will be guided by the two goals of
5593 preserving the free status of all derivatives of our free software and of
5594 promoting the sharing and reuse of software generally.
5598 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
5599 THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
5600 STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
5601 PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
5602 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
5603 FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
5604 PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
5605 YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
5607 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
5608 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
5609 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
5610 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
5611 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO
5612 LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
5613 THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
5614 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
5615 POSSIBILITY OF SUCH DAMAGES.
5617 END OF TERMS AND CONDITIONS
5618 ----------------------------------------------------------------------
5623 There are two separate mailing lists for nedit users, and one for developers.
5624 Users may post to the developer mailing list to report defects and communicate
5625 with the nedit developers. Remember that nedit is entirely a volunteer
5626 effort, so please ask questions first to the discussion list, and do your
5627 share to answer other users questions as well.
5631 General discussion, questions and answers among NEdit users and developers.
5633 announce@@nedit.org_
5635 A low-volume mailing list for announcing new versions.
5639 Communication among and with NEdit developers.
5640 Developers should also subscribe to the discuss list.
5642 To subscribe, send mail to one of the following addresses:
5644 announce-request@@nedit.org_
5645 discuss-request@@nedit.org_
5646 develop-request@@nedit.org_
5648 with the body consisting of the single word
5651 ----------------------------------------------------------------------
5656 3>Solutions to Common Problems
5658 For a much more comprehensive list of common problems and solutions, see the
5659 NEdit FAQ. The latest version of the FAQ can always be found on the NEdit
5662 http://www.nedit.org_.
5664 **P: No files are shown in the "Files" list in the Open... dialog.**
5666 S: When you use the "Filter" field, include the file specification or a
5667 complete directory specification, including the trailing "/" on Unix.
5668 (See Help in the Open... dialog).
5670 **P: Find Again and Replace Again don't continue in the same direction as the original Find or Replace.**
5672 S: Find Again and Replace Again don't use the direction of the original
5673 search. The Shift key controls the direction: Ctrl+G means forward,
5674 Shift+Ctrl+G means backward.
5676 **P: Preferences specified in the Preferences menu don't seem to get saved when I select Save Defaults.**
5678 S: NEdit has two kinds of preferences: 1) per-window preferences, in the
5679 Preferences menu, and 2) default settings for preferences in newly created
5680 windows, in the Default Settings sub-menu of the Preferences menu.
5681 Per-window preferences are not saved by Save Defaults, only Default
5684 **P: Columns and indentation don't line up.**
5686 S: NEdit is using a proportional width font. Set the font to a fixed style
5687 (see Preferences menu).
5689 **P: NEdit performs poorly on very large files.**
5691 S: Turn off Incremental Backup. With Incremental Backup on, NEdit
5692 periodically writes a full copy of the file to disk.
5694 **P: Commands added to the Shell Commands menu (Unix only) don't output anything until they are finished executing.**
5696 S: If the command output is directed to a dialog, or the input is from a
5697 selection, output is collected together and held until the command
5698 completes. De-select both of the options and the output will be shown
5699 incrementally as the command executes.
5701 **P: Dialogs don't automatically get keyboard focus when they pop up.**
5703 S: Most X Window managers allow you to choose between two categories of
5704 keyboard focus models: pointer focus, and explicit focus. Pointer focus
5705 means that as you move the mouse around the screen, the window under the
5706 mouse automatically gets the keyboard focus. NEdit users who use this
5707 focus model should set "Popups Under Pointer" in the Default Settings sub
5708 menu of the preferences menu in NEdit. Users with the explicit focus
5709 model, in some cases, may have problems with certain dialogs, such as Find
5710 and Replace. In MWM this is caused by the mwm resource startupKeyFocus
5711 being set to False (generally a bad choice for explicit focus users).
5712 NCDwm users should use the focus model "click" instead of "explicit",
5713 again, unless you have set it that way to correct specific problems, this
5714 is the appropriate setting for most explicit focus users.
5716 **P: The Backspace key doesn't work, or deletes forward rather than backward.**
5718 S: While this is an X/Motif binding problem, and should be solved outside of
5719 NEdit in the Motif virtual binding layer (or possibly xmodmap or
5720 translations), NEdit provides an out. If you set the resource:
5721 nedit.remapDeleteKey to True, NEdit will forcibly map the delete key to
5722 backspace. The default setting of this resource recently changed, so
5723 users who have been depending on this remapping will now have to set it
5724 explicitly (or fix their bindings).
5726 **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.**
5728 S: On many SunOS systems, you have to set up an nls directory before various
5729 inter-client communication features of Motif will function properly.
5730 There are instructions in README.sun in /pub/v5_0_2/individual/README.sun on
5731 ftp.nedit.org, as well as a tar file containing a complete nls
5732 directory: ftp://ftp.nedit.org/pub/v5_0_2/nls.tar.
5733 README.sun contains directions for setting up an nls directory, which
5734 is required by Motif for handling copy and paste to Motif text fields.
5738 Below is the list of known defects which affect NEdit. The defects your copy
5739 of NEdit will exhibit depend on which system you are running and with which
5740 Motif libraries it was built. Note that there are now Motif 1.2 and/or 2.0
5741 libraries available on ALL supported platforms, and as you can see below
5742 there are far fewer defects in Motif 1.2, so it is in your best interest to
5743 upgrade your system.
5748 Operations between rectangular selections on overlapping lines do nothing.
5751 None. These operations are very complicated and rarely used.
5754 Cut and Paste menu items fail, or possibly crash,
5755 for very large (multi-megabyte) selections.
5758 Use selection copy (middle mouse button click)
5759 for transferring larger quantities of data.
5760 Cut and Paste save the copied text in server
5761 memory, which is usually limited.
5765 Submit bugs through the web at:
5767 http://sf.net/tracker/?func=add&group_id=11005&atid=111005
5769 Please include the first few lines from Help > Version, which identifies
5770 NEdit's version and other system attributes important for diagnosing your
5773 The NEdit developers subscribe to both discuss@@nedit.org and
5774 develop@@nedit.org, either of which may be used for reporting defects. If
5775 you're not sure, or you think the report might be of interest to the general
5776 NEdit user community, send the report to discuss@@nedit.org_. If it's
5777 something obvious and boring, like we misspelled "anemometer" in the on-line
5778 help, send it to develop@@nedit.org_. If you don't want to subscribe to the
5779 Mailing_Lists_, please add a note to your mail about cc'ing you on responses.
5783 .. Hyperlinks for this document ==============================================
5785 .. _discuss@@nedit.org mailto:discuss@@nedit.org
5786 .. _announce@@nedit.org mailto:announce@@nedit.org
5787 .. _develop@@nedit.org mailto:develop@@nedit.org
5788 .. _discuss-request@@nedit.org mailto:discuss-request@@nedit.org
5789 .. _announce-request@@nedit.org mailto:announce-request@@nedit.org
5790 .. _develop-request@@nedit.org mailto:develop-request@@nedit.org
5791 .. _http://www.nedit.org http://www.nedit.org
5792 .. _ctags_support #ctags
5793 .. _Alternation #alternation
5794 .. _Autoload_Files #automatically
5796 .. =============================================================================
5798 .. Below is what is used to guide the generation of 'C'-Motif menus.
5799 .. Indentation is SIGNIFICANT in the "Menu" directive lines below. It
5800 .. is used to determine under which menu element another item will belong.
5801 .. The number of spaces indented is not significant, but items to be placed
5802 .. in the same menu panel MUST line up at the same indent level.
5803 .. ALL nodes of this menu "tree" should have help name qualifiers.
5804 .. These are used to produce the internal lists used by NEdit help code.
5806 .. By default, the first character of the menu element will be used as a
5807 .. menu mneumonic key. To use another character in the menu element for this
5808 .. purpose, surround the character with underscores (eg. I w_a_nt 'a').
5810 .. The menu title MUST match the one found in the actual help text (sans
5811 .. special mneumonic key character marking). The help text title may include
5812 .. underlines (for spaces) when it is a hyperlink target.
5814 .. The Help-name is used to generate various data structure names. For
5815 .. instance, the 'start' help name will be used to generate the HelpTopic
5816 .. enumeration value HELP_START and the character array htxt_start which
5817 .. holds the actual help text used in the menu dialogs. Consequently, these
5818 .. names need to be unique and contain only the characters that a 'C'
5819 .. compiler can digest.
5821 .. Menu separator lines use a dash (-) character for the Menu Title. They
5822 .. should also have a unique Help-name.
5824 .. A numerical value following the Help-name (separated from the name by
5825 .. a comma and/or spaces) is part of a menu element hiding scheme implemented
5826 .. in buildHelpMenu (found in 'menu.c'). When the number matches the hideIt
5827 .. value found in the procedure, that element will effectively become invisible.
5828 .. This mechanism was created for particular menu features that are not
5829 .. available to all incarnations of NEdit (in this case, the VMS version).
5831 .. A "Help" directive is used for all other text used as NEdit help, but
5832 .. does not show up in the Help menu.
5834 .. Menu Title # Help-name
5835 .. ------------------------------------------------------------
5836 .. Menu: Getting Started # start
5837 .. Menu: Basic Operation # basicOp
5838 .. Menu: Selecting Text # select
5839 .. Menu: Finding and Replacing Text # search
5840 .. Menu: Cut and Paste # clipboard
5841 .. Menu: Using the Mouse # mouse
5842 .. Menu: Keyboard Shortcuts # keyboard
5843 .. Menu: S_h_ifting and Filling # fill
5844 .. Menu: Tabbed Editing # interface
5845 .. Menu: F_i_le Format # format
5847 .. Menu: Features for Programming # features
5848 .. Menu: Programming with NEdit # programmer
5849 .. Menu: Tabs/Emulated Tabs # tabs
5850 .. Menu: Auto/Smart Indent # indent
5851 .. Menu: Syntax Highlighting # syntax
5852 .. Menu: Finding Declarations (ctags) # tags
5853 .. Menu: Calltips # calltips
5855 .. Menu: Regular Expressions # regex
5856 .. Menu: Basic Regular Expression Syntax # basicSyntax
5857 .. Menu: Metacharacters # escapeSequences
5858 .. Menu: Parenthetical Constructs # parenConstructs
5859 .. Menu: Advanced Topics # advancedTopics
5860 .. Menu: Example Regular Expressions # examples
5862 .. Menu: Macro/Shell Extensions # extensions
5863 .. Menu: Shell Commands and Filters # shell, 1
5864 .. Menu: Learn/Replay # learn
5865 .. Menu: Macro Language # macro_lang
5866 .. Menu: M_a_cro Subroutines # macro_subrs
5867 .. Menu: Rangesets # rangeset
5868 .. Menu: Highlighting Information # hiliteInfo
5869 .. Menu: Action Routines # actions
5871 .. Menu: Customizing # customizing
5872 .. Menu: Customizing NEdit # customize
5873 .. Menu: Preferences # preferences
5874 .. Menu: X Resources # resources
5875 .. Menu: Key Binding # binding
5876 .. Menu: Highlighting Patterns # patterns
5877 .. Menu: Smart Indent Macros # smart_indent
5879 .. Menu: NEdit Command Line # command_line
5880 .. Menu: Client/Server Mode # server
5881 .. Menu: Cr_a_sh Recovery # recovery
5882 .. Menu: ---------------------------------- # separator1
5883 .. Menu: Version # version
5884 .. Menu: GNU General Public License # distribution
5885 .. Menu: Mailing _L_ists # mailing_list
5886 .. Menu: Problems/Defects # defects
5887 .. ------------------------------------------------------------
5888 .. Help: Tabs Dialog # tabs_dialog
5889 .. Help: Customize Window Title Dialog # custom_title_dialog