NEdit has two general types of selections, primary (highlighted text), and secondary (underlined text). Selections can cover either a simple range of text between two points in the file, or they can cover a rectangular area of the file. Rectangular selections are only useful with non-proportional (fixed spacing) fonts.
To select text for copying, deleting, or replacing, press the left mouse button with the pointer at one end of the text you want to select, and drag it to the other end. The text will become highlighted. To select a whole word, double click (click twice quickly in succession). Double clicking and then dragging the mouse will select a number of words. Similarly, you can select a whole line or a number of lines by triple clicking or triple clicking and dragging. Quadruple clicking selects the whole file. After releasing the mouse button, you can still adjust a selection by holding down the shift key and dragging on either end of the selection. To delete the selected text, press delete or backspace. To replace it, begin typing.
To select a rectangle or column of text, hold the Ctrl key while dragging the mouse. Rectangular selections can be used in any context that normal selections can be used, including cutting and pasting, filling, shifting, dragging, and searching. Operations on rectangular selections automatically fill in tabs and spaces to maintain alignment of text within and to the right of the selection. Note that the interpretation of rectangular selections by Fill Paragraph is slightly different from that of other commands, the section titled "Shifting and Filling" has details.
The middle mouse button can be used to make an additional selection (called the secondary selection). As soon as the button is released, the contents of this selection will be copied to the insert position of the window where the mouse was last clicked (the destination window). This position is marked by a caret shaped cursor when the mouse is outside of the destination window. If there is a (primary) selection, adjacent to the cursor in the window, the new text will replace the selected text. Holding the shift key while making the secondary selection will move the text, deleting it at the site of the secondary selection, rather than copying it.
Selected text can also be dragged to a new location in the file using the middle mouse button. Holding the shift key while dragging the text will copy the selected text, leaving the original text in place. Holding the control key will drag the text in overlay mode.
Normally, dragging moves text by removing it from the selected position at the start of the drag, and inserting it at a new position relative to to the mouse. Dragging a block of text over existing characters, displaces the characters to the end of the selection. In overlay mode, characters which are occluded by blocks of text being dragged are simply removed. When dragging non-rectangular selections, overlay mode also converts the selection to rectangular form, allowing it to be dragged outside of the bounds of the existing text.
The section "Using the Mouse" sumarizes the mouse commands for making primary and secondary selections. Primary selections can also be made via keyboard commands, see "Keyboard Shortcuts".
The Search menu contains a number of commands for finding and replacing text.
The Find... and Replace... commands present dialogs for entering text for searching and replacing. These dialogs also allow you to choose whether you want the search to be sensitive to upper and lower case, or whether to use the standard Unix pattern matching characters (regular expressions). Searches begin at the current text insertion position.
Find Again and Replace Again repeat the last find or replace command without prompting for search strings. To selectively replace text, use the two commands in combination: Find Again, then Replace Again if the highlighted string should be replaced, or Find Again again to go to the next string.
Find Selection searches for the text contained in the current primary selection (see Selecting Text). The selected text does not have to be in the current editor window, it may even be in another program. For example, if the word dog appears somewhere in a window on your screen, and you want to find it in the file you are editing, select the word dog by dragging the mouse across it, switch to your NEdit window and choose Find Selection from the Search menu.
Holding down the shift key while choosing any of the search or replace commands from the menu (or using the keyboard shortcut), will search in the reverse direction. Users who have set the search direction using the buttons in the search dialog, may find it a bit confusing that Find Again and Replace Again don't continue in the same direction as the original search (for experienced users, consistency of the direction implied by the shift key is more important).
To replace only some occurrences of a string within a file, choose Replace... from the Search menu, enter the string to search for and the string to substitute, and finish by pressing the Find button. When the first occurrence is highlighted, use either Replace Again (^T) to replace it, or Find Again (^G) to move to the next occurrence without replacing it, and continue in such a manner through all occurrences of interest.
To replace all occurrences of a string within some range of text, select the range (see Selecting Text), choose Replace... from the Search menu, type the string to search for and the string to substitute, and press the "R. in Selection" button in the dialog. Note that selecting text in the Replace... dialog will unselect the text in the window.
The easiest way to copy and move text around in your file or between windows, is to use the clipboard, an imaginary area that temporarily stores text and data. The Cut command removes the selected text (see Selecting Text) from your file and places it in the clipboard. Once text is in the clipboard, the Paste command will copy it to the insert position in the current window. For example, to move some text from one place to another, select it by dragging the mouse over it, choose Cut to remove it, click the pointer to move the insert point where you want the text inserted, then choose Paste to insert it. Copy copies text to the clipboard without deleting it from your file. You can also use the clipboard to transfer text to and from other Motif programs and X programs which make proper use of the clipboard.
There are many other methods for copying and moving text within NEdit windows and between NEdit and other programs. The most common such method is clicking the middle mouse button to copy the primary selection (to the clicked position). Copying the selection by clicking the middle mouse button in many cases is the only way to transfer data to and from many X programs. Holding the Shift key while clicking the middle mouse button moves the text, deleting it from its original position, rather than copying it. Other methods for transferring text include secondary selections, primary selection dragging, keyboard-based selection copying, and drag and drop. These are described in detail in the sections: Selecting Text, Using the Mouse, and Keyboard Shortcuts.
Mouse-based editing is what NEdit is all about, and learning to use the more advanced features like secondary selections and primary selection dragging will be well worth your while.
If you don't have time to learn everything, you can get by adequately with just the left mouse button: Clicking the left button moves the cursor. Dragging with the left button makes a selection. Holding the shift key while clicking extends the existing selection, or begins a selection between the cursor and the mouse. Double or triple clicking selects a whole word or a whole line.
This section will make more sense if you also read the section called, "Selecting Text", which explains the terminology of selections, i.e. what is meant by primary, secondary, rectangular, etc.
General meaning of mouse buttons and modifier keys:Buttons
- Button 1 (left)
- Cursor position and primary selection
- Button 2 (middle)
- Secondary selections, and dragging and copying the primary selection
- Button 3 (right)
- Quick-access programmable menu and pan scrolling
- On primary selections, (left mouse button): Extends selection to the mouse pointer
On secondary and copy operations, (middle): Toggles between move and copy
- Makes selection rectangular or insertion columnar
- (on release) Exchange primary and secondary selections.
Left Mouse Button
The left mouse button is used to position the cursor and to make primary selections
- Moves the cursor
- Double Click
- Selects a whole word
- Triple Click
- Selects a whole line
- Quad Click
- Selects the whole file
- Shift Click
- Adjusts (extends or shrinks) the selection, or if there is no existing selection, begins a new selection between the cursor and the mouse.
- Adjusts (extends or shrinks) the selection rectangularly.
- Selects text between where the mouse was pressed and where it was released.
- Selects rectangle between where the mouse was pressed and where it was released.
Right Mouse Button
The right mouse button posts a programmable menu for frequently used commands.
- Pops up the background menu (programmed from Preferences -> Default Settings -> Customize Menus -> Window Background).
- Pan scrolling. Scrolls the window both vertically and horizontally, as if you had grabbed it with your mouse.
Middle Mouse Button
The middle mouse button is for making secondary selections, and copying and dragging the primary selection
- Copies the primary selection to the clicked position.
- Moves the primary selection to the clicked position, deleting it from its original position.
- 1) Outside of the primary selection: Begins a secondary selection.
- 2) Inside of the primary selection: Moves the selection by dragging.
- 1) Outside of the primary selection: Begins a rectangular secondary selection.
- 2) Inside of the primary selection: Drags the selection in overlay mode (see below).
When the mouse button is released after creating a secondary selection:
- No Modifiers
- If there is a primary selection, replaces it with the secondary selection. Otherwise, inserts the secondary selection at the cursor position.
- Move the secondary selection, deleting it from its original position. If there is a primary selection, the move will replace the primary selection with the secondary selection. Otherwise, moves the secondary selection to to the cursor position.
- Exchange the primary and secondary selections.
While moving the primary selection by dragging with the middle mouse button:
- Shift Leaves a copy of the original
- selection in place rather than removing it or blanking the area. Ctrl
- Changes from insert mode to overlay mode (see below).
- Cancels drag in progress.
Overlay Mode: Normally, dragging moves text by removing it from the selected position at the start of the drag, and inserting it at a new position relative to to the mouse. When you drag a block of text over existing characters, the existing characters are displaced to the end of the selection. In overlay mode, characters which are occluded by blocks of text being dragged are simply removed. When dragging non-rectangular selections, overlay mode also converts the selection to rectangular form, allowing it to be dragged outside of the bounds of the existing text.
* The Alt key may be labeled Meta or Compose-Character on some keyboards. Some window managers, including default configurations of mwm, bind combinations of the Alt key and mouse buttons to window manager operations. In NEdit, Alt is only used on button release, so regardless of the window manager bindings for Alt-modified mouse buttons, you can still do the corresponding NEdit operation by using the Alt key AFTER the initial mouse press, so that Alt is held while you release the mouse button. If you find this difficult or annoying, you can re-configure most window managers to skip this binding, or you can re-configure NEdit to use a different key combination.
Most of the keyboard shortcuts in NEdit are shown on the right hand sides of the pull-down menus. However, there are more which are not as obvious. These include; dialog button shortcuts; menu and dialog mnemonics; labeled keyboard keys, such as the arrows, page-up, page-down, and home; and optional Shift modifiers on accelerator keys, like [Shift]Ctrl+F.
Pressing the key combinations shown on the right of the menu items is a shortcut for selecting the menu item with the mouse. Some items have the shift key enclosed in brackets, such as [Shift]Ctrl+F. This indicates that the shift key is optional. In search commands, including the shift key reverses the direction of the search. In Shift commands, it makes the command shift the selected text by a whole tab stop rather than by single characters.
Pressing the Alt key in combination with one of the underlined characters in the menu bar pulls down that menu. Once the menu is pulled down, typing the underlined characters in a menu item (without the Alt key) activates that item. With a menu pulled down, you can also use the arrow keys to select menu items, and the space or enter keys to activate them.
Keyboard Shortcuts within Dialogs
One button in a dialog is usually marked with a thick indented outline. Pressing the Return or Enter key activates this button.
All dialogs have either a Cancel or Dismiss button. This button can be activated by pressing the Escape (or Esc) key.
Pressing the tab key moves the keyboard focus to the next item in a dialog. Within an associated group of buttons, the arrow keys move the focus among the buttons. Shift+Tab moves backward through the items.
Most items in dialogs have an underline under one character in their name. Pressing the Alt key along with this character, activates a button as if you had pressed it with the mouse, or moves the keyboard focus to the associated text field or list.
You can select items from a list by using the arrow keys to move the selection and space to select.
In file selection dialogs, you can type the beginning characters of the file name or directory in the list to select files
Labeled Function Keys
The labeled function keys on standard workstation and PC keyboards, like the arrows, and page-up and page-down, are active in NEdit, though not shown in the pull-down menus.
Holding down the control key while pressing a named key extends the scope of the action that it performs. For example, Home normally moves the insert cursor the beginning of a line. Ctrl+Home moves it to the beginning of the file. Backspace deletes one character, Ctrl+Backspace deletes one word.
Holding down the shift key while pressing a named key begins or extends a selection. Combining the shift and control keys combines their actions. For example, to select a word without using the mouse, position the cursor at the beginning of the word and press Ctrl+Shift+RightArrow. The Alt key modifies selection commands to make the selection rectangular.
Under X and Motif, there are several levels of translation between keyboard keys and the actions they perform in a program. The "Customizing NEdit", and "X Resources" sections of the Help menu have more information on this subject. Because of all of this configurability, and since keyboards and standards for the meaning of some keys vary from machine to machine, the mappings may be changed from the defaults listed below.
Modifier Keys (in general)
- Extends the scope of the action that the key would otherwise perform. For example, Home normally moves the insert cursor the beginning of a line. Ctrl+Home moves it to the beginning of the file. Backspace deletes one character, Ctrl+ Backspace deletes one word.
- Shift Extends the selection to the cursor position. If
- there's no selection, begins one between the old and new cursor positions.
- When modifying a selection, makes the selection rectangular.
(For the effects of modifier keys on mouse button presses, see the section titled "Using the Mouse")
- Cancels operation in progress: menu selection, drag, selection, etc. Also equivalent to cancel button in dialogs.
- Delete the character before the cursor
- Delete the word before the cursor
- Move the cursor to the left one character
- Move the cursor backward one word (Word delimiters are settable, see Customizing NEdit, and X Resources)
- Move the cursor to the right one character
- Move the cursor forward one word
- Move the cursor up one line
- Move the cursor up one paragraph. (Paragraphs are delimited by blank lines)
- Move the cursor down one line.
- Move the cursor down one paragraph.
- Return with automatic indent, regardless of the setting of Auto Indent.
- Return without automatic indent, regardless of the setting of Auto Indent.
- Insert an ascii tab character, without processing emulated tabs.
- Insert the control-code equivalent of a key <c>
- Select everything (same as Select All menu item or ^A)
- Delete to start of line
PC Standard Keyboard
- Copy the primary selection to the clipboard (same as Copy menu item or ^C) for compatibility with Motif standard key binding Shift+Ctrl+Insert
- Copy the primary selection to the cursor location.
- Delete the character before the cursor. (Can be configured to delete the character after the cursor, see Customizing NEdit, and X Resources)
- Delete to end of line.
- Cut, remove the currently selected text and place it in the clipboard. (same as Cut menu item or ^X) for compatibility with Motif standard key binding Shift+Ctrl+Delete
- Cut the primary selection to the cursor location.
- Move the cursor to the beginning of the line
- Move the cursor to the beginning of the file
- Move the cursor to the end of the line
- Move the cursor to the end of the file
- Scroll and move the cursor up by one page.
- Scroll and move the cursor left by one page. PageDown
- Scroll and move the cursor down by one page.
- Scroll and move the cursor right by one page.
- Make the menu bar active for keyboard input (Arrow Keys, Return, Escape, and the Space Bar)
On machines with different styles of keyboards, generally, text editing actions are properly matched to the labeled keys, such as Remove, Next-screen, etc.. If you prefer different key bindings, see the section titled "Key Binding" under the Customizing heading in the Help menu.
Shift Left, Shift Right
While shifting blocks of text is most important for programmers (See Features for Programming), it is also useful for other tasks, such as creating indented paragraphs.
To shift a block of text one tab stop to the right, select the text, then choose Shift Right from the Edit menu. Note that the accelerator keys for these menu items are Ctrl+9 and Ctrl+0, which correspond to the right and left parenthesis on most keyboards. Remember them as adjusting the text in the direction pointed to by the parenthesis character. Holding the Shift key while selecting either Shift Left or Shift Right will shift the text by one character.
It is also possible to shift blocks of text by selecting the text rectangularly, and dragging it left or right (and up or down as well). Using a rectangular selection also causes tabs within the selection to be recalculated and substituted, such that the non-whitespace characters remain stationary with respect to the selection.
Text filling using the Fill Paragraph command in the Edit menu is one of the most important concepts in NEdit. And it will be well worth your while to understand how to use it properly.
In plain text files, unlike word-processor files, there is no way to tell which lines are continuations of other lines, and which lines are meant to be separate, because there is no distinction in meaning between newline characters which separate lines in a paragraph, and ones which separate paragraphs from other text. This makes it impossible for a text editor like NEdit to tell parts of the text which belong together as a paragraph from carefully arranged individual lines.
In continuous wrap mode (Preferences -> Wrap -> Continuous), lines automatically wrap and unwrap themselves to line up properly at the right margin. In this mode, you simply omit the newlines within paragraphs and let NEdit make the line breaks as needed. Unfortunately, continuous wrap mode is not appropriate in the majority of situations, because files with extremely long lines are not common under Unix and may not be compatible with all tools, and because you can't achieve effects like indented sections, columns, or program comments, and still take advantage of the automatic wrapping.
Without continuous wrapping, paragraph filling is not entirely automatic. Auto-Newline wrapping keeps paragraphs lined up as you type, but once entered, NEdit can no longer distinguish newlines which join wrapped text, and newlines which must be preserved. Therefore, editing in the middle of a paragraph will often leave the right margin messy and uneven.
Since NEdit can't act automatically to keep your text lined up, you need to tell it explicitly where to operate, and that is what Fill Paragraph is for. It arranges lines to fill the space between two margins, wrapping the lines neatly at word boundaries. Normally, the left margin for filling is inferred from the text being filled. The first line of each paragraph is considered special, and its left indentation is maintained separately from the remaining lines (for leading indents, bullet points, numbered paragraphs, etc.). Otherwise, the left margin is determined by the furthest left non-whitespace character. The right margin is either the Wrap Margin, set in the preferences menu (by default, the right edge of the window), or can also be chosen on the fly by using a rectangular selection (see below).
There are three ways to use Fill Paragraph. The simplest is, while you are typing text, and there is no selection, simply select Fill Paragraph (or type Ctrl+J), and NEdit will arrange the text in the paragraph adjacent to the cursor. A paragraph, in this case, means an area of text delimited by blank lines.
The second way to use Fill Paragraph is with a selection. If you select a range of text and then chose Fill Paragraph, all of the text in the selection will be filled. Again, continuous text between blank lines is interpreted as paragraphs and filled individually, respecting leading indents and blank lines.
The third, and most versitile, way to use Fill Paragraph is with a rectangular selection. Fill Paragraph treats rectangular selections differently from other commands. Instead of simply filling the text inside the rectangular selection, NEdit interprets the right edge of the selection as the requested wrap margin. Text to the left of the selection is not disturbed (the usual interpretation of a rectangular selection), but text to the right of the selection is included in the operation and is pulled in to the selected region. This method enables you to fill text to an arbitrary right margin, without going back and forth to the wrap-margin dialog, as well as to exclude text to the left of the selection such as comment bars or other text columns.
Send questions and comments to: email@example.com.