NEdit.org    The Nirvana Editor Web Site
.

NEdit.org Home
Table of Contents

Getting Started

Basic Operation
Selecting Text
Finding/Replacing
Cut and Paste
Using the Mouse
Keyboard Shortcuts
Shifting and Filling
File Format

Features for
Programming

Programming
Tabs/Emul. Tabs
Auto/Smart Indent
Syntax Highlighting
Finding Decl.

Regular Expressions
Basic Syntax
Escape Sequences
Parenthetical Const.
Advanced Topics
Examples

Macro/Shell Extensions
Shell and Filters
Learn/Replay
Macro Language
Macro Subroutines
Action Routines

Customizing
Customizing NEdit
Preferences
X Resources
Key Binding
Highlighting Patterns
Indent Macros

Miscellaneous
NEdit Cmd Line
Client/Server Mode
Crash Recovery
Problems/Defects

.

 

.

Action Routines

All of the editing capabilities of NEdit are represented as a special type of subroutine, called an action routine, which can be invoked from both macros and translation table entries (see Key Binding section below).

*  Actions Representing Menu Commands

File Menu

new()
open()
open_dialog()
open_selected()
close()
save()
save_as()
save_as_dialog()
revert_to_saved()
include_file()
include_file_dialog ()
load_tags_file()
load_tags_file_dialog()
load_macro_file()
load_macro_file_dialog()
print()
print_selection()
unload_tags_file()
exit()

 

Edit Menu

undo()
redo()
delete()
select_all()
shift_left()
shift_left_by_tab()
shift_right()
shift_right_by_tab()
uppercase()
lowercase()
fill_paragraph()
control_code_dialog()

 

Search Menu

find()
find_dialog()
find_again()
find_selection()
replace()
replace_dialog()
replace_all()
replace_in_selection()
replace_again()
goto_line_number()
goto_line_number_dialog()
goto_selected()
mark()
mark_dialog()
goto_mark()
goto_mark_dialog()
match()
find_definition()
split_window()
close_pane()

Shell Menu

filter_selection_dialog()
filter_selection()
execute_command()
execute_command_dialog()
execute_command_line()
shell_menu_command()

Macro Menu

macro_menu_command()
repeat_macro()
repeat_dialog()

 

The actions representing menu commands are named the same as the menu item with punctuation removed, all lower case, and underscores replacing spaces. Without the _dialog suffix, commands which normally prompt the user for information, instead take the information from the routine's arguments (see below). To present a dialog and ask the user for input, rather than supplying it in via arguments, use the actions with the _dialog suffix.

Menu Action Routine Arguments

Arguments are text strings enclosed in quotes. Below are the menu action routines which take arguments. Optional arguments are inclosed in [].

  • open(filename) :
  • save_as(filename) :
  • include(filename) :
  • load_tags_file(filename) :
  • find_dialog([search_direction]) :
  • find(search_string [, search-direction], [search-type]) :
  • find_again([search-direction]) :
  • find_selection([search-direction]) :
  • replace_dialog([search-direction]) :
  • replace(search-string, replace-string, [,search-direction] [, search-type]) :
  • replace_in_selection(search-string, replace-string [, search-type]) :
  • replace_again([search-direction]) :
  • goto_line_number([line-number]) :
  • mark(mark-letter) :
  • goto_mark(mark-letter) :
  • filter_selection(shell-command) :
  • execute_command(shell-command) :
  • shell_menu_command(shell-menu-item-name) :
  • macro_menu_command(macro-menu-item-name) :

Some notes on argument types above

  1. filename Path names are interpreted relative to the directory from which NEdit was started, wildcards and ~ are not expanded.
  2. search-direction Either "forward" or "backward"
  3. search-type Either "literal", "case", or "regex"
  4. mark-letter The mark command limits users to single letters. Inside of macros, numeric marks are allowed, which won't interfere with marks set by the user.
  5. (macro or shell) Name of the command exactly as -menu-item-name specified in the Shell Menu or Macro Menu dialogs

*  Keyboard-Only Actions

  • backward_character() :
    Moves the cursor one character to the left.
  • backward_paragraph() :
    Moves the cursor to the beginning of the paragraph, or if the cursor is already at the beginning of a paragraph, moves the cursor to the beginning of the previous paragraph. Paragraphs are defined as regions of text delimited by one or more blank lines.
  • backward_word() :
    Moves the cursor to the beginning of a word, or, if the cursor is already at the beginning of a word, moves the cursor to the beginning of the previous word. Word delimiters are user-settable, and defined by the X resource wordDelimiters
  • beginning_of_file() :
    Moves the cursor to the beginning of the file.
  • beginning_of_line() :
    Moves the cursor to the beginning of the line.
  • beginning_of_selection() :
    Moves the cursor to the beginning of the selection without disturbing the selection.
  • copy_clipboard() :
    Copies the current selection to the clipboard.
  • copy_primary() :
    Copies the primary selection to the cursor.
  • copy_to() :
    If a secondary selection exists, copies the secondary selection to the cursor. If no secondary selection exists, copies the primary selection to the pointer location.
  • copy_to_or_end_drag() :
    Completes either a secondary selection operation, or a primary drag. If the user is dragging the mouse to adjust a secondary selection, the selection is copied and either inserted at the cursor location, or, if pending-delete is on and a primary selection exists in the window, replaces the primary selection. If the user is dragging a block of text (primary selection), completes the drag operation and leaves the text at it's current location
  • cut_clipboard() :
    Deletes the text in the primary selection and places it in the clipboard.
  • cut_primary() :
    Copies the primary selection to the cursor and deletes it at its original location.
  • delete_selection() :
    Deletes the contents of the primary selection.
  • delete_next_character() :
    If a primary selection exists, deletes its contents. Otherwise, deletes the character following the cursor.
  • delete_previous_character() :
    If a primary selection exists, deletes its contents. Otherwise, deletes the character before the cursor.
  • delete_next_word() :
    If a primary selection exists, deletes its contents. Otherwise, deletes the word following the cursor.
  • delete_previous_word() :
    If a primary selection exists, deletes its contents. Otherwise, deletes the word before the cursor.
  • delete_to_start_of_line() :
    If a primary selection exists, deletes its contents. Otherwise, deletes the characters between the cursor and the start of the line.
  • delete_to_end_of_line() :
    If a primary selection exists, deletes its contents. Otherwise, deletes the characters between the cursor and the end of the line.
  • deselect_all() :
    De-selects the primary selection.
  • end_of_file() :
    Moves the cursor to the end of the file.
  • end_of_line() :
    Moves the cursor to the end of the line.
  • end_of_selection() :
    Moves the cursor to the end of the selection without disturbing the selection.
  • exchange() :
    Exchange the primary and secondary selections.
  • extend_adjust() :
    Attached mouse-movement events to begin a selection between the cursor and the mouse, or extend the primary selection to the mouse position.
  • extend_end() :
    Completes a primary drag-selection operation.
  • extend_start() :
    Begins a selection between the cursor and the mouse. A drag-selection operation can be started with either extend_start or grab_focus.
  • forward_character() :
    Moves the cursor one character to the right.
  • forward_paragraph() : Moves the cursor to the beginning of the next paragraph. Paragraphs are defined as regions of text delimited by one ormore blank lines.
  • forward_word() : Moves the cursor to the beginning of the next word. Word delimiters are user-settable, and defined by the X resource wordDelimiters.
  • grab_focus() : Moves the cursor to the mouse pointer location, and prepares for a possible drag-selection operation (bound to extend_adjust), or multi-click operation (a further grab_focus action). If a second invocation of grab focus follows immediately, it selects a whole word, or a third, a whole line.
  • insert_string("string") : If pending delete is on and the cursor is inside the selection, replaces the selection with "string". Otherwise, inserts "string" at the cursor location.
  • key_select("direction") : Moves the cursor one character in "direction" ("left", "right", "up", or "down") and extends the selection. Same as forward/backward-character("extend"), or process-up/down("extend"), for compatibility with previous versions.
  • move-destination() : Moves the cursor to the pointer location without disturbing the selection. (This is an unusual way of working. We left it in for compatibility with previous versions, but if you actually use this capability, please send us some mail, otherwise it is likely to disappear in the future.
  • move_to() : If a secondary selection exists, deletes the contents of the secondary selection and inserts it at the cursor, or if pending-delete is on and there is a primary selection, replaces the primary selection. If no secondary selection exists, moves the primary selection to the pointer location, deleting it from its original position.
  • move_to_or_end_drag() : Completes either a secondary selection operation, or a primary drag. If the user is dragging the mouse to adjust a secondary selection, the selection is deleted and either inserted at the cursor location, or, if pending-delete is on and a primary selection exists in the window, replaces the primary selection. If the user is dragging a block of text (primary selection), completes the drag operation and deletes the text from it's current location.
  • newline() : Inserts a newline character. If Auto Indent is on, lines up the indentation of the cursor with the current line.
  • newline_and_indent() : Inserts a newline character and lines up the indentation of the cursor with the current line, regardless of the setting of Auto Indent.
  • newline_no_indent() : Inserts a newline character, without automatic indentation, regardless of the setting of Auto Indent.
  • next_page() : Moves the cursor and scroll forward one page.
  • page_left() : Move the cursor and scroll left one page.
  • page_right() : Move the cursor and scroll right one page.
  • paste_clipboard() : Insert the contents of the clipboard at the cursor, or if pending delete is on, replace the primary selection with the contents of the clipboard.
  • previous_page() : Moves the cursor and scroll backward one page.
  • process_bdrag() : Same as secondary_or_drag_start for compatibility with previous versions.
  • process_cancel() : Cancels the current extend_adjust, secondary_adjust, or secondary_or_drag_adjust in progress.
  • process_down() : Moves the cursor down one line.
  • process_return() : Same as newline for compatibility with previous versions.
  • process_shift_down() : Same as process_down("extend") for compatibility with previous versions.
  • process_shift_up() : Same as process_up("extend") for compatibility with previous versions.
  • process_tab() : If tab emulation is turned on, inserts an emulated tab, otherwise inserts a tab character.
  • process_up() : Moves the cursor up one line.
  • scroll_down(nLines) :
    Scroll the display down (towards the end of the file) by nLines.
  • scroll_up(nLines) :
    Scroll the display up (towards the beginning of the file) by nLines.
  • scroll_to_line(lineNum) :
    Scroll to position line number lineNum at the top of the pane. The first line of a file is line 1.
  • secondary_adjust() :
    Attached mouse-movement events to extend the secondary selection to the mouse position.
  • secondary_or_drag_adjust() :
    Attached mouse-movement events to extend the secondary selection, or reposition the primary text being dragged. Takes two optional arguments, "copy", and "overlay". "copy" leaves a copy of the dragged text at the site at which the drag began. "overlay" does the drag in overlay mode, meaning the dragged text is laid on top of the existing text, obscuring and ultimately deleting it when the drag is complete.
  • secondary_or_drag_start() :
    To be attached to a mouse down event. Begins drag selecting a secondary selection, or dragging the contents of the primary selection, depending on whether the mouse is pressed inside of an existing primary selection.
  • secondary_start() :
    To be attached to a mouse down event. Begin drag selecting a secondary selection.
  • select_all() : Select the entire file.
  • self_insert() :
    To be attached to a key-press event, inserts the character equivalent of the key pressed.

Arguments to Keyboard Action Routines

In addition to the arguments listed in the call descriptions, any routine involving cursor movement can take the argument "extend", meaning, adjust the primary selection to the new cursor position. Routines which take the "extend" argument as well as mouse dragging operations for both primary and secondary selections can take the optional keyword "rect", meaning, make the selection rectangular.

 

<< Previous Section
Macro Subroutines
Table of Contents
Next Section >>
Customizing NEdit

 

 

. . Released on  Wed, 6 Nov 2002  by C. Denat