📄 actions.html
字号:
<HTML><HEAD><TITLE> Macro/Shell Extensions </TITLE></HEAD><BODY><A NAME="Action_Routines"></A><H2> Action Routines </H2><P>All of the editing capabilities of NEdit are represented as a special type ofsubroutine, called an action routine, which can be invoked from both macrosand translation table entries (see "<A HREF="binding.html#Key_Binding">Key Binding</A>" in theCustomizing section of the Help menu).</P><P><H3>Actions Representing Menu Commands</H3></P><P><PRE> File Menu Search Menu ----------------------- ------------------------- new() find() open() find_dialog() open_dialog() find_again() open_selected() find_selection() close() replace() save() replace_dialog() save_as() replace_all() save_as_dialog() replace_in_selection() revert_to_saved() replace_again() include_file() goto_line_number() include_file_dialog() goto_line_number_dialog() load_macro_file() goto_selected() load_macro_file_dialog() mark() load_tags_file() mark_dialog() load_tags_file_dialog() goto_mark() unload_tags_file() goto_mark_dialog() print() goto_matching() print_selection() select_to_matching() exit() find_definition()</PRE></P><P><PRE> Edit Menu Shell Menu ----------------------- ------------------------- undo() filter_selection_dialog() redo() filter_selection() delete() execute_command() select_all() execute_command_dialog() shift_left() execute_command_line() shift_left_by_tab() shell_menu_command() shift_right() shift_right_by_tab() Macro Menu uppercase() ------------------------- lowercase() macro_menu_command() fill_paragraph() repeat_macro() control_code_dialog() repeat_dialog()</PRE></P><P><PRE> Windows Menu ------------------------- split_window() close_pane()</PRE></P><P>An action representing a menu command is named the same as its correspondingmenu item except that all punctuation is removed, all letters are changed tolower case, and spaces are replaced with underscores. To present a dialog toask the user for input, use the actions with the `_dialog` suffix. Actionswithout the `_dialog` suffix take the information from the routine'sarguments (see below). </P><P><H3>Menu Action Routine Arguments</H3></P><P>Arguments are text strings enclosed in quotes. Below are the menu actionroutines which take arguments. Optional arguments are enclosed in [].</P><P><PRE> <B>close</B>( ["prompt" | "save" | "nosave"] )</PRE></P><P><PRE> <B>execute_command</B>( shell-command )</PRE></P><P><PRE> <B>filter_selection</B>( shell-command )</PRE></P><P><PRE> <B>find</B>( search-string [, <I>search-direction</I>] [, <I>search-type</I>] [, <I>search-wrap</I>] )</PRE></P><P><PRE> <B>find_again</B>( [<I>search-direction</I>] [, <I>search-wrap</I>] )</PRE></P><P><PRE> <B>find_definition</B>( [tag-name] )</PRE></P><P><PRE> <B>find_dialog</B>( [<I>search-direction</I>] [, <I>search-type</I>] [, <I>keep-dialog</I>] )</PRE></P><P><PRE> <B>find_selection</B>( [<I>search-direction</I>] [, <I>search-wrap</I>] [, <I>non-regex-search-type</I>] )</PRE></P><P><PRE> <B>goto_line_number</B>( [<I>line-number</I>] [, <I>column-number</I>] )</PRE></P><P><PRE> <B>goto_mark</B>( <I>mark-letter</I> )</PRE></P><P><PRE> <B>include_file</B>( <I>filename</I> )</PRE></P><P><PRE> <B>load_tags_file</B>( <I>filename</I> )</PRE></P><P><PRE> <B>macro_menu_command</B>( <I>macro-menu-item-name</I> )</PRE></P><P><PRE> <B>mark</B>( <I>mark-letter</I> )</PRE></P><P><PRE> <B>open</B>( <I>filename</I> )</PRE></P><P><PRE> <B>replace</B>( search-string, replace-string, [, <I>search-direction</I>] [, <I>search-type</I>] [, <I>search-wrap</I>] )</PRE></P><P><PRE> <B>replace_again</B>( [<I>search-direction</I>] [, <I>search-wrap</I>] )</PRE></P><P><PRE> <B>replace_all</B>( search-string, replace-string [, <I>search-type</I>] )</PRE></P><P><PRE> <B>replace_dialog</B>( [<I>search-direction</I>] [, <I>search-type</I>] [, <I>keep-dialog</I>] )</PRE></P><P><PRE> <B>replace_in_selection</B>( search-string, replace-string [, <I>search-type</I>] )</PRE></P><P><PRE> <B>save_as</B>( <I>filename</I> )</PRE></P><P><PRE> <B>shell_menu_command</B>( <I>shell-menu-item-name</I> )</PRE></P><P><PRE> <B>unload_tags_file</B>( <I>filename</I> )</PRE></P><P><PRE> <B>----------- Some notes on argument types above -----------</B></PRE></P><P><PRE> <I>filename</I> Path names are relative to the directory from which NEdit was started. Shell interpreted wildcards and `~' are not expanded.</PRE></P><P><PRE> <I>keep-dialog</I> Either "keep" or "nokeep".</PRE></P><P><PRE> <I>mark-letter</I> 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.</PRE></P><P><PRE> <I>macro-menu-item-name</I> Name of the command exactly as specified in the Macro Menu dialogs.</PRE></P><P><PRE> <I>non-regex-search-type</I> Either "literal", "case", "word", or "caseWord".</PRE></P><P><PRE> <I>search-direction</I> Either "forward" or "backward".</PRE></P><P><PRE> <I>search-type</I> Either "literal", "case", "word", "caseWord", "regex", or "regexNoCase".</PRE></P><P><PRE> <I>search-wrap</I> Either "wrap" or "nowrap".</PRE></P><P><PRE> <I>shell-menu-item-name</I> Name of the command exactly as specified in the Shell Menu dialogs.</PRE></P><P><H3>Window Preferences Actions</H3></P><P><PRE><B>set_auto_indent( "off" | "on" | "smart" )</B></PRE>Set auto indent mode for the current window.</P><P><PRE><B>set_em_tab_dist( em-tab-distance )</B></PRE>Set the emulated tab size. An em-tab-distance value of 0 or -1 translates to no emulated tabs. Em-tab-distance must be smaller than 1000.</P><P><PRE><B>set_fonts( font-name, italic-font-name, bold-font-name, bold-italic-font-name )</B></PRE>Set all the fonts used for the current window.</P><P><PRE><B>set_highlight_syntax( [0 | 1] )</B></PRE>Set syntax highlighting mode for the current window. A value of 0 turns it off and a value of 1 turns it on. If no parameters are supplied the option is toggled.</P><P><PRE><B>set_incremental_backup( [0 | 1] )</B></PRE>Set incremental backup mode for the current window. A value of 0 turns it off and a value of 1 turns it on. If no parameters are supplied the option is toggled.</P><P><PRE><B>set_incremental_search_line( [0 | 1] )</B></PRE>Show or hide the incremental search line for the current window. A value of 0 turns it off and a value of 1 turns it on. If no parameters are supplied the option is toggled.</P><P><PRE><B>set_language_mode( language-mode )</B></PRE>Set the language mode for the current window. If the language mode is "" or unrecognized, it will be set to Plain.</P><P><PRE><B>set_locked( [0 | 1] )</B></PRE>This only affects the locked status of a file, not it's read-only status. Permissions are NOT changed. A value of 0 turns it off and a value of 1 turns it on. If no parameters are supplied the option is toggled.</P><P><PRE><B>set_make_backup_copy( [0 | 1] )</B></PRE>Set whether backup copies are made during saves for the current window. A value of 0 turns it off and a value of 1 turns it on. If no parameters are supplied the option is toggled.</P><P><PRE><B>set_overtype_mode( [0 | 1] )</B></PRE>Set overtype mode for the current window. A value of 0 turns it off and a value of 1 turns it on. If no parameters are supplied the option is toggled.</P><P><PRE><B>set_show_line_numbers( [0 | 1] )</B></PRE>Show or hide line numbers for the current window. A value of 0 turns it off and a value of 1 turns it on. If no parameters are supplied the option is toggled.</P><P><PRE><B>set_show_matching( "off" | "delimiter" | "range" )</B></PRE>Set show matching (...) mode for the current window.</P><P><PRE><B>set_match_syntax_based( [0 | 1] )</B></PRE>Set whether matching should be syntax based for the current window.</P><P><PRE><B>set_statistics_line( [0 | 1] )</B></PRE>Show or hide the statistics line for the current window. A value of 0 turns it off and a value of 1 turns it on. If no parameters are supplied the option is toggled.</P><P><PRE><B>set_tab_dist( tab-distance )</B></PRE>Set the size of hardware tab spacing. Tab-distance must must be a value greater than 0 and no greater than 20.</P><P><PRE><B>set_use_tabs( [0 | 1] )</B></PRE>Set whether tabs are used for the current window. A value of 0 turns it off and a value of 1 turns it on. If no parameters are supplied the option is toggled.</P><P><PRE><B>set_wrap_margin( wrap-width )</B></PRE>Set the wrap width for text wrapping of the current window. A valueof 0 means to wrap at window width.</P><P><PRE><B>set_wrap_text( "none" | "auto" | "continuous" )</B></PRE>Set wrap text mode for the current window.</P><P><H3>Keyboard-Only Actions</H3></P><P>In addition to the arguments listed in the call descriptions below, anyroutine involving cursor movement can take the argument "extend", meaning,adjust the primary selection to the new cursor position. Routines which takethe "extend" argument as well as mouse dragging operations for both primaryand secondary selections can take the optional keyword "rect", meaning, makethe selection rectangular. Any routine that accepts the "scrollbar" argumentwill move the display but not the cursor or selection. Routines that acceptthe "nobell" argument will fail silently without beeping, when that argumentis supplied.</P><P><PRE><B>backward_character( ["nobell"] )</B></PRE>Moves the cursor one character to the left.</P><P><PRE><B>backward_paragraph(["nobell"] )</B></PRE>Moves the cursor to the beginning of the paragraph, orif the cursor is already at the beginning of a paragraph, moves the cursor tothe beginning of the previous paragraph. Paragraphs are defined as regionsof text delimited by one or more blank lines.</P><P><PRE><B>backward_word( ["nobell"] )</B></PRE>Moves the cursor to the beginning of a word, or, if thecursor is already at the beginning of a word, moves the cursor to thebeginning of the previous word. Word delimiters are user-settable, anddefined by the X resource wordDelimiters.</P><P><PRE><B>beginning_of_file( ["scrollbar"] )</B></PRE>Moves the cursor to the beginning of the file.</P><P><PRE><B>beginning_of_line( ["absolute"] )</B> </PRE>Moves the cursor to the beginning of the line. If"absolute" is given, always moves to the absolute beginning of line,regardless of the text wrapping mode.</P><P><PRE><B>beginning_of_selection()</B></PRE>Moves the cursor to the beginning of the selectionwithout disturbing the selection.</P><P><PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -