JOE() JOE() NAME JOE - Joe´s Own Editor Syntax joe [global-options] [ [local-options] filename ]... jstar [global-options] [ [local-options] filename ]... jmacs [global-options] [ [local-options] filename ]... rjoe [global-options] [ [local-options] filename ]... jpico [global-options] [ [local-options] filename ]... Description JOE is a powerful console screen editor. It has a "mode-less" user interface which is similar to many user-friendly PC editors. Users of Micro-Pro´s WordStar or Borland´s "Turbo" lan‐ guages will feel at home. JOE is a full featured UNIX screen-editor though, and has many fea‐ tures for editing programs and text. JOE also emulates several other editors. JSTAR is a close imitation of WordStar with many "JOE" extensions. JPICO is a close imitation of the Pine mailing system´s PICO editor, but with many extensions and improvements. JMACS is a GNU-EMACS imitation. RJOE is a restricted version of JOE, which allows you to edit only the files specified on the command line. Although JOE is actually five different editors, it still requires only one executable, but one with five different names. The name of the editor with an "rc" appended gives the name of JOE´s initialization file, which determines the personality of the editor. JOE is free software; you can distribute it and/or modify it under the terms of the GNU Gen‐ eral Public License as published by the Free Software Foundation. JOE is available over the Internet from http://www.sourceforge.net/projects/joe-editor. Usage To start the editor, type joe followed by zero or more names of files you want to edit. Each file name may be preceded by a local option setting (see the local options table which fol‐ lows). Other global options, which apply to the editor as a whole, may also be placed on the command line (see the global options table which follows). If you are editing a new file, you can either give the name of the new file when you invoke the editor, or in the editor when you save the new file. A modified syntax for file names is provided to allow you to edit pro‐ gram output, standard input/output, or sections of files or devices. See the section File‐ names below for details. Once you are in the editor, you can type in text and use special control-character sequences to perform other editing tasks. To find out what the control-character sequences are, read the rest of this man page or type ^K H for help in the editor. Now for some obscure computer-lore: The ^ means that you hold down the Control key while pressing the following key (the same way the Shift key works for uppercase letters). A number of control-key sequences are duplicated on other keys, so that you don´t need to press the control key: Esc will work in place of ^[, Del will work in place of ^?, Backspace will work in place of ^H, Tab will work in place of ^I, Return or Enter will work in place of ^M and Linefeed will work in place of ^J. Some key‐ boards may give you trouble with some control keys. ^_, ^^ and ^@ can usually be entered without pressing shift (i.e., try ^-, ^6 and ^2). Other keyboards may reassign these to other keys. Try: ^., ^, and ^/. ^Space can usually be used in place of ^@. ^\ and ^] are inter‐ preted by many communication programs, including telnet and kermit. Usually you just hit the key twice to get it to pass through the communication program. On some keyboards, holding the Alt key down while pressing another key is the same as typing Esc before typing the other key. Once you have typed ^K H, the first help window appears at the top of the screen. You can continue to enter and edit text while the help window is on. To page through other topics, hit Esc , and Esc . (that is, Esc , and Esc .). Use ^K H to dismiss the help window. You can customize the keyboard layout, the help screens and a number of behavior defaults by copying JOE´s initialization file (usually /etc/joe/joerc) to .joerc in your home directory and then by modifying it. See the section joerc below. To have JOE used as your default editor for e-mail and News, you need to set the EDITOR and VISUAL environment variables in your shell initialization file (.cshrc or .profile) to refer to JOE (JOE usually resides as /usr/bin/joe). There are a number of other obscure invocation parameters which may have to be set, particu‐ larly if your terminal screen is not updating as you think it should. See the section Envi‐ ronment variables below. Command Line Options These options can also be specified in the joerc file. Local options can be set depending on the file-name extension. Programs (.c, .h or .p extension) usually have autoindent enabled. Wordwrap is enabled on other files, but rc files have it disabled. An option is enabled when it´s given like this: -wordwrap An option is disabled when it´s given like this: --wordwrap Some options take arguments. Arguments are given like this: -lmargin 5 The following global options may be specified on the command line: • asis Characters with codes above 127 will be sent to the terminal as-is, instead of as inverse of the corresponding character below 128. If this does not work, check your terminal server. This option has no effect if UTF-8 encoding is used. • assume_256color Assume ANSI-like terminal emulator supports 256 colors even if termcap entry says it doesn´t. • assume_color Assume ANSI-like terminal emulator supports color even if termcap entry says it doesn´t. • text_color color Set color for text. • status_color color Set color for status bar. • help_color color Set color for help. • menu_color color Set color for menus. • prompt_color color Set color for prompts. • msg_color color Set color for messages. • autoswap Automatically swap ^K B with ^K K if necessary to mark a legal block during block copy/move commands. • backpath path Sets path to a directory where all backup files are to be stored. If this is unset (the default) backup files are stored in the directory containing the file. • baud nnn Set the baud rate for the purposes of terminal screen optimization (overrides value re‐ ported by stty). JOE inserts delays for baud rates below 19200, which bypasses tty buffering so that typeahead will interrupt the screen output. Scrolling commands will not be used for 38400 baud and above. This is useful for X-terms and other console ttys which really aren´t going over a serial line. • beep Enable beeps when edit commands return errors, for example when the cursor goes past ex‐ tremes. • break_links When enabled, JOE first deletes the file before writing it in order to break hard-links and symbolic-links. • break_hardlinks When enabled, and the file is not a symbolic links, JOE first deletes the file before writing it in order to break hard-links. • brpaste When JOE starts, send command to the terminal emulator that enables "bracketed paste mode" (but only if the terminal seems to have the ANSI command set). In this mode, text pasted into the window is bracketed with ESC [ 2 0 0 ~ and ESC [ 2 0 1 ~. • columns nnn Set number of columns in terminal emulator (in case termcap entry is wrong). This is only useful on old system which don´t have the "get window size" ioctl. • csmode Enable continued search mode: Successive ^K Fs repeat the current search instead of prompting for a new one. • dopadding Enable JOE to send padding NULs to the terminal (for very old terminals). • exask When set, ^K X prompts for a new name before saving the file. • floatmouse When set, mouse clicks can position the cursor beyond the ends of lines. • guess_crlf When set, JOE tries to guess the file format MS-DOS or UNIX. • guess_indent When set, JOE tries to guess the indentation character and indentation step based on the contents of the file. The algorithm is to find the greatest common factor of the three most common indentations found in the file. • guess_non_utf8 When set, enable guessing of non-UTF-8 files in UTF-8 locales. • guess_utf8 When set, enable guessing of UTF-8 files in non-UTF-8 locales. • guess_utf16 When set, enable guessing of UTF-16 files. If a UTF-16BE or UTF-16LE file is detected, it is converted to UTF-8 during load, and converted back to UTF-16 during save. • helpon When set, start off with the on-line help enabled. • help_is_utf8 When set, the help text in the joerc file is assumed to be UTF-8. • icase Search is case insensitive by default when set. • joe_state Enable reading and writing of ~/.joe_state file • joexterm Set this if xterm was configured with --paste64 option for better mouse support. • keepup The column number on the status line is updated constantly when this is set, otherwise it is updated only once a second. • language language Sets language for aspell. • lightoff Automatically turn off ^K B ^K K highlighting after a block operation. • lines nnn Set number of lines in terminal emulator (in case termcap entry is wrong). This is only useful on old system which don´t have the "get window size" ioctl. • marking Enable marking mode: highlights between ^K B and cursor. • menu_above Put menus above prompt instead of below them. • menu_explorer Stay in menu when a directory is selected (otherwise the directory is added to the path and the cursor jumps back to the prompt). • menu_jump Jump into the file selection menu when Tab Tab is hit. • mid If this option is set and the cursor moves off the window, the window will be scrolled so that the cursor is in the center. This option is forced on slow terminals which don´t have scrolling commands. • left nn This sets the number of columns the screen scrolls to the left when cursor moves past the left edge or when the crawll command is issued. If nn is negative, then it´s the fraction of the screen to scroll. For example, -2 means scroll 1/2 the screen. • right nn This sets the number of columns the screen scrolls to the right when cursor moves past the right edge or when the crawlr command is issued. If nn is negative, then it´s the fraction of the screen to scroll. For example, -3 means scroll 1/3 the screen. • mouse Enable xterm mouse support. • nobackups Disable backup files. • nocurdir Disable current-directory prefix in prompts. • noexmsg Disable exiting message ("File not changed so no update needed") • nolinefeeds Disable sending linefeeds to preserve screen history in terminal emulator´s scroll-back buffer (only relevant when notite mode is enabled). • nolocks Disable EMACS compatible file locks. • nomodcheck Disable periodic file modification check. • nonotice This option prevents the copyright notice from being displayed when the editor starts. • nosta This option eliminates the top-most status line. It´s nice for when you only want to see your text on the screen or if you´re using a vt52. • notagsmenu Disable selection menu for tags search with multiple results. • notite Disable ti and te termcap sequences which are usually set up to save and restore the ter‐ minal screen contents when JOE starts and exits. • pastehack If keyboard input comes in as one block assume it´s a mouse paste and disable autoindent and wordwrap. • noxon Disable ^S and ^Q flow control, possibly allowing ^S and ^Q to be used as editor keys. • orphan Orphan extra files given on the command line instead of creating windows for them (the files are loaded, but you need to use switch-buffer commands to access them). • pg nnn Set number of lines to keep during Page Up and Page Down (use -1 for 1/2 window size). • regex Use standard regular expression syntax by default, instead of the JOE syntax (where spe‐ cial characters have their meaning only when preceded with backslash). • restore Set to have cursor positions restored to last positions of previously edited files. • rtbutton Swap left and right mouse buttons. • search_prompting Show previous search string in search command (like in PICO). • skiptop nnn When set to N, the first N lines of the terminal screen are not used by JOE and are in‐ stead left with their original contents. This is useful for programs which call JOE to leave a message for the user. • square Enable rectangular block mode. • transpose Transpose rows with columns in all menus. • title Display context (titles) in status line. When enabled this shows the first line of the function that the cursor is in on the status line. The syntax file context.jsf identi‐ fies which lines are title lines. • type Select file type, overriding the automatically determined type. The file types are de‐ fined in the ftyperc file. • undo_keep nnn Sets number of undo records to keep (0 means infinite). • usetabs Set to allow rectangular block operations to use tabs. • wrap Enable search to wrap to beginning of file. The following local options may be specified on the command line: • +nnn The cursor starts on the specified line. • autoindent Enable auto-indent mode. When you hit Enter on an indented line, the indentation is du‐ plicated onto the new line. • c_comment Enable ^G skipping of C-style comments /.../ • cpara characters Sets list of characters which can indent paragraphs. • cnotpara characters Sets list of characters which begin lines which are definitely not part of paragraphs. • cpp_comment Enable ^G skipping of C++-style comments // ... • crlf JOE uses CR-LF as the end of line sequence instead of just LF. This is for editing MS-DOS or VMS files. • encoding encoding Set file encoding (like utf-8 or 8859-1). • flowed Set to force an extra space after each line of a paragraph but the last. • force When set, a final newline is appended to the file if there isn´t one when the file is saved. • french When set, only one space is inserted after periods in paragraph reformats instead of two. • hex Enable hex-dump mode. • highlight Enable syntax highlighting. • highlighter_context Enable use of syntax file to identify comments and strings which should be skipped over during ^G matching. • indentc nnn Sets the indentation character for shift left and shift right (^K , and ^K .). Use 32 for Space, 9 for Tab. • indentfirst When set, the smart home key jumps to the indentation point first, otherwise it jumps to column 1 first. • istep nnn Sets indentation step. • linums Enable line number display. • lmargin Set left margin. • lmsg Define left-side status bar message. • overwrite Enable overtype mode. Typing overwrites existing characters instead of inserting before them. • picture Enable "picture" mode- allows cursor to go past ends of lines. • pound_comment ^G ignores # ... comments. • purify Fix indentation if necessary before shifting or smart backspace. For example, if indenta‐ tion uses a mix of tabs and spaces, and indentc is space, then indentation will be con‐ verted to all spaces before the shifting operation. • rdonly Set read-only mode. • rmargin nnn Set right margin. • rmsg string Define right-side status bar message. • semi_comment ^G ignores ; ... comments. • single_quoted ^G ignores ´...´ • smartbacks Enable smart backspace and tab. When this mode is set backspace and tab indent or unin‐ dent based on the values of the istep and indentc options. • smarthome Home key first moves cursor to beginning of line, then if hit again, to the first non-blank character. • smsg string Define status command format when cursor is on a character. • spaces Insert spaces when Tab key is hit. • syntax syntax Set syntax for syntax highlighting. • tab nnn Set tab stop width. • text_delimiters word delimiter list Give list of word delimiters which ^G will step through. For example, "begin=end:if=elif=else=endif" means that ^G will jump between the matching if, elif, else and endif. • vhdl_comment ^G ignores -- ... comments • wordwrap JOE wraps the previous word when you type past the right margin. • zmsg string Define status command format when cursor is at end of file. • xmsg string Define startup message (usually the copyright notice). • aborthint string Give the key sequence to show in prompts for abort (usually ^C). • helphint string Give the key sequence to show in prompts for help (usually ^K H). Colors and attributes Combine attributes and up to one foreground color and one background color to create argu‐ ments for color options like text_color. For example: bold+bg_green+blue • Attributes: bold, inverse, blink, dim, underline, and italic • Foreground colors: white, cyan, magenta, blue, yellow, green, red, or black • Background colors: bg_white, bg_cyan, bg_magenta, bg_blue, bg_yellow, bg_green, bg_red or bg_black With a 16 color or 256 color terminal emulator (export TERM=xterm-16color), these brighter than normal colors become available: • Foreground: WHITE, CYAN, MAGENTA, BLUE, YELLOW, GREEN, RED or BLACK • Background: bg_WHITE, bg_CYAN, bg_MAGENTA, bg_BLUE, bg_YELLOW, bg_GREEN, bg_RED or bg_BLACK With a 256 color terminal emulator (export TERM=xterm-256color), these become available: • fg_RGB and bg_RGB, where R, G and B rand from 0 - 5. So: fg_500 is bright red. • fg_NN and bg_NN give shades of grey, where the intensity, NN, ranges from 0 - 23. Status line definition strings -lmsg defines the left-justified string and -rmsg defines the right-justified string. The first character of -rmsg is the background fill character. -smsg defines the status command (^K Space). -zmsg defines it when the cursor is at the end of the file. The last character of smsg or zmsg is the fill character. The following escape sequences can be used in these strings: %t 12 hour time %u 24 hour time %T O for overtype mode, I for insert mode %W W if wordwrap is enabled %I A if autoindent is enabled %X Rectangle mode indicator %n File name %m ´(Modified)´ if file has been changed %* ´*´ if file has been changed %R Read-only indicator %r Row (line) number %c Column number %o Byte offset into file %O Byte offset into file in hex %a Ascii value of character under cursor %A Ascii value of character under cursor in hex %w Width of character under cursor %p Percent of file cursor is at %l No. lines in file %k Entered prefix keys %S ´*SHELL*´ if there is a shell running in window %M Macro recording message %y Syntax %e Encoding %x Context (first non-indented line going backwards) %dd day %dm month %dY year %Ename% value of environment variable %Tname% value of option (ON or OFF for Boolean options) These formatting escape sequences may also be given: \i Inverse \u Underline \b Bold \d Dim \f Blink \l Italic Basic Editing When you type characters into the editor, they are normally inserted into the file being edited (or appended to the file if the cursor is at the end of the file). This is the normal operating mode of the editor. If you want to replace some existing text, you have to delete the old text before or after you type in the replacement text. The Backspace key can be used for deleting text: move the cursor to right after the text you want to delete and hit Backspace a number of times. Hit the Enter or Return key to insert a line-break. For example, if the cursor was in the middle of a line and you hit Enter, the line would be split into two lines with the cursor appearing at the beginning of the second line. Hit Backspace at the beginning of a line to eliminate a line-break. Use the arrow keys to move around the file. If your keyboard doesn´t have arrow keys (or if they don´t work for some reason), use ^F to move forwards (right), ^B to move backwards (left), ^P to move to the previous line (up), and ^N to move to the next line (down). The right and left arrow keys simply move forwards or backwards one character at a time through the text: if you´re at the beginning of a line and you press left-arrow, you will end up at the end of the previous line. The up and down arrow keys move forwards and backwards by enough characters so that the cursor appears in the same column that it was in on the origi‐ nal line. If you want to indent the text you enter, you can use the Tab key. This inserts a special control character which makes the characters which follow it begin at the next tab stop. Tab stops normally occur every 8 columns, but this can be changed with the ^T D command. PASCAL and C programmers often set tab stops on every 4 columns. If for some reason your terminal screen gets messed up (for example, if you receive a mail notice from biff), you can have the editor refresh the screen by hitting ^R. There are many other keys for deleting text and moving around the file. For example, hit ^D to delete the character the cursor is on instead of deleting backwards like Backspace. ^D will also delete a line-break if the cursor is at the end of a line. Type ^Y to delete the entire line the cursor is on or ^J to delete just from the cursor to the end of the line. Hit ^A to move the cursor to the beginning of the line it´s on. Hit ^E to move the cursor to the end of the line. Hit ^U or ^V for scrolling the cursor up or down 1/2 a screen´s worth. "Scrolling" means that the text on the screen moves, but the cursor stays at the same place relative to the screen. Hit ^K U or ^K V to move the cursor to the beginning or the end of the file. Look at the help screens in the editor to find even more delete and movement com‐ mands. If you make a mistake, you can hit ^_ to "undo" it. On most keyboards you hit just ^- to get ^_, but on some you might have to hold both the Shift and Control keys down at the same time to get it. If you "undo" too much, you can "redo" the changes back into existence by hitting ^^ (type this with just ^6 on most keyboards). Cursor position history If you were editing in one place within the file, and you then temporarily had to look or edit some other place within the file, you can get back to the original place by hitting ^K -. This command actually returns you to the last place you made a change in the file. You can step through a history of places with ^K - and ^K =, in the same way you can step through the history of changes with the "undo" and "redo" commands. Save and exit When you are done editing the file, hit ^K X to exit the editor. You will be prompted for a file name if you hadn´t already named the file you were editing. When you edit a file, you actually edit only a copy of the file. So if you decide that you don´t want the changes you made to a file during a particular edit session, you can hit ^C to exit the editor without saving them. If you edit a file and save the changes, a backup copy of that file is created in the current directory, with a ~ appended to the name, which contains the original version of the file. File operations You can hit ^K D to save the current file (possibly under a different name from what the file was called originally). After the file is saved, you can hit ^K E to edit a different file. If you want to save only a selected section of the file, see the section on Blocks below. If you want to include another file in the file you´re editing, use ^K R to insert it. Filenames Wherever JOE expects you to enter a file name, whether on the command line or in prompts within the editor, you may also type: • !command To read or write data to or from a shell command. For example, use joe ´´!ls´´ to get a copy of your directory listing to edit or from within the editor use ^K D !mail jhallen AT world.com to send the file being edited to me. • >>filename Use this to have JOE append the edited text to the end of the file "filename." • filename,START,SIZE Use this to access a fixed section of a file or device. START and SIZE may be entered in dec‐ imal (ex.: 123) octal (ex.: 0777) or hexadecimal (ex.: 0xFF). For example, use joe /dev/fd0,508,2 to edit bytes 508 and 509 of the first floppy drive in Linux. • - Use this to get input from the standard input or to write output to the standard output. For example, you can put JOE in a pipe of commands: quota -v | joe | mail root, if you want to complain about your low quota. Using JOE in a shell script JOE used to use /dev/tty to access the terminal. This caused a problem with idle-session killers (they would kill JOE because the real tty device was not being accessed for a long time), so now JOE only uses /dev/tty if you need to pipe a file into JOE, as in: echo "hi" | joe If you want to use JOE in a shell script which has its stdin/stdout redirected, but you do not need to pipe to it, you should simply redirect JOE´s stdin/stdout to /dev/tty: joe filename </dev/tty >/dev/tty Word wrap and formatting If you type past the right edge of the screen in a C or PASCAL language file, the screen will scroll to the right to follow the cursor. If you type past the right edge of the screen in a normal file (one whose name doesn´t end in .c, .h or .p), JOE will automatically wrap the last word onto the next line so that you don´t have to hit Enter. This is called word-wrap mode. Word-wrap can be turned on or off with the ^T W command. JOE´s initialization file is usually set up so that this mode is automatically turned on for all non-program files. See the section below on the joerc file to change this and other defaults. Aside for Word-wrap mode, JOE does not automatically keep paragraphs formatted like some word-processors. Instead, if you need a paragraph to be reformatted, hit ^K J. This command "fills in" the paragraph that the cursor is in, fitting as many words in a line as is possi‐ ble. A paragraph, in this case, is a block of text separated above and below by a blank line. The margins which JOE uses for paragraph formatting and word-wrap can be set with the ^T L and ^T R commands. If the left margin is set to a value other than 1, then when you start typing at the beginning of a line, the cursor will immediately jump to the left margin. There are a number of options which control the paragraph reformatter and word wrapper: • The cpara option provides a list of characters which can indent a paragraph. For example, in e-mail quoted matter is indicated by > at the beginnings of line, so this character should be in the cpara list. • The cnotpara option provides a list of characters which, if they are the first non-white‐ space character of a line, indicate that the line is not to be included as part of a paragraph for formatting. For example, lines beginning with ´.´ in nroff can not be para‐ graph lines. • Autoindent mode affects the formatter. If autoindent is disabled, only the first line will be indented. If autoindent is enabled, the entire paragraph is indented. • french determines how many spaces are inserted after periods. • When flowed is enabled, a space is inserted after each but the last line of the para‐ graph. This indicates that the lines belong together as a single paragraph in some pro‐ grams. • When overtype is enabled, the word wrapper will not insert lines. Centering If you want to center a line within the margins, use the ^K A command. Spell checker Hit Esc N to check the spelling of the word the cursor is on using the aspell program (or is‐ pell program if you modify the joerc file). Hit Esc L to check the highlighted block or the entire file if no block is highlighted. JOE passes the language and character encoding to the spell checker. To change the language, hit ^T V. For example, use en_US for English. Overtype mode Sometimes it´s tiresome to have to delete old text before or after you insert new text. This happens, for example, when you are changing a table and you want to maintain the column posi‐ tion of the right side of the table. When this occurs, you can put the editor in overtype mode with ^T T. When the editor is in this mode, the characters you type in replace existing characters, in the way an idealized typewriter would. Also, Backspace simply moves left instead of deleting the character to the left, when it´s not at the end or beginning of a line. Overtype mode is not the natural way of dealing with text electronically, so you should go back to insert-mode as soon as possible by typing ^T T again. If you need to insert while you´re in overtype mode, hit ^@. This inserts a single Space into the text. Control and Meta characters Each character is represented by a number. For example, the number for ´A´ is 65 and the num‐ ber for ´1´ is 49. All of the characters which you normally see have numbers in the range of 32 - 126 (this particular arbitrary assignment between characters and numbers is called the ASCII character set). The numbers outside of this range, from 0 to 255, aren´t usually dis‐ played, but sometimes have other special meanings. The number 10, for example, is used for the line-breaks. You can enter these special, non-displayed control characters by first hit‐ ting ^Q and then hitting a character in the range @ A B C ... X Y Z [ ^ ] \ _ to get the num‐ ber 0 - 31, and ? to get 127. For example, if you hit ^Q J, you´ll insert a line-break char‐ acter, or if you hit ^Q I, you´ll insert a Tab character (which does the same thing the Tab key does). A useful control character to enter is 12 (^Q L), which causes most printers to advance to the top of the page. You´ll notice that JOE displays this character as an under‐ lined L. You can enter the characters above 127, the meta characters, by first hitting ^\. This adds 128 to the next (possibly control) character entered. JOE displays characters above 128 in inverse-video. Some foreign languages, which have more letters than English, use the meta characters for the rest of their alphabet. You have to put the editor in asis mode to have these passed untranslated to the terminal. Note: JOE now normally passes all 8-bits to the terminal unless the locale is set to C or POSIX. If the locale is C or POSIX, then the asis flag determines if meta characters are shown in inverse video or passed directly to the terminal. Note: In older version of JOE, you had to use Esc ´´ to enter control characters. Character sets and UTF-8 JOE natively handles two classes of character sets: UTF-8 and byte coded (like ISO-8859-1). For these character sets, the file is loaded as-is into memory, and is exactly preserved dur‐ ing save, even if it contains UTF-8 coding errors. It can not yet natively handle other major classes such as UTF-16 or GB2312. There are other restrictions: character sets must use LF (0x0A) or CR-LF (0x0D - 0x0A) as line terminators, space must be 0x20 and tab must be 0x09. Basically, the files must be UNIX or MS-DOS compati‐ ble text files. This means EBCDIC will not work properly (but you would need to handle fixed record length lines anyway) and character sets which use CR terminated lines (MACs) will not yet work. JOE now supports UTF-16 (both big endian and little endian). It supports UTF-16 by converting to UTF-8 during load, and converting back to UTF-16 during save. The terminal and the file can have different encodings. JOE will translate between the two. Currently, one of the two must be UTF-8 for translation to work. The character set for the terminal and the default character set assumed for files is deter‐ mined by the ´LC_ALL´ environment variable (and if that´s not set, LC_CTYPE and LANG are also checked). For example, if LC_ALL is set to: de_DE Then the character set will be ISO-8859-1. If LC_ALL is set to: de_DE.UTF-8 The character set will be UTF-8. Hit ^T E to change the coding for the file. Hit Tab Tab at this prompt to get a list of available codings. There are a number of built-in character sets, plus you can install char‐ acter sets in the ~/.joe/charmaps and /usr/share/joe/charmaps directories. Check: /usr/share/i18n/charmaps for example character set files. Only byte oriented character sets will work. Also, the file should not be gzipped (all of the charmap files in /usr/share/i18n/charmaps on my computer were compressed). The parser is very bad, so basi‐ cally the file has to look exactly like the example one in /usr/share/joe/charmaps. You can hit ^K Space to see the current character set. You can hit ^Q x to enter a Unicode character if the file coding is UTF-8. Prompts Most prompts record a history of the responses you give them. You can hit up and down arrow to step through these histories. Prompts are actually single line windows with no status line, so you can use any editing com‐ mand that you normally use on text within the prompts. The prompt history is actually just other lines of the same "prompt file". Thus you can can search backwards though the prompt history with the normal ^K F command if you want. Since prompts are windows, you can also switch out of them with ^K P and ^K N. Completion and selection menus You can hit Tab in just about any prompt to request JOE to complete the word you are typing. If JOE beeps, there are either no completions or many. As with the "bash" shell, hit Tab twice to bring up a list of all the possibilities. This list is actually a menu, but by de‐ fault, the cursor does not jump into it since it is usually easier to just type in your se‐ lection. You can, however, jump into the menu window with ^K P (move to previous window) and use the arrow keys and <Enter> to make your selection. Also in a menu, you can hit the first letter of any of the items to make the cursor jump directly to it. The ^T option menu works like this. If the menu is too large to fit in the window, you can hit Page Up and Page Down to scroll it (even if you have not jumped into it). Tab completion works in the search and replace prompts as well. In this case, JOE tries to complete the word based on the contents of the buffer. If you need search for the Tab charac‐ ter itself, you can enter it with ^Q Tab. Also, you can hit Esc Enter in a text window to request JOE to complete the word you are typ‐ ing. As with the search prompt, JOE tries to complete the word based on the contents of the buffer. It will bring up a menu of possibilities if you hit Esc Enter twice. Where am I? Hit ^K Space to have JOE report the line number, column number, and byte number on the last line of the screen. The number associated with the character the cursor is on (its ASCII code) is also shown. You can have the line number and/or column number always displayed on the status line by placing the appropriate escape sequences in the status line setup strings. Edit the joerc file for details. What if I hit <strong>^K</strong> by accident? Hit the space bar. This runs an innocuous command (it shows the line number on the status bar). Temporarily suspending the editor If you need to temporarily stop the editor and go back to the shell, hit ^K Z. You might want to do this to stop whatever you´re editing and answer an e-mail message or read this man page, for example. You have to type fg or exit (you´ll be told which when you hit ^K Z) to return to the editor. Searching for text Hit ^K F to have the editor search forwards or backwards for a text fragment (string) for you. You will be prompted for the text to search for. After you hit Enter, you are prompted to enter options. You can just hit Enter again to have the editor immediately search forwards for the text, or you can enter one or more of these options: • b Search backwards instead of forwards. • i Treat uppercase and lower case letters as the same when searching. Normally uppercase and lowercase letters are considered to be different. • nnn (where nnn is a number) If you enter a number, JOE searches for the Nth occurrence of the text. This is useful for going to specific places in files structured in some regular manner. • r Replace text. If you enter the r option, then you will be further prompted for replacement text. Each time the editor finds the search text, you will be prompted as to whether you want to replace the found search text with the replacement text. You hit: y to replace the text and then find the next occurrence, n to not replace this text, but to then find the next oc‐ currence, r to replace all of the remaining occurrences of the search text in the remainder of the file without asking for confirmation (subject to the nnn option above), or ^C to stop searching and replacing. You can also hit B or Backspace to back up to the previously found text (if it had been re‐ placed, the replacement is undone). • a The search covers all loaded buffers. So to replace all instances of "foo" with "bar" in all .c files in the current directory: joe *.c ^K F foo <Enter> ra <Enter> bar <Enter> • e The search covers all files in the grep or make error list. You can use a UNIX command to generate a list of files and search and replace through the list. So to replace all instances of "foo" with "bar" in all .c files which begin with f. You can also use "ls" and "find" in‐ stead of grep to create the file list. Esc G grep -n foo f*.c <Enter> ^K F foo <Enter> re <Enter> bar <Enter> • x JOE will use the standard syntax for regular expressions if this option is given. In the standard syntax, these characters have their special meanings directly, and do not have to be escaped with backslash: ., *, +, ?, {, }, (, ), |, ^, $ and [. • y JOE will use the JOE syntax for regular expressions instead of the standard syntax. This overrides the "-regex" option. • v JOE will send debug information about the regular expression to the startup log. The log can be viewed with the showlog command. You can hit ^L to repeat the previous search. You can hit ^K H at the search and replace options prompt to bring up a list of all search and replace options. Regular Expressions A number of special character sequences may be entered as search text: • \* This finds zero or more of the item to the left. For example, if you give AB\*C as the search text, JOE will try to find an A followed by any number of Bs, and then a C. • \+ This finds one or more of the item to the left. For example, if you give AB\+C as the search text, JOE will try to find an A followed by one or more Bs, and then a C. • \? This indicates that the item to the left is optional. For example, if you give AB\?C as the search text, JOE will find AC or ABC. • \{min,max} This indicates that JOE should try to find a string with a specific number of occurrences of the item to the left. For example, AX\{2,5}B will match these strings: AXXB, AXXXB, AXXXXB, and AXXXXXB. Min can be left out to indicate 0 occurrences. Max (and the comma) can be left out to indicate any number of occurrences. • \. This finds exactly one character. For example, if you give A\.B as the search text, JOE will find AXB, but not AB or AXXB. • \! This works like ., but matches a balanced C-language expression. For example, if you search for malloc(\!\*), then JOE will find all function calls to malloc, even if there was a ) within the parenthesis. • \| This finds the item on the left or the item on the right. For example, if you give A\|B as the search text, JOE will try to find either an A or a B. • \( \) Use these to group characters together. For example, if you search for \(foo\)\+, then JOE will find strings like "foo", and "foofoofoo". • ^ \$ These match the beginnings and endings of lines. For example, if you give ^test\$, then JOE with find test on a line by itself. • \\\ These match the beginnings and endings of words. For example, if you give \is\\, then JOE will find the word "is" but will not find the "is" in "this". • \[...] This matches any single character which appears within the brackets. For example, if \[Tt]his is entered as the search string, then JOE finds both This and this. Ranges of characters can be entered within the brackets. For example, \[A-Z] finds any uppercase letter. If the first character given in the brackets is ^, then JOE tries to find any character not given in the the brackets. To include - itself, include it as the last or first character (possibly after ^). • \\ Matches a single \. • \n This finds the special end-of-line or line-break character. A number of special character sequences may also be given in the replacement string: • \& This gets replaced by the text which matched the search string. For example, if the search string was \\*\\, which matches words, and you give "\&", then JOE will put quote marks around words. • \1 - \9 These get replaced with the text which matched the Nth grouping; the text within the Nth set of \( \). • \l, \u Convert the next character of the replacement text to lowercase or uppercase. • \L, \U Convert all following replacement text to lowercase or uppercase. Conversion stops when \E is encountered. • \\ Use this if you need to put a \ in the replacement string. • \n Use this if you need to put a line-break in the replacement string. Some examples: Suppose you have a list of addresses, each on a separate line, which starts with "Address:" and has each element separated by commas. Like so: Address: S. Holmes, 221b Baker St., London, England If you wanted to rearrange the list, to get the country first, then the city, then the per‐ son´s name, and then the address, you could do this: Type ^K F to start the search, and type: Address:\(\.\*\),\(\.\*\),\(\.\*\),\(\.\*\)\$ to match "Address:", the four comma-separated elements, and then the end of the line. When asked for options, you would type r to replace the string, and then type: Address:\4,\3,\1,\2 To shuffle the information the way you want it. After hitting return, the search would begin, and the sample line would be changed to: Address: England, London, S. Holmes, 221b Baker St. Escape sequences JOE understands the following escape sequences withing search and replacement strings: • \x{10ffff} This matches a specific Unicode code point given in hexadecimal. • \xFF This matches a specific character specified in hexadecimal. • \377 This matches a specific character specified in octal. • \p{Ll} This matches any character in the named Unicode category or block. The block names, such as "Latin-1 Supplement" or "Arabic" can be found here: Unicode Blocks ftp://ftp.unicode.org/Public/8.0.0/ucd/Blocks.txt The category names such as "Ll" can be found here: Unicode Categories ftp://ftp.unicode.org/Public/5.1.0/ucd/UCD.html#General_Category_Values Note that a single letter matches all of the category names which start with that letter. For example, \p{N} (any number) include \p{Nd} (decimal digit), \p{Nl} (letter number) and \p{No} (other number). • \d This matches any Unicode digit. This is the same as \p{Nd}. • \D This matches anything except for a Unicode digit. This is the same as \[^\p{Nd}]. • \w This matches any word character. This is the same as \[^\p{C}\p{P}\p{Z}]. • \W This matches anything except for a word character. This is the same as \[\p{C}\p{P}\p{Z}]. • \s This matches any space character. This is the same as \[\t\r\f\n\p{Z}]. • \S This matches anything except for a spacing character. This is the same as \[^\t\r\f\n\p{Z}]. • \i This matches an identifier start character. This is the same as \[\p{L}\p{Pc}\p{Nl}]. • \I This matches anything except for an identifier start character. This is the same as \[^\p{L}\p{Pc}\p{Nl}]. • \c This matches an identifier continuation character. This is the same as \[\i\p{Mn}\p{Mc}\p{Nd}\x{200c}\x{200d}]. • \C This matches anything except for an identifier continuation character. This is the same as \[^\i\p{Mn}\p{Mc}\p{Nd}\x{200c}\x{200d}]. • \t Tab • \n Newline • \r Carriage return • \b Backspace • \a Alert • \f Formfeed • \e Escape • \\ Backslash Incremental search Use Esc S to start an increment search forwards, or Esc R to start an incremental search backwards. As you type the search string, the cursor will jump to the first text that matches the regular expression you have entered so far. Hit Esc S or Esc R again to find the next occurrence of the text or to switch the direction of the search. ^S, ^\ and ^L have the same effect as Esc S. ^R has the same effect as Esc R. These keys are to support JMACS. Hit Backspace to undo the last incremental search action. The last action could be a repeat of a previous search or the entering of a new character. Use ^Q to insert control characters into the search text. Previously, ` could also be used for this. Hit any other key to exit the increment search. Goto matching delimiter Hit ^G to jump between matching delimiters. This works on both character delimiters (like ´(´ and ´)´) and word delimiters for languages like Pascal and Verilog which use "begin" and "end" to delimit blocks. It also works for matching start and end tags in XML. If a word is not known, ^G starts a search with the word moved into the search prompt. For ^G to work on word delimiters, the cursor must be positioned on the first letter of the word. So in XML, if the cursor is on the < in <foo>, it will jump to the >. But if it is one the ´f´, it will jump to the matching </foo>. Likewise, in C, ^G will jump between #if, #else and #endif, but you need to position the cursor on the letter, not the ´#´. ^G is smart enough to skip delimiters found in quoted or commented-out matter. You need to tell JOE how your language indicates this: see the ftyperc file for examples of how this is done. The are a number of options which control the behavior of ^G. These options control which kinds of comments ^G can skip over: • c_comment • cpp_comment • pount_comment • semi_comment • vhdl_comment These options determine which kinds of strings ^G can skip over: • single_quoted • double_quoted This option allows an annotated syntax file to determine which text can be counted as com‐ ments or strings which can be skipped over by ^G: • highlighter_context This option enables the use of syntax files to identify comments and strings which should be skipped over during ^G matching. The syntax file states should be annotated with the string and comment keywords for this to work. • text_delimiters This option provides a list of word delimiters to match. For example, "be‐ gin=end:if=elif=else=endif" means that ^G will jump between the matching if, elif, else and endif. It will also jump between begin and end. ^G has a built-in table for matching character delimiters- it knows that ( goes with ). ^G has a built-in parser to handle start/end tag matching for XML. Regions If you want to move, copy, save or delete a specific section of text, you can do it with highlighted blocks. First, move the cursor to the start of the section of text you want to work on, and press ^K B. Then move the cursor to the character just after the end of the text you want to affect and press ^K K. The text between the ^K B and ^K K should become high‐ lighted. Now you can move your cursor to someplace else in your document and press ^K M to move the highlighted text there. You can press ^K C to make a copy of the highlighted text and insert it to where the cursor is positioned. ^K Y to deletes the highlighted text. ^K W, writes the highlighted text to a file. A very useful command is ^K /, which filters a block of text through a UNIX command. For ex‐ ample, if you select a list of words with ^K B and ^K K, and then type ^K / sort, the list of words will be sorted. Another useful UNIX command for ^K /, is tr. If you type ^K / tr a-z A-Z, then all of the letters in the highlighted block will be converted to uppercase. How do I deselect a highlighted region? After you are finished with some region operations, you can just leave the highlighting on if you don´t mind it (but don´t accidentally hit ^K Y). If it really bothers you, however, just hit ^K B ^K K, to turn the highlighting off. Beginning with JOE 4.2, you can hit ^C to cancel the region selection. New ways of selecting regions The classic way is to hit ^K B at the beginning and ^K K at the end. These set pointers called markb and markk. Once these are set you can jump to markb with Esc B and jump to markk with Esc K. New way: hit Ctrl-Right Arrow to start selecting rightward. Each time you hit Ctrl-Right Ar‐‐ row, the block is extended one more to the right. This uses a simple macro: "begin_mark‐ ing,rtarw,toggle_marking". Unfortunately, there is no standard way to get the keysequence given by the terminal emulator when you hit Ctrl-Right Arrow. Instead you have to determine this sequence yourself and enter it directly in the joerc file. Some examples are given for Xterm and gnome-terminal. Hit ^Q Ctrl-Right Arrow within JOE to have the sequence shown on your screen. Note that Putty uses Esc Esc [ C which will not appear with ^Q Right Arrow (also Esc Esc is the set bookmark com‐ mand, so you need to unbind it to do this in Putty). Also you can hit Ctrl-Delete to cut and Ctrl-Insert to paste if the sequence for these keys are known. The mouse can also be used to select text if mouse support is enabled in JOE. Indenting program blocks Auto-indent mode is toggled with the ^T I command. The joerc file is normally set up so that files with names ending with .p, .c or .h have auto-indent mode enabled. When auto-indent mode is enabled and you hit Enter, the cursor will be placed in the same column that the first non-whitespace character was on in the original line. You can use the ^K , and ^K . commands to shift a block of text to the left or right. If no highlighting is set when you give these commands, the program block (as indicated by indenta‐ tion) that the cursor is located in will be selected, and will be moved by subsequent ^K , and ^K . commands. The number of columns these commands shift by and the character used for shifting can be set through the istep and indentc options. These options are available in the ^T menu. Also, ^T = can be used to quickly select from a number of common values for indentation step and charac‐ ter. JOE has a number of additional options related to indenting programs: • smartbacks Enable smart backspace and tab. When this mode is set Backspace and Tab indent or unin‐ dent based on the values of the istep and indentc options. • smarthome The Home and ^A keys first move the cursor to the beginning of the line, then if hit again, to the first non-blank character. • indentfirst Smart home goes to first non-blank character first, instead of going to the beginning of the line first. • purify Fix indentation if necessary before shifting or smart backspace. For example, if indenta‐ tion uses a mix of tabs and spaces, and indentc is space, then indentation will be con‐ verted to all spaces before the shifting operation. • guess_indent When set, JOE tries to guess the indentation character and indentation step based on the contents of the file. The algorithm is to find the greatest common factor of the three most common indentations found in the file. Rectangle mode Type ^T X to have ^K B and ^K K select rectangular blocks instead of stream-of-text blocks. This is also known as columnar mode. This mode is useful for moving, copying, deleting or saving columns of text. You can also filter columns of text with the ^K / command- if you want to sort a column, for example. The insert file command, ^K R is also affected. When rectangle mode is selected, overtype mode is also useful (^T T). When overtype mode is selected, rectangles will replace existing text instead of getting inserted before it. Also the delete block command (^K Y) will clear the selected rectangle with Spaces and Tabs in‐ stead of deleting it. Overtype mode is especially useful for the filter block command (^K /), since it will maintain the original width of the selected column. Picture mode Use ^T P to enter or exit picture mode. Picture mode helps with ASCII drawings. Picture mode controls how JOE handles the case where the cursor is past the ends of lines. This happens when you use the up or down arrow keys to move the cursor from the end of a long line to a short line. If you attempt to type a character in this case: If picture mode is off, the cursor will jump to the end of the line and insert it there. If picture mode is on, the line is filled with spaces so that the character can be inserted at the cursor position. Windows You can edit more than one file at the same time or edit two or more different places of the same file. To do this, hit ^K O, to split the screen into two windows. Use ^K P or ^K N to move the cursor into the top window or the lower window. Use ^K E to edit a new file in one of the windows. A window will go away when you save the file with ^K X or abort the file with ^C. If you abort a file which exists in two windows, one of the window goes away, not the file. You can hit ^K O within a window to create even more windows. If you have too many windows on the screen, but you don´t want to eliminate them, you can hit ^K I. This will show only the window the cursor is in, or if there was only one window on the screen to begin with, try to fit all hidden windows on the screen. If there are more windows than can fit on the screen, you can hit ^K N on the bottom-most window or ^K P on the top-most window to get to them. If you gave more than one file name to JOE on the command line, each file will be placed in a different window. You can change the height of the windows with the ^K G and ^K T commands. Windowing system model JOE has an unusual model for its windowing system. Basically you have a ring of windows, but only a section of this ring may fit on the screen. The windows not on the screen still exist, they are just scrolled off. When you hit ^K N on the bottom window of the screen, it scrolls further windows from the ring onto the screen, possibly letting the top window scroll out of view. Native JOE tries to keep each loaded buffer in a window, so users can find all of the buffers by scrolling through the windows. The explode command (^K I) either expands all windows to the size of the screen so that only one window can fit on the screen, or shrinks them all as much as possible to fit many on the screen. On the other hand, JOE supports "orphan" buffers- files loaded into the editor, but which are not in a window. ^C normally closes a window and discards the buffer that was in it. If you hit ^C on the last remaining window, it will normally exit the editor. However, if there are orphan buffers, ^C will instead load them into this final window to give you a chance to ex‐ plicitly discard them. If the orphan option is given on the command line, as in joe -orphan *.c, then JOE only loads the first file into a window and leaves all the rest as orphans. orphan also controls whether the edit command ^K E creates a new window for a newly loaded file, or reuses the current window (orphaning its previous occupant). The bufed command prompts for a name of a buffer to switch into a window. Its completion list will show all buffers, including orphans and buffers which appear in other windows. Esc V and Esc U (nbuf and pbuf commands) allow you to cycle through all buffers within a single window. Windows maintain a stack of occupants to support the pop-up shell window feature. When a pop-up window is dismissed, the previous buffer is returned to the window. Scratch buffers Scratch buffers are buffers which JOE does not worry about trying to preserve. JOE will not ask to save modified scratch buffers. Pop-up shell windows, the startup log and compile and grep message windows are scratch buffers. You can create your own scratch buffer with the scratch command. The following commands load scratch buffers: • showlog Show startup log • mwind Show message window (compile / grep messages from Esc C and Esc G commands). Keyboard macros Macros allow you to record a series of keystrokes and replay them with the press of two keys. This is useful to automate repetitive tasks. To start a macro recording, hit ^K [ followed by a number from 0 to 9. The status line will display (Macro n recording...). Now, type in the series of keystrokes that you want to be able to repeat. The commands you type will have their usual effects. Hit ^K ] to stop recording the macro. Hit ^K followed by the number you recorded the macro in to execute one iteration of the key-strokes. For example, if you want to put "**" in front of a number of lines, you can type: ^K [ 0 ^A **down arrow\ ^K ] Which starts the macro recording, moves the cursor to the beginning of the line, inserts "**", moves the cursor down one line, and then ends the recording. Since we included the key-strokes needed to position the cursor on the next line, we can repeatedly use this macro without having to move the cursor ourselves, something you should always keep in mind when recording a macro. Keyboard macro subroutines If you find that the macro you are recording itself has a repeated set of key-strokes in it, you can record a macro within the macro, as long as you use a different macro number. Also you can execute previously recorded macros from within new macros. Query suspend If your macro includes a prompt for user input, and you want the user to fill in the prompt every time the macro is executed, hit ^K ? at the point in the macro recording where the user action is required. Keyboard input will not be recorded at this point. When the user com‐ pletes the prompt, macro recording will continue. When the macro is executed, the macro player will pause at the point where ^K ? was entered to allow user input. When the user completes the prompt, the player continues with the rest of the macro. Repeat You can use the repeat command, ^K \, to repeat a macro, or any other edit command or even a normal character, a specified number of times. Hit ^K \, type in the number of times you want the command repeated and press Enter. The next edit command you now give will be repeated that many times. For example, to delete the next 20 lines of text, type: ^K \ 20return^Y Macros and commands A macro is a comma separated list of commands. When the macro is executed, each command is executed until either the end of the list is reached, or one of the commands fails (non-zero return value from the command). Failed commands beep if you have beeps enabled (^T B). Hit Esc D to insert the current set of keyboard macros as text into the current buffer. For example, the "**" insert macro above looks like this: home,"**",dnarw ^K 0 Macro 0 You could insert this into your .joerc file and change the key sequence (the K 0) to some‐ thing more permanent. Define your own You can bind macros to key sequences or define your own named macros in the joerc file. For example, this will define a macro called foo: :def foo eof,bol foo will position the cursor at the beginning of the last line of the file. eof jumps to the end of the file. bol jumps to the beginning of a line. Once a macro has been named this way it will show up in the completion list of the Esc X command prompt. Command prompt You can execute a macro directly by typing it into the command prompt. Hit Esc X to bring up the command prompt. Hit Tab at this prompt for a completion list of all available commands. Here is a complete list of commands. Macro don´´t stop modifier Sometimes, you expect commands to sometimes fail, but want the rest of the commands in the list to be executed anyway. To mark a command which is allowed to fail, postfix it with ´!´. For example, here a macro which hits down page in the window above: prevw,pgdn!,nextw If prevw fails, the macro is aborted as usual. Even if pgdn fails (already at end of buffer), nextw will be executed so that the cursor is returned to the original window. Macro repeat argument modifiers Repeat arguments can be specified with ^K \. When a command is executed with a repeat argu‐ ment, it is repeatedly executed the specified number of times. If the repeat argument is neg‐ ative, an opposite command (if one exists) is executed instead. For example, if you repeat "rtarw" -3 times, "ltarw" will be repeated 3 times. If a negative argument is given for a command which does not have an opposite, the repeat argument is ignored. Normally, if a repeat argument is specified for a macro, the macro is simply repeated the given number of times. If a negative argument is given, the argument is ignored. Sometimes you want to allow negative arguments for macros and have their behavior modified. To do this, postfix each command within the macro which should be switched to its opposite for negative arguments with ´-´. For example, here is the page down other window macro: prevw,pgdn-!,nextw Now if you execute this with an argument of -2, it will be repeated twice, but pgup will be executed instead of pgdn. (note that several postfix modifiers can be placed after each com‐ mand). Sometimes when a repeat argument is given to macro, you want only one of the commands in the list to be repeated, not the entire macro. This can be indicated as follows: prevw,pgdn#!,nextw If this is executed with an argument of 2, prevw is executed once, pgdn is executed twice, and nextw is executed once. Finally, even more complex semantics can be expressed with the "if" command: if~,"arg<0",then, ltarw, else, rtarw, endif When the macro is executed, the "arg" math variable is set to the given repeat argument. The "argset" variable is set to true if the user set an argument, even if it´s 1. If no argument was given, argset is false. If any command in the list is postfixed with ~ (if above), the macro is not repeated, even if there is an argument. ´arg´ is still set to the given repeat count, however. ´´psh´´/´´query´´ interaction The ´psh´ command saves the ^K B and ^K K positions on a stack. When the macro completes, (or when the ´pop´ command is called) the positions are restored. The ´query´ command suspends macro execution until the current dialog is complete. It also suspends the automatic ´pop´ which happens at the end of a macro- so if the macro ends in a dialog you often want to call ´query´ to prevent the ^K B ^K K positions from being restored too early. Tags search If you are editing a large C program with many source files, you can use the ctags program to generate a tags file. This file contains a list of program symbols and the files and posi‐ tions where the symbols are defined. First, create the tags file with the "ctags" program. For example: ctags *.c *.h This will create a file called "tags" in the current directory. JOE looks for the "tags" file in the current directory. If there is none, it will try to open the file specified by the TAGS environment variable. Paths in the tags file are always relative to location of the tags file itself. The tags file contains a list of identifier definition locations in one of these formats: identifier filename /search-expression/[;comments] identifier filename ?search-expression?[;comments] identifier filename line-number[;comments] Some versions of ctags include class-names in the identifiers: class::member In this case, JOE will match on any of these strings: member ::member class::member Some versions of ctags include a filename in the identifier: filename:identifier In this case JOE will only find the identifier if the buffer name matches the filename. The search-expression is a vi regular expression, but JOE only supports the following special characters: ^ at the beginning means expression starts at beginning of line $ at the end means expression ends at end of line \x quote x (suppress meaning of /, ?, ^ or $) Type ^K ; to bring up a tags search prompt. If the cursor had been on an identifier, the prompt is pre-loaded with it. Tab completion works in this prompt (it uses the tags file to find completions). When you hit Enter, the tags search commences: If there is one and only one match, JOE will jump directly to the definition. If there are multiple matches, then the behavior is controlled by the notagsmenu option. If notagsmenu is enabled JOE jumps to the first definition. If you hit ^K ; again before hitting any other keys, JOE jumps to the next definition, and so on. The "tagjump" command also per‐ forms this function. If notagsmenu is disabled, JOE brings up a menu of all the matches. You select the one you want and JOE jumps to it. If you hit ^K ; again before hitting any other keys, the same menu re-appears with the cursor left in the original location. You can hit ^K - to move the cursor back to the original location before the tags search (of‐ ten ^C will work as well). Since ^K ; loads the definition file into the current window, you probably want to split the window first with ^K O, to have both the original file and the definition file loaded. Calculator JOE has a built-in calculator which can be invoked with Esc M. Math functions sin, cos, tan, exp, sqrt, cbrt, ln, log, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, int, floor, ceil, abs, erf, erfc, j0, j1, y0, y1 Variables • e Set to ´e´ • pi Set to ´pi´ • top Set to line number of top window line • lines Set to number of lines in file • line Set to current line number • col Set to current column number • byte Set to current byte number • size Set to buffer size • height Set to window height • width Set to window width • char Set to ASCII val of character under cursor • markv True if there is a valid block set (^KB ... ^KK) • rdonly True if file is read-only • arg Current repeat argument • argset True if a repeat argument was given • is_shell True if executed in an active shell window • no_windows No. buffer windows on the screen • ans Result of previous expression Commands • hex Hex display mode • dec Decimal display mode • ins Insert ´ans´ into buffer • sum Sum of numbers in block • cnt Count numbers in block • avg Average value of numbers in block • dev Standard deviation of numbers in block • eval Evaluate math expressions in block (or whole file if no block set). • joe(...) Execute a JOE macro (argument in same format as joerc file macros). Return value of JOE macro is returned (for macro success, return true (non-zero)). For example: joe(sys,"[ 1 == 1 ]",rtn) ([ 1 == 1 ]) is a shell command. "[" is a synonym for the "test" UNIX command. Returns true. Remember: argument for JOE macro command "if" is a math expression. So for example, the macro: if,"joe(sys,\"[ 1 == 1 ]\",rtn)",then,"TRUE",endif Types TRUE into the buffer. Operators: • !x Logical not of x. • x Raise x to power of y. • a*b Multiply. • a/b Divide. • a%b Modulus. • a+b Add. • a-b Subtract. • a<b True if a is less than b. • a<=b True if a is less than or equal to b. • a>b True if a is greater than b. • a>=b True if a is greater than or equal to b. • a==b True if a equals b. • a!=b True if a does not equal b. • a&&b True if both a and b are true. • a||b True if ether a or b are true. • a?b:c If a is true return b, otherwise return c. • a=b Assign b to a. • a:b Execute a, then execute b. &&, || and ? : work as in C and sh as far as side effects: if the left side of && is false, the right side is not evaluated. is expression separator. Shell windows Hit ^K ´´ to run a command shell in one of JOE´s windows. When the cursor is at the end of a shell window (use ^K V if it´s not), whatever you type is passed to the shell instead of the buffer. Any output from the shell or from commands executed in the shell is appended to the shell window (the cursor will follow this output if it´s at the end of the shell window). This command is useful for recording the results of shell commands- for example the output of make, the result of grepping a set of files for a string, or directory listings from FTP ses‐ sions. Besides typeable characters, the keys ^C, Backspace, Del, Return and ^D are passed to the shell. Type the shell exit command to stop recording shell output. If you press ^C in a shell window, when the cursor is not at the end of the window, the shell is killed. If you use Bash, you can hit: ^Q Up Arrow and ^Q Down Arrow to scroll through Bash´s history buffer. Other keys work as well: try ^Q ^A to go to beginning of line or ^Q ^E to go to end of line. Unfortunately JOE only emulates a dumb terminal, so you have to use a lot of imagi‐ nation to do any editing beyond hitting backspace. In general, any character quoted with ^Q is sent to the shell. Also sent to the shell: Tab, Backspace, Enter, ^C and ^D. Pop-up shell windows Hit F1 - F4 to open and switch between shell windows. Pop-up shell windows use a full terminal emulator so that when you type "man ls" it´s format‐ ted correctly (it works well enough so that some interactive programs can be used). Even so, the shell window is still an edit buffer. The old shell window (with no terminal emulation) still exists: use ^K ´´ to invoke it as usual. This is useful to see control sequences emitted by a program. More of the keys get passed to the running program in pop-up shell windows compared with the older one. There is a :vtshell section of the joerc file to control which ones. In particular arrow keys and Ctrl-C are passed to the program. It means you can easily step through bash history with the arrow keys, or abort programs the normal way with Ctrl-C. On the other hand, loss of Ctrl-C means it´s less obvious how to close the window. One way is to move the cursor off of the shell data entry point (with Ctrl-P), and then hit Ctrl-C. An‐ other is to hit ^K Q. Finally, you can type ´pop´ at the command prompt. If you need to pass a key to the shell that JOE normally uses, quote it. For example, if you invoke "emacs -nw" in the shell window, you can exit it with: ^Q ^X ^C To quickly position the cursor back to the point where data is entered into the shell, hit ^K V. When you open a shell window, a JOE-specific startup-script is sourced. It´s located in /etc/joe/shell.sh (also /etc/joe/shell.csh). It contains some aliases which allow you to con‐ trol JOE with fake shell commands. I have these commands so far: • clear erase shell window (delete buffer contents) • joe file edit a file in JOE • math 1+2 evaluate equation using JOE´s calculator • cd xyz change directory, keep JOE up to date • markb same as ^KB • markk same as ^KK • mark command execute shell command, mark it´s output • parse command execute shell command, parse it´s output for file names and line numbers (for find or grep) • parser comman execute shell command, parse it´s output for errors (for gcc) • release release parsed errors • pop dismiss shell window (same as ^K Q) These work by emitting an escape sequence recognized by the terminal emulator: Esc { joe_macro }. When this is received, the macro is executed. For security, only macros defined in the joerc file which begin with "shell_" can be executed this way. Use cases Pop-up shell windows have a number of nice use cases: • Use it to browse manual pages Hit F1 and type "man fopen". Use ´b´ (´u´) and space to control more (or less) while viewing the manual. You can leave the manual on the screen in one window while editing in another window. • Use it to switch directories Hit F1 and navigate to the directory while using cd. Once you are in the right place, hit ^K E to load a file (or type "edit file" from the shell). • Use it in conjunction with the error parser to find files Hit F1 and navigate to a directory. Use grep or find (or both) to generate a list of files): parse grep -n FIXME *.c Or: markb; find . | xargs grep -n FIXME; markk; parse (Note that you can´t say this: parse find . | xargs grep -n FIXME ...the issue is that only the words to the left of the pipe symbol are passed as arguments to the parse command). Now use ^P to position the cursor on one of the lines of the list. Hit Esc Space to have JOE edit the file and jump to the specified line (also you can use Esc - and Esc = to step through the list). • Use it in conjunction with search and replace to edit many files Once JOE has a list of files (from above), use search and replace with the ´e´ option to visit all of them: ^K F Find: <text> Options: re Replace: <replacement text> • Build your project Easily capture errors from a build with: parserr make Hit Esc = and Esc - to step through the errors. How it works.. • There is a new mode "ansi". (Esc X mode ansi). When this mode is enabled, the screen up‐ dater hides escape sequences which are in the buffer. Otherwise you get a big mess from the sequences surrounding colored output from ´ls´. • There is a new built-in syntax: "ansi". (^T Y ansi). This syntax parses the ANSI color control sequences so that text gets colored. • There is a terminal emulator to interpret control sequences from the shell program. It emulates a terminal by modifying the contents of an edit buffer. • When the edit window is resized we tell the shell by issuing the TIOCSSIZE or TIOCSWINSZ ioctl. This way, the program running in the shell knows the window size. Compiler and grep/find parsers JOE has two parsers which can be used to generate the error list (list of file names / line numbers). The "parserr" command parses the entire buffer, or if the block is set, just the highighted block for compiler error messages. The messages should be in this format: <junk> file.name <junk> line-number <junk> : <junk> The file name needs to be made of numbers, letters, ´/´, ´.´ and ´-´. It must have at leat one ´.´ in it. There needs to be a colon somewhere after the line number. Lines not in this format are ignored. The "gparse´ command parses the entire buffer, or if the block is set, just the highlighted block for a list of filenames or filenames with line numbers from "grep -n", "find" and simi‐ lar programs. filename filename:<junk> filename:line-number:<junk> Once JOE has the error list, there are a number of things you can do with it: • Visit the files/locations in the list with Esc - and Esc = • Search and replace across all files in the list by using the ´e´ search and replace op‐ tion. • Clear the list by using the "release" command. Also, you can use Esc Space (´jump´ command) to parse the line the cursor is on and jump to the parsed filename and line number. ´jump´ uses the grep/find parser unless ´parserr´ had been previously issued in the buffer. Grep-find Hit Esc G to bring up the prompt. Enter a command which results in file names with line num‐ bers, for example: ´grep -n fred *.c´. This will list all instances of ´fred´ in the *.c files. You need the ´-n´ to get the line numbers. Now you can hit Esc Space on one of the lines to jump to the selected file. Also, you can use Esc = and Esc - to step through each line. Compile Hit Esc C to save all modified files and then bring up the compile prompt. Enter the command you want to use for the compiler (typically "make -w"). The compiler will run in a shell win‐ dow. When it´s complete, the results are parsed. The ´-w´ flag should be given to "make" so that it prints messages whenever it changes direc‐ tories. The message are in this format: make[1]: Entering directory `/home/jhallen/joe-editor-mercurial/joe´ If there are any errors or warnings from the compiler you can hit Esc Space on one of the lines to jump to the selected file. Also, you can use Esc = and Esc - to step through each line. Syntax highlighting To enable highlight use ^T H. To select the syntax, use ^T Y. You can hit Tab Tab at the prompt for a completion list. JOE tries to determine the syntax to use based on the name and contents of the file. The con‐ figuration file /etc/joe/ftyperc contains the definitions. Each syntax is defined by a file located /usr/share/joe/syntax/. How JOE syntax highlighting works from c.jsf http://joe-editor.hg.sourceforge.net/hgweb/joe-editor/joe-editor/file/tip/syn‐ tax/c.jsf.in, slightly modified A deterministic state machine that performs lexical analysis of the target language is pro‐ vided in a syntax file. (This is the "assembly language" of syntax highlighting. A separate program could in principal be used to convert a regular expression NFA syntax into this for‐ mat). Each state begins with: :<name> <color-name> <context> name\ is the state´s name. color-name\ is the color used for characters eaten by the state (really a symbol for a user definable color). context\ tells JOE if the current character is part of a comment or a string. This allows JOE to skip over comments and strings when matching characters such as parentheses. To use this feature, the highlighter_context option must be applied to the files highlighted by the cor‐ responding syntax. To apply the option, add it to ftyperc for those file entries. The valid contexts are: • comment This character is part of a comment. Example: /* comment */ • string This character is part of a string. Examples: "string" ´c´ ´string´ The comment and string delimiters themselves should be marked with the appropriate context. The context is considered to be part of the color, so the recolor=-N and recolormark options apply the context to previous characters. The first state defined is the initial state. Within a state, define transitions (jumps) to other states. Each jump has the form: <character-list> <target-state-name> [<option>s] There are three ways to specify character-list\s, either * for any character not otherwise specified, % or & to match the character in the delimiter match buffer (% matches the saved character exactly, while & matches the opposite character, for example ( will match ) when & is used) or a literal list of characters within quotes (ranges and escape sequences allowed: see Escape Sequences). When the next character matches any in the list, a jump to the tar‐ get-state is taken and the character is eaten (we advance to the next character of the file to be colored). The * transition should be the first transition specified in the state. There are several options: • noeat - Do not eat the character, instead feed it to the next state (this tends to make the states smaller, but be careful: you can make infinite loops). ´noeat´ implies ´re‐ color=-1´. • recolor=-N - Recolor the past N characters with the color of the target-state. For exam‐ ple once /* is recognized as the start of C comment, you want to color the /* with the C comment color with recolor=-2. • mark - Mark beginning of a region with current position. • markend - Mark end of region. • recolormark - Recolor all of the characters in the marked region with the color of the target-state. If markend is not given, all of the characters up to the current position are recolored. Note that the marked region can not cross line boundaries and must be on the same line as recolormark. • buffer - Start copying characters to a string buffer, beginning with this one (it´s OK to not terminate buffering with a matching ´strings´, ´istrings´ or ´hold´ option- the buf‐ fer is limited to leading 23 characters). • save_c - Save character in delimiter match buffer. • save_s - Copy string buffer to delimiter match buffer. • strings - A list of strings follows. If the buffer matches any of the given strings, a jump to the target-state in the string list is taken instead of the normal jump. • istrings - Same as strings, but case is ignored. Note: strings and istrings should be the last option on the line. They cause any options which follow them to be ignored. • hold - Stop buffering string- a future ´strings´ or ´istrings´ will look at contents of buffer at this point. Useful for distinguishing commands and function calls in some lan‐ guages ´write 7´ is a command ´write (´ is a function call- hold lets us stop at the space and delay the string lookup until the ( or 7. The format of the string list is: "string" <target-state> [<options>s] "string" <target-state> [<options>s] "&" <target-state> [<options>s] # matches contents of delimiter match buffer done (all of the options above are allowed except "strings", "istrings" and "noeat". noeat is al‐ ways implied after a matched string). Weirdness: only states have colors, not transitions. This means that you sometimes have to make dummy states with * <next-state> noeat just to get a color specification. Delimiter match buffer is for perl and shell: a regex in perl can be s<..>(...) and in shell you can say: <<EOS ....... EOS. The idea is that you capture the first delimiter into the match buffer (the < or first "EOS") and then match it to the second one with "&" in a string or character list. Subroutines Highlighter state machines can now make subroutine calls. This works by template instantia‐ tion: the called state machine is included in your current state machine, but is modified so that the return address points to the called. There is still no run-time stack (the state is represented as a single integer plus the saved delimiter string). Recursion is allowed, but is self limited to 5 levels. Note: this recursion limit is obsolete. Subroutines now do use a stack so the call-depth is limitless. To call a subroutine, use the ´call´ option: "\"" fred call=string(dquote) The subroutine called ´string´ is called and the jump to ´fred´ is ignored. The ´dquote´ op‐ tion is passed to the subroutine. If you use recolor along with call, the color used is that of the first state of the subrou‐ tine. The subroutine itself returns to the caller like this: "\"" whatever return If we´re in a subroutine, it returns to the target state of the call ("fred" in the above ex‐ ample). If we´re not in a subroutine, it jumps to "whatever". If you use recolor along with return, the color used is from the returned state ("fred" in the example above). There are several ways of delimiting subroutines which show up in how it is called. Here are the options: • call=string() - A file called string.jsf is the subroutine. The entire file is the sub‐ routine. The starting point is the first state in the file. • call=library.string() - A file called library.jsf has the subroutine. The subroutine within the file is called string. • call=.string() - There is a subroutine called string in the current file. When a subroutine is within a file, but is not the whole file, it is delimited as follows: .subr string Option flags can be passed to subroutines which control preprocessor-like directives. For ex‐ ample: .ifdef dquote "\"" idle return "´" idle return .else is also available. .ifdefs can be nested. The joerc file ^T options, the help screens and the key-sequence to editor command bindings are all defined in JOE´s initialization file. If you make a copy of this file (which normally resides in /etc/joe/joerc) to $HOME/.joerc, you can customize these setting to your liking. The syntax of the initialization file should be fairly obvious and there are further instructions in it. The joerc file has a directive to include another file (:include). This facility is used to include a file called ftyperc (usually located in /etc/joe/ftyperc). ftyperc has the file type table which determines which local options (including syntax for the highlighter) are applied to each file type. Initialization file loading sequence If the path for an initialization file begins with ´/´ (you can specify this with the include directive), JOE only tries to load it from the absolute path. Otherwise, JOE tries to load initialization files (the joerc file and any files included in it, typically ftyperc) from three places: • "$HOME/.joerc" - The user´s personalized joerc file. • "/etc/joe/joerc" - The system´s joerc file. The exact path is fixed during the build, and is determined by the --sysconfdir configure script option. • "*joerc" - Built-in file This means JOE searches for the file in a table of files linked in with the JOE binary (they are in the builtins.c file). A built-in joerc file is pro‐ vided so that the editor will run in cases where system´s joerc is inaccessible. If the system´s joerc file is newer than the user´s joerc file, JOE will print a warning in the startup log. Previous versions of JOE would prompt the user for this case- the idea was that JOE may be unusable with an out of date initialization file. joerc file sections The joerc file is broken up into a number of sections: • Global options Options which are not file specific, like noxon. • File name and content dependent options Options which depend on the file type, such as autoindent. The ftyperc file is included in this section. • ^T menu system definition Use :defmenu to define a named menu of macros. The menu command brings up a specific named menu. ^T is a macro which brings up the root menu: menu,"root",rtn. • Help screen contents Each help screen is named. The name is used to implement context de‐ pendent help. • Key bindings Key binding tables are defined. You can define as many as you like (you can switch to a specific one with the keymap command), but the following must be provided: • main Editing windows • prompt Prompt windows • query Single-character query prompts • querya Single-character query for quote • querysr Single-character query for search and replace • shell Shell windows • vtshell Terminal emulator shell windows Key binding tables can inherit bindings from already defined tables. This allows you to group common key bindings into a single table which is inherited by the others. Mode command Many options can be controlled with the ^T menu. This menu is defined in the joerc file. Each option in the ^T menu just executes a macro. Usually the macro is the mode command. You can execute the mode command directly with: Esc X mode <enter> Hit Tab Tab for a completion list of all options. Menu command This command calls up a named menu of macros which was defined in the joerc file. Esc X menu <enter> As usual, hit Tab Tab at the prompt for a completion list of the menus which exist. ^T is bound to the simple macro menu,"root",rtn- it brings up the root of the options menu system. Xterm Mouse support There are two levels of mouse support. The -mouse option enables the first level, which will work with any stock Xterm. If -joexterm is also set, mouse support is enhanced, but you need a recent version of XTerm, and it needs to be ./configured with the --enable-paste64 option. When -mouse is set, you can: • Left-click in a text window to set the cursor position. Left-click in a different window to move the cursor to a different window. • Select text with the mouse. Left-click and drag to select some text- it will be as if you had used ^K B and ^K K to mark it. Left-click (but don´t drag) to position the cursor somewhere else. Middle click to copy the selected text to the cursor- it will be as if you had hit ^K C. If you drag past the edge of the text window, the window will auto-scroll to select more text. Unfortunately, Xterm does not send any codes when the cursor is outside of the Xterm frame itself, so this only works if the mouse is still contained within the Xterm frame. I´ve sent a patch to the Xterm maintainer to improve this, but he has not taken it yet. • Resize windows with the mouse: click and hold on a status line dividing two windows to move it. • Select menu entries (such as any completion menu or the ^T options menu): click on the menu item to position the cursor on it. Double-click on a menu item to select it (same as hitting return with cursor on it). • If your mouse has a wheel, turning the wheel will scroll the window with the cursor. Unfortunately, when -mouse is selected, cut and paste between X windows does not work as it normally does in a shell window (left-click and drag to select, middle click to paste). In‐ stead, you have to hold the shift key down to do this: shift-left-click and drag to select, and shift-middle click to paste. Note that pasting text into JOE this way has problems: any ` characters will get messed up because ` means quote the following control character. Also if auto-indent is enabled, pasted text will not be indented properly. Note: these problems with pasting have been resolved in recent versions of JOE. • JOE enables "bracketed paste" mode in Xterm so that pasted text is bracketed with an es‐ cape sequence. This sequence causes JOE to disable the autoindent, wordwrap and spaces modes for the paste, and restores them when the paste is complete. • Even if the terminal emulator does not have this bracketed paste mode, JOE detects pasted text by timing: If text arrives all at once (all in the same buffer), the text is assumed to be pasted text and autoindent and wordwrap are temporarily disabled. When -joexterm is set (and you have ./configured Xterm with --enable-paste64): • Cut & paste are properly integrated with X. Text selected with left-click-drag is avail‐ able for pasting into other X windows (even if the selected text is larger than the text window). Text selected in other X windows can be pasted into JOE with middle-click. There are no problems pasting text containing ` or with auto-indent. --enable-paste64 allows an application program to communicate Base-64 encoded selection data to and from the Xterm. The program has full control over what is in the selection data and when it is received or sent. Color Xterm support JOE can make use of monochrome Xterm, 8-color Xterm, 16-color Xterm, 88-color Xterm and 256-color Xterm. The number of colors which Xterm supports is determined by which "configure" script options are set before the Xterm source code is compiled. The termcap or terminfo en‐ try must support how your Xterm is configured. On my Slackware Linux distribution, you have to set the TERM environment variable to one of these: • xterm • xterm-color • xterm-16color • xterm-88color • xterm-256color If the termcap/terminfo entry is missing, you can add the "-assume_256color" option to the joerc file. Note that this was broken for terminfo in versions of JOE below 3.4. When it is working, the command: "joe -assume_256color -text_color bg_222" should have a gray background. Hex edit mode When this mode is selected (either put -hex on the command line, or look for "Hex edit mode" after hitting ^T), the buffer is displayed as a hex dump, but all of the editing commands op‐ erate the same way. It is most useful to select overtype mode in conjunction with hex dump (hit ^T T). Then typing will not insert. • To enter the hex byte 0xF8 type ^Q x F 8 • You can use ^K C to copy a block as usual. If overtype mode is selected, the block will overwrite the destination data without changing the size of the file. Otherwise it in‐ serts. • Hit Esc X byte <Enter>, to jump to a particular byte offset. Hex values can be entered into this prompt like this: 0x2000. • Search, incremental search, and search & replace all operate as usual. Environment variables For JOE to operate correctly, a number of other environment settings must be correct. The throughput (baud rate) of the connection between the computer and your terminal must be set correctly for JOE to update the screen smoothly and allow typeahead to defer the screen up‐ date. Use the stty nnn command to set this. You want to set it as close as possible to actual throughput of the connection. For example, if you are connected via a 1200 baud modem, you want to use this value for stty. If you are connected via 14.4k modem, but the terminal server you are connected to connects to the computer a 9600 baud, you want to set your speed as 9600 baud. The special baud rate of 38400 or extb is used to indicate that you have a very-high speed connection, such as a memory mapped console or an X-window terminal emulator. If you can´t use stty to set the actual throughput (perhaps because of a modem communicating with the computer at a different rate than it´s communicating over the phone line), you can put a numeric value in the BAUD environment variable instead (use setenv BAUD 9600 for csh or BAUD=9600; export BAUD for sh). The TERM environment variable must be set to the type of terminal you´re using. If the size (number of lines/columns) of your terminal is different from what is reported in the TERMCAP or TERMINFO entry, you can set this with the stty rows nn cols nn command, or by setting the LINES and COLUMNS environment variables. The terminal size is variable on modern systems and is determined by an ioctl, so these parameters often have no effect. JOE normally expects that flow control between the computer and your terminal to use ^S/^Q handshaking (i.e., if the computer is sending characters too fast for your terminal, your terminal sends ^S to stop the output and ^Q to restart it). If the flow control uses out-of-band or hardware handshaking or if your terminal is fast enough to always keep up with the computer output and you wish to map ^S/^Q to edit commands, you can set the environment variable NOXON to have JOE attempt to turn off ^S/^Q handshaking. If the connection between the computer and your terminal uses no handshaking and your terminal is not fast enough to keep up with the output of the computer, you can set the environment variable DOPADDING to have JOE slow down the output by interspersing PAD characters between the terminal screen up‐ date sequences. Here is a complete list of the environment variables: • BAUD Tell JOE the baud rate of the terminal (overrides value reported by stty). • COLUMNS Set number of columns in terminal emulator (in case termcap entry is wrong). This is only useful on old system which don´t have the "get window size" ioctl. • DOPADDING Enable JOE to send padding NULs to the terminal when set (for very old terminals). • HOME Used to get path to home directory for ~ expansion and also to find ~/.joerc file ~/.joe directory. • HOSTNAME Used to get hostname to put in EMACS compatible locks. • JOETERM Gives terminal type: JOE will use this instead of TERM if it´s set. • LANG Sets locale (like en_US.utf-8). JOE uses the first of these which is set: LC_ALL, LC_CTYPE, LANG. • LC_ALL Sets locale (like en_US.utf-8). JOE uses the first of these which is set: LC_ALL, LC_CTYPE, LANG. • LC_CTYPE Sets locale (like en_US.utf-8). JOE uses the first of these which is set: LC_ALL, LC_CTYPE, LANG. • LINES Set number of lines in terminal emulator (in case termcap entry is wrong). This is only useful on old system which don´t have the "get window size" ioctl. • NOXON Disable ^S and ^Q flow control, possibly allowing ^S and ^Q to be used as editor keys. • SHELL Path to shell (like /bin/sh). This is used in several places: If you are on a system with no job control, this shell is invoked when you hit ^K Z. Also this is the shell which is run in shell windows. If SHELL is not set (Cygwin) or if it´s set to /bin/sh, JOE invokes the first of these which exists: /bin/bash, /usr/bin/bash, /bin/sh. • SIMPLE_BACKUP_SUFFIX If this is set, it is appended to the file name instead of ~ to create the backup file name. • TAGS If set to a path to a file, JOE tries to use this as the "tags" file if there is no "tags" file in the current directory. • TEMP If set, gives path to directory to open swapfile instead of /tmp • TERMCAP Used by JOE´s built-in termcap file parser (not used for terminfo). A termcap entry can be placed directly in this variable (which will be used if it matches TERM), or if it be‐ gins with /, it gives a list of paths to termcap files to search. • TERMPATH Gives list of paths to termcap files to search when TERMCAP has a termcap entry (other‐ wise it´s ignored). The default list of paths to termcap files (when TERMCAP and TERMPATH do not have it) is: "~/.termcap /etc/joe/termcap /etc/termcap" • TERM Gives terminal type, like "vt100" or "xterm". • USER Used to get user name for EMACS compatible file locks. JOE commands grouped by function These commands can be entered at the Esc X prompt. Background programs • bknd Run a shell in a window • vtbknd Run a shell in a terminal emulator window • killproc Kill program in current window • run Run a UNIX command in a window • sys Run a UNIX command and return to editor when done (I/O does not go through editor, but we get the command´s return status). Blocks • blkcpy Copy marked block to cursor • blkdel Delete marked block • blkmove Move marked block to cursor • blksave Save marked block into a file • copy Copy block to kill-ring • drop Set markb. If it was already set, eliminate Ait. • dropon Set markb. If it was already set, eliminate it. Turn on marking mode. • toggle_marking If we´re in a block: clear markb and markk. If marking is off: set markb and turn on marking. If marking is on: set markk (swap if necessary with markb) and turn marking off. • begin_marking If we´re on an edge of a block: set markb to other edge and turn on marking mode. Other‐ wise set markb to cursor and turn on marking mode. • select Set markb. If it was already set, do nothing. • filt Filter block or file through a UNIX command • markb Set beginning of block mark • markk Set end of block mark • markl Mark current line • nmark Eliminate markb and markk • picokill Delete line or block • pop Restore markb and markk values from stack • psh Push markb and markk values onto a stack • swap Switch cursor with markb • tomarkb Move cursor to markb • tomarkbk Move cursor to markb or markk • tomarkk Move cursor to markk • yank Insert top of kill ring • yankpop Scroll through kill ring • yapp Append next kill to top of kill ring • upper Convert everything in block to uppercase • lower Convert everything in block to lowercase Buffers • bufed Buffer menu • edit Load file into window: asks to reload if buffer exists • switch Load file into window: always uses buffer if it exists • scratch Push a scratch buffer into current window • popabort Abort and pop window from stack (do nothing if stack empty) • nbuf Load next buffer into current window • pbuf Load previous buffer into current window • reload Re-read file into buffer (revert) • reloadall Re-read all unmodified buffers Cursor Motion • bof Move cursor to beginning of file • bol Move cursor to beginning of line (always) • bop Move to beginning of a paragraph • bos Move to beginning of screen • bkwdc Search backwards for a character • byte Move cursor to specific byte offset into the file. • col Move cursor to specific column number. • dnarw Move cursor down one line • eof Move cursor to end of file • eol Move cursor to end of line • eop Move cursor to end of paragraph • fwrdc Search forward for matching character • gomark Move cursor to a bookmark • home Move cursor to beginning of line • line Move cursor to specified line • ltarw Move cursor left • nedge Move cursor to next edge • nextpos Move cursor to next position in cursor position history • nextword Move cursor to end of next word • pedge Move cursor to previous edge • prevpos Move cursor to previous position in cursor position history • prevword Move cursor to beginning of previous word • rtarw Move cursor right • setmark Set a bookmark • tomatch Move cursor to matching delimiter • tos Move cursor to top of screen • uparw Move cursor up Deletion • backs Backspace • backw Backspace a word • delbol Delete to beginning of line • delch Delete character under cursor • deleol Delete to end of line • dellin Delete entire line • delw Delete word to right Error parsing • nxterr Goto next parsed error • parserr Parse errors in current file • gparse Parse grep list in current file • jump Parse current line and jump to it • prverr Go to previous parsed error • showerr Show current message • grep Execute grep command, parse when done • build Execute build command, parse when done • release Release error/grep records Exit • cancel Like abort, but doesn´t return failure: useful in macros to escape out of a prompt. • abort Abort current buffer/window. Prompt if it is changed. • abortbuf Like above, but just fail if it would have to prompt because it´s the last window on a modified buffer. • ask Prompt to save current file: user says yes return, user says no: run ´abort´. Use in a macro: "ask,query,exsave" • exsave Save file and exit • lose EMACS kill buffer. The buffer is deleted- any windows with it get a replacement scratch buffer. • querysave Prompt to save each modified buffer. Use in a macro: "querysave,query,killjoe" • killjoe Exit JOE immediately without checking for modified buffers Files • cd Set directory prefix • save Save file • savenow Save immediately, unless file name is not known • insf Insert a file Formatting • center Center line • fmtblk Format all paragraphs in a block • format Format current paragraph • lindent Indent to the left • rindent Indent to the right Help • help Turn help on or off • hnext Switch to next help screen • hprev Switch to previous help screen Inserting • ctrl Type next key • finish Complete word in text window • insc Insert a space • open Insert newline • quote Insert a control character • quote8 Insert a meta character • rtn Return / Enter key • type Insert typed character • secure_type Insert typed character, but only allowed in prompt windows (not allowed in shell windows) Macros • macros Insert keyboard macros into current file • play Execute a macro • query Suspend macro recording for user query • record Record a macro • stop Stop recording macro Menu • backsmenu Undo in file completion menu • bofmenu Move to beginning of menu • bolmenu Move to beginning of line in a menu • dnarwmenu Move down one line in a menu • eolmenu Move cursor to end of line in a menu • eofmenu Move cursor to end of menu • ltarwmenu Move cursor left in a menu • rtarwmenu Move cursor right in menu • uparwmenu Move cursor up in menu • dnslidemenu Scroll menu down one line • upslidemenu Scroll menu up one line • pgupmenu Scroll menu up • pgdnmenu Scroll menu down • tabmenu Tab through menu Misc • beep Beep • execmd Execute a JOE command • debug_joe Insert debug information into buffer • math Calculator • maths Secure Calculator (no way to run joe() macros) • mode Mode prompt • menu Menu prompt • msg Display a message • notmod Clear the modified flag • retype Refresh screen • shell Suspend process or execute a sub-shell • stat Display cursor position • tag Tags file search • tagjump Jump to next tags file search match (only if notagsmenu is set) • timer Execute a macro periodically • txt Insert text. If first character is `, then text is assumed to be a format string (that is, the string used to define the status line for the rmsg and lmsg options) and is for‐ matted before the insertion. • name Insert current file name • language Insert current language • charset Insert current character set • keymap Switch to another keymap Prompts • complete Complete a file-name in a prompt • if Only run following cmds if expr is true (non-zero) • then Same as rtn but only works in prompt windows • elsif Try a new condition • else Toggle truth flag • endif Start running cmds again Here is an example ´if´ macro: if,"char==65",then,"it´s an A",else,"it´s not an A",endif __^[ q__ When you hit __^[ q__, if the character under the cursor is an ´A´: "it´s a A" is inserted into the buffer, otherwise "it´s not an A" is inserted. "if" creates a math prompt (like __Esc M__). "then" is like "rtn"- it hits the return key for this prompt. Within the math prompt, the following variables are available: • char ASCII value of character under cursor • width Width of screen • height Height of screen • byte byte number • col column number • line line number • lines no. lines in file • top line number of top line of window Repeat • arg Prompt for repeat argument • uarg Universal argument Scrolling • crawll Pan screen left • crawlr Pan screen right • dnslide Scroll screen down 1 line • pgdn Scroll screen down • pgup Scroll screen up • upslide Scroll up one line Search and replace • ffirst Find text • fnext Repeat previous search • isrch Incremental search forward • qrepl Search and replace • rfirst Search backwards for text • rsrch Reverse incremental search Windows • explode Display one window or display all windows • dupw Duplicate current window • groww Increase size of window • nextw Move cursor to next window • prevw Go to previous window • shrinkw Shrink window • splitw Split window into two • tw0 Eliminate this window • tw1 Show only one window • mwind Get error messages window on the screen and put cursor in it. • showlog Get startup log scratch buffer into window. • mfit Fit two windows on the screen: make current window 6 lines, and give rest of space to window above. The window above is either the existing previous window, a newly created one if there wasn´t one. Undo • redo Re-execute the latest undone change • undo Undo last change Mouse • tomouse Move the cursor to where the mouse was clicked/dragged • defmdown Default single-click handler, usually bound to MDOWN. Positions cursor to mouse and be‐ gins a region. • defmup Default single-click release handler, usually bound to MUP. Completes selection of a re‐ gion. • defmdrag Default single-click drag handler, usually bound to MDRAG. Selects a region of text a character at a time. • defm2down Default double-click handler, usually bound to M2DOWN. • defm2up Default double-click release handler, usually bound to M2UP. • defm2drag Default double-click drag handler, usually bound to M2DRAG. Selects a region of text a word at a time. • defm3down Default triple-click handler, usually bound to M3DOWN. • defm3up Default triple-click release handler, usually bound to M3UP. • defm3drag Default triple-click drag handler, usually bound to M3DRAG. Selects a region of text a line at a time. • defmiddledown Default middle click handler, usually bound to MIDDLEDOWN. This inserts text. • defmiddleup Default middle click release handler, usually bound to MIDDLEUP. • xtmouse Handle xterm mouse events, usually bound to Esc [ M. It parses the rest of the sequence and generates fake "keys" that can be bound to macros in the joerc file. It uses a timer to detect double-click and triple-click. The keys are: MUP, MDOWN, MDRAG, M2UP, M2DOWN, M2DRAG, M3UP, M3DOWN, M3DRAG, MWUP and MWDOWN. • extmouse Handle extended xterm mouse events, usually bound to Esc [ <. • paste Insert base64 encoded text (for XTerm --enable-base64 option). • brpaste Disable autoindent, wordwrap and spaces. The idea is to bind this to Esc [ 2 0 0 ~ so that when the terminal emulator sends a mouse paste, the text is inserted as-is. • brpaste_done Restore autoindent, wordwrap and spaces modes to their original values before brpaste. The idea is to bind this to Esc [ 2 0 1 ~ so that these modes are restored after a mouse paste. March 2016 JOE() MC(1) GNU Midnight Commander MC(1) NAME mc - Visual shell for Unix-like systems. SYNOPSIS mc [-abcCdfhPstuUVx] [-l log] [dir1 [dir2]] [-e [file] ...] [-v file] DESCRIPTION GNU Midnight Commander is a directory browser/file manager for Unix-like operating systems. OPTIONS -a, --stickchars Disable usage of graphic characters for line drawing. -b, --nocolor Force black and white display. -c, --color Force color mode, please check the section Colors for more information. -C arg, --colors=arg Specify a different color set in the command line. The format of arg is documented in the Colors section. --configure-options Display configure options. -d, --nomouse Disable mouse support. -D N, --debuglevel=N Save the debug level for SMB VFS. N is in 0-10 range. -e [file], --edit[=file] Start the internal editor. If the file is specified, open it on startup. See also mcedit (1). -f, --datadir Display the compiled-in search paths for Midnight Commander files. -F, --datadir-info Display extended info about compiled-in paths for Midnight Commander. -g, --oldmouse Force a "normal tracking" mouse mode. Used when running on xterm-capable terminals (tmux/screen). -k, --resetsoft Reset softkeys to their default from the termcap/terminfo database. Only useful on HP terminals when the function keys don't work. -K file, --keymap=file Specify a name of keymap file in the command line. -l file, --ftplog=file Save the ftpfs dialog with the server in file. --nokeymap Don't load key bindings from any file, use default hardcoded keys. -P file, --printwd=file Print the last working directory to the specified file. This option is not meant to be used directly. Instead, it's used from a special shell script that automatically changes the current directory of the shell to the last directory Midnight Commander was in. Source the file /usr/lib/mc/mc.sh (bash and zsh users) or /usr/lib/mc.csh (tcsh users) respectively to define mc as an alias to the appropriate shell script. -s, --slow Turn on the slow terminal mode, in this mode the program will not draw expensive line drawing characters and will toggle verbose mode off. -S arg, --skin=arg Specify a name of skin in the command line. Technology of skins is documented in the Skins section. -t, --termcap Used only if the code was compiled with S-Lang and terminfo: it makes Midnight Comman‐ der use the value of the TERMCAP variable for the terminal information instead of the information on the system wide terminal database -u, --nosubshell Disable use of the concurrent shell (only makes sense if Midnight Commander has been built with concurrent shell support). -U, --subshell Enable use of the concurrent shell support (only makes sense if the Midnight Commander was built with the subshell support set as an optional feature). -v file, --view=file Start the internal viewer to view the specified file. See also mcview (1). -V, --version Display the version of the program. -x, --xterm Force xterm mode. Used when running on xterm-capable terminals (two screen modes, and able to send mouse escape sequences). -X, --no-x11 Do not use X11 to get the state of modifiers Alt, Ctrl, Shift If both paths are specified, the first path name is the directory to show in the active panel; the second path name is the directory to be shown in the other panel. If one path is specified, the path name is the directory to show in the active panel; value of "other_dir" from panels.ini is the directory to be shown in the passive panel. If no paths are specified, current directory is shown in the active panel; value of "other_dir" from panels.ini is the directory to be shown in the passive panel. Overview The screen of Midnight Commander is divided into four parts. Almost all of the screen space is taken up by two directory panels. By default, the second line from the bottom of the screen is the shell command line, and the bottom line shows the function key labels. The topmost line is the menu bar line. The menu bar line may not be visible, but appears if you click the topmost line with the mouse or press the F9 key. Midnight Commander provides a view of two directories at the same time. One of the panels is the current panel (a selection bar is in the current panel). Almost all operations take place on the current panel. Some file operations like Rename and Copy by default use the directory of the unselected panel as a destination (don't worry, they always ask you for confirmation first). For more information, see the sections on the Directory Panels, the Left and Right Menus and the File Menu. You can execute system commands from Midnight Commander by simply typing them. Everything you type will appear on the shell command line, and when you press Enter, Midnight Commander will execute the command line you typed; read the Shell Command Line and Input Line Keys sections to learn more about the command line. Mouse Support Midnight Commander comes with mouse support. It is activated whenever you are running on an xterm(1) terminal (it even works if you take a telnet, ssh or rlogin connection to another machine from the xterm) or if you are running on a Linux console and have the gpm mouse server running. When you left click on a file in the directory panels, that file is selected; if you click with the right button, the file is marked (or unmarked, depending on the previous state). Double-clicking on a file will try to execute the command if it is an executable program; and if the extension file has a program specified for the file's extension, the specified program is executed. Also, it is possible to execute the commands assigned to the function key labels by clicking on them. The default auto repeat rate for the mouse buttons is 400 milliseconds. This may be changed to other values by editing the ~/.config/mc/ini file and changing the mouse_repeat_rate pa‐ rameter. If you are running Midnight Commander with the mouse support, you can get the default mouse behavior (cutting and pasting text) by holding down the Shift key. Keys Some commands in Midnight Commander involve the use of the Control (sometimes labeled CTRL or CTL) and the Meta (sometimes labeled ALT or even Compose) keys. In this manual we will use the following abbreviations: C-<chr> means hold the Control key while typing the character <chr>. Thus C-f would be: hold the Control key and type f. Alt-<chr> means hold the Meta or Alt key down while typing <chr>. If there is no Meta or Alt key, type Esc, release it, then type the character <chr>. S-<chr> means hold the Shift key down while typing <chr>. All input lines in Midnight Commander use an approximation to the GNU Emacs editor's key bindings (default). You may redefine key bindings. See redefine hotkey bindings for more info. All other key bindings (described in this manual) are relative to default be‐ havior. There are many sections which tell about the keys. The following are the most important. The File Menu section documents the keyboard shortcuts for the commands appearing in the File menu. This section includes the function keys. Most of these commands perform some action, usually on the selected file or the tagged files. The Directory Panels section documents the keys which select a file or tag files as a target for a later action (the action is usually one from the file menu). The Shell Command Line section list the keys which are used for entering and editing command lines. Most of these copy file names and such from the directory panels to the command line (to avoid excessive typing) or access the command line history. Input Line Keys are used for editing input lines. This means both the command line and the input lines in the query dialogs. Redefine hotkey bindings Hotkey bindings may be read from external file (keymap-file). Initially, Midnight Commander creates key bindings using keymap defined in the source code. Then, two files /usr/share/mc/mc.keymap and /etc/mc/mc.keymap are loaded always, sequentially reassigned key bindings defined earlier. User-defined keymap-file is searched on the following algorithm (to the first one found): 1) command line option -K <keymap> or --keymap=<keymap> 2) Environment variable MC_KEYMAP 3) Parameter keymap in section [Midnight-Commander] of config file. 4) File ~/.config/mc/mc.keymap Command line option, environment variable and parameter in config file may contain the abso‐ lute path to the keymap-file (with the extension .keymap or without it). Search of keymap-file will occur in (to the first one found): 1) ~/.config/mc 2) /etc/mc/ 3) /usr/share/mc/ Miscellaneous Keys Here are some keys which don't fall into any of the other categories: Enter if there is some text in the command line (the one at the bottom of the panels), then that command is executed. If there is no text in the command line then if the selec‐ tion bar is over a directory the Midnight Commander does a chdir(2) to the selected directory and reloads the information on the panel; if the selection is an executable file then it is executed. Finally, if the extension of the selected file name matches one of the extensions in the extensions file then the corresponding command is exe‐ cuted. C-l repaint all the information in Midnight Commander. C-x c run the Chmod command on a file or on the tagged files. C-x o run the Chown command on the current file or on the tagged files. C-x l run the hard link command. C-x s run the absolute symbolic link command. C-x v run the relative symbolic link command. See the File Menu section for more information about symbolic links. C-x i set the other panel display mode to information. C-x q set the other panel display mode to quick view. C-x ! execute the External panelize command. C-x h run the add directory to hotlist command. Alt-! executes the Filtered view command, described in the view command. Alt-? executes the Find file command. Alt-c pops up the quick cd dialog. C-o when the program is being run in the Linux or FreeBSD console or under an xterm, it will show you the output of the previous command. When ran on the Linux console, Mid‐ night Commander uses an external program (cons.saver) to handle saving and restoring of information on the screen. When the subshell support is compiled in, you can type C-o at any time and you will be taken back to Midnight Commander's main screen, to return to your application just type C-o. If you have an application suspended by using this trick, you won't be able to execute other programs from Midnight Commander until you terminate the suspended application. Directory Panels This section lists the keys which operate on the directory panels. If you want to know how to change the appearance of the panels take a look at the section on Left and Right Menus. Tab, C-i change the current panel. The old other panel becomes the new current panel and the old current panel becomes the new other panel. The selection bar moves from the old current panel to the new current panel. Insert, C-t to tag files you may use the Insert key (the kich1 terminfo sequence). To untag files, just retag a tagged file. Alt-e to change charset of panel you may use Alt-e (M-e). Recoding is made from selected codepage into system codepage. To cancel the recoding, select "No translation" in the dialog of encodings. Alt-g, Alt-r, Alt-j used to select the top file in a panel, the middle file and the bottom one, respec‐ tively. Alt-t toggle the current display listing to show the next display listing format. With this it is possible to quickly switch to brief listing, long listing, user defined listing format, and back to the default. C-\ (control-backslash) show the directory hotlist and change to the selected directory. + (plus) this is used to select (tag) a group of files. Midnight Commander will prompt for a selection options. When Files only checkbox is on, only files will be selected. If Files only is off, as files as directories will be selected. When Shell Patterns checkbox is on, the regular expression is much like the filename globbing in the shell (* standing for zero or more characters and ? standing for one character). If Shell Patterns is off, then the tagging of files is done with normal regular expressions (see ed (1)). When Case sensitive checkbox is on, the selection will be case sensitive characters. If Case sensitive is off, the case will be ignored. \ (backslash) use the "\" key to unselect a group of files. This is the opposite of the Plus key. up-key, C-p move the selection bar to the previous entry in the panel. down-key, C-n move the selection bar to the next entry in the panel. home, a1, Alt-< move the selection bar to the first entry in the panel. end, c1, Alt-> move the selection bar to the last entry in the panel. next-page, C-v move the selection bar one page down. prev-page, Alt-v move the selection bar one page up. Alt-o If the currently selected file is a directory, load that directory on the other panel and moves the selection to the next file. If the currently selected file is not a di‐ rectory, load the parent directory on the other panel and moves the selection to the next file. Alt-i make the current directory of the current panel also the current directory of the other panel. Put the other panel to the listing mode if needed. If the current panel is panelized, the other panel doesn't become panelized. C-PageUp, C-PageDown only when supported by the terminal: change to ".." and to the currently selected di‐ rectory respectively. Alt-y moves to the previous directory in the history, equivalent to clicking the < with the mouse. Alt-u moves to the next directory in the history, equivalent to clicking the > with the mouse. Alt-S-h, Alt-H displays the directory history, equivalent to depressing the 'v' with the mouse. Quick search The Quick search mode allows you to perform fast file search in file panel. Press C-s or Alt-s to start a filename search in the directory listing. When the search is active, the user input will be added to the search string instead of the command line. If the Show mini-status option is enabled the search string is shown on the mini-status line. When typing, the selection bar will move to the next file starting with the typed letters. The Backspace or DEL keys can be used to correct typing mistakes. If C-s is pressed again, the next match is searched for. If quick search is started with double pressing of C-s, the previous quick search pattern will be used for current search. Besides the filename characters, you can also use wildcard characters '*' and '?'. Shell Command Line This section lists keys which are useful to avoid excessive typing when entering shell com‐ mands. Alt-Enter copy the currently selected file name to the command line. C-Enter same a Alt-Enter. May not work on remote systems and some terminals. C-S-Enter copy the full path name of the currently selected file to the command line. May not work on remote systems and some terminals. Alt-Tab does the filename, command, variable, username and hostname completion for you. C-x t, C-x C-t copy the tagged files (or if there are no tagged files, the selected file) of the cur‐ rent panel (C-x t) or of the other panel (C-x C-t) to the command line. C-x p, C-x C-p the first key sequence copies the current path name to the command line, and the sec‐ ond one copies the unselected panel's path name to the command line. C-q the quote command can be used to insert characters that are otherwise interpreted by Midnight Commander (like the '+' symbol) Alt-p, Alt-n use these keys to browse through the command history. Alt-p takes you to the last en‐ try, Alt-n takes you to the next one. Alt-h displays the history for the current input line. General Movement Keys The help viewer, the file viewer and the directory tree use common code to handle moving. Therefore they accept exactly the same keys. Each of them also accepts some keys of its own. Other parts of Midnight Commander use some of the same movement keys, so this section may be of use for those parts too. Up, C-p moves one line backward. Down, C-n moves one line forward. Prev Page, Page Up, Alt-v moves one page up. Next Page, Page Down, C-v moves one page down. Home, A1 moves to the beginning. End, C1 move to the end. The help viewer and the file viewer accept the following keys in addition the to ones men‐ tioned above: b, C-b, C-h, Backspace, Delete moves one page up. Space bar moves one page down. u, d moves one half of a page up or down. g, G moves to the beginning or to the end. Input Line Keys The input lines (they are used for the command line and for the query dialogs in the program) accept these keys: C-a puts the cursor at the beginning of line. C-e puts the cursor at the end of the line. C-b, move-left move the cursor one position left. C-f, move-right move the cursor one position right. Alt-f moves one word forward. Alt-b moves one word backward. C-h, Backspace delete the previous character. C-d, Delete delete the character in the point (over the cursor). C-@ sets the mark for cutting. C-w copies the text between the cursor and the mark to a kill buffer and removes the text from the input line. Alt-w copies the text between the cursor and the mark to a kill buffer. C-y yanks back the contents of the kill buffer. C-k kills the text from the cursor to the end of the line. Alt-p, Alt-n Use these keys to browse through the command history. Alt-p takes you to the last en‐ try, Alt-n takes you to the next one. Alt-C-h, Alt-Backspace delete one word backward. Alt-Tab does the filename, command, variable, username and hostname completion for you. Menu Bar The menu bar pops up when you press F9 or click the mouse on the top row of the screen. The menu bar has five menus: "Left", "File", "Command", "Options" and "Right". The Left and Right Menus allow you to modify the appearance of the left and right directory panels. The File Menu lists the actions you can perform on the currently selected file or the tagged files. The Command Menu lists the actions which are more general and bear no relation to the cur‐ rently selected file or the tagged files. The Options Menu lists the actions which allow you to customize Midnight Commander. Left and Right (Above and Below) Menus The outlook of the directory panels can be changed from the Left and Right menus (they are named Above and Below when the horizontal panel split is chosen from the Layout options dia‐ log). Listing Format... The listing mode view is used to display a listing of files, there are four different listing formats available: Full, Brief, Long and User. The full directory view shows the file name, the size of the file and the modification time. The brief view shows only the file name and it has from 1 up to 9 columns (therefore showing more files unlike other views). The long view is similar to the output of ls -l command. The long view takes the whole screen width. If you choose the "User" display format, then you have to specify the display format. The user display format must start with a panel size specifier. This may be "half" or "full", and they specify a half screen panel and a full screen panel respectively. After the panel size, you may specify how many listings to fit in the panel, side-by-side (in other words: how many times to repeat the fields horizontally). This defaults to 1. You may change this by adding a number from 1 to 9 to the format string. After this you add the name of the fields with an optional size specifier. This are the available fields you may display: name displays the file name. size displays the file size. bsize is an alternative form of the size format. It displays the size of the files and for directories it just shows SUB-DIR or UP--DIR. type displays a one character wide type field. This character is similar to what is dis‐ played by ls with the -F flag - * for executable files, / for directories, @ for links, = for sockets, - for character devices, + for block devices, | for pipes, ~ for symbolic links to directories and ! for stale symlinks (links that point nowhere). mark an asterisk if the file is tagged, a space if it's not. mtime file's last modification time. atime file's last access time. ctime file's status change time. perm a string representing the current permission bits of the file. mode an octal value with the current permission bits of the file. nlink the number of links to the file. ngid the GID (numeric). nuid the UID (numeric). owner the owner of the file. group the group of the file. inode the inode of the file. Also you can use following keywords to define the panel layout: space a space in the display format. | add a vertical line to the display format. To force one field to a fixed size (a size specifier), you just add : followed by the number of characters you want the field to have. If the number is followed by the symbol +, then the size specifies the minimal field size - if the program finds out that there is more space on the screen, it will then expand that field. For example, the Full display corresponds to this format: half type name | size | mtime And the Long display corresponds to this format: full perm space nlink space owner space group space size space mtime space name This is a nice user display format: half name | size:7 | type mode:3 Panels may also be set to the following modes: Info The info view display information related to the currently selected file and if possi‐ ble information about the current file system. Tree The tree view is quite similar to the directory tree feature. See the section about it for more information. Quick View In this mode, the panel will switch to a reduced viewer that displays the contents of the currently selected file, if you select the panel (with the tab key or the mouse), you will have access to the usual viewer commands. Sort Order... The eight sort orders are by name, by extension, by modification time, by access time, and by inode information modification time, by size, by inode and unsorted. In the Sort order dia‐ log box you can choose the sort order and you may also specify if you want to sort in reverse order by checking the reverse box. By default directories are sorted before files but this can be changed from the Panel options menu (option Mix all files). Filter... The filter command allows you to specify a shell pattern (for example *.tar.gz) which the files must match to be shown. Regardless of the filter pattern, the directories and the links to directories are always shown in the directory panel. Reread The reread command reload the list of files in the directory. It is useful if other processes have created or removed files. File Menu Midnight Commander uses the F1 - F10 keys as keyboard shortcuts for commands appearing in the file menu. The escape sequences for the function keys are terminfo capabilities kf1 trough kf10. On terminals without function key support, you can achieve the same functionality by pressing the Esc key and then a number in the range 1 through 9 and 0 (corresponding to F1 to F9 and F10 respectively). The File menu has the following commands (keyboard shortcuts in parentheses): Help (F1) Invokes the built-in hypertext help viewer. Inside the help viewer, you can use the Tab key to select the next link and the Enter key to follow that link. The keys Space and Backspace are used to move forward and backward in a help page. Press F1 again to get the full list of accepted keys. Menu (F2) Invoke the user menu. The user menu provides an easy way to provide users with a menu and add extra features to Midnight Commander. View (F3, F13) View the currently selected file. By default this invokes the Internal File Viewer but if the option "Use internal view" is off, it invokes an external file viewer specified by the VIEWER environment variable. If VIEWER is undefined, the PAGER environment variable is tried. If PAGER is also undefined, the "view" command is invoked. If you use F13 instead, the viewer will be invoked without doing any formatting or preprocessing to the file. See parameters for external viewer for explain how you may specify an extended command line options for external viewers. Filtered View (Alt-!) This command prompts for a command and its arguments (the argument defaults to the currently selected file name), the output from such command is shown in the internal file viewer. Edit (F4, F14) Press F4 to edit the highlighted file. Press F14 (usually F14) to start the editor with a new, empty file. Currently they invoke the vi editor, or the editor specified in the EDITOR environment variable, or the Internal File Editor if the use_internal_edit option is on. See parameters for external editor for explain how you may specify an extended command line options for external editors. Copy (F5, F15) Press F5 to pop up an input dialog to copy the currently selected file (or the tagged files, if there is at least one file tagged) to the directory/filename you specify in the input dia‐ log. The destination defaults to the directory in the non-selected panel. Space for destina‐ tion file may be preallocated relative to preallocate_space configure option. During this process, you can press C-c or Esc to abort the operation. For details about source mask (which will be usually either * or ^\(.*\)$ depending on setting of Use shell patterns) and possible wildcards in the destination see Mask copy/rename. F15 (usually F15) is similar, but defaults to the directory in the selected panel. It always operates on the selected file, regardless of any tagged files. On some systems, it is possible to do the copy in the background by clicking on the back‐ ground button (or pressing Alt-b in the dialog box). The Background Jobs is used to control the background process. Link (C-x l) Create a hard link to the current file. Absolute symlink (C-x s) Create a absolute symbolic link to the current file. Relative symLink (C-x v) Create a relative symbolic link to the current file. To those of you who don't know what links are: creating a link to a file is a bit like copy‐ ing the file, but both the source filename and the destination filename represent the same file image. For example, if you edit one of these files, all changes you make will appear in both files. Some people call links aliases or shortcuts. A hard link appears as a real file. After making it, there is no way of telling which one is the original and which is the link. If you delete either one of them the other one is still intact. It is very difficult to notice that the files represent the same image. Use hard links when you don't even want to know. A symbolic link is a reference to the name of the original file. If the original file is deleted the symbolic link is useless. It is quite easy to notice that the files represent the same image. Midnight Commander shows an "@"-sign in front of the file name if it is a sym‐ bolic link to somewhere (except to directory, where it shows a tilde (~)). The original file which the link points to is shown on mini-status line if the Show mini-status option is en‐ abled. Use symbolic links when you want to avoid the confusion that can be caused by hard links. When you press "C-x s" Midnight Commander will automatically fill in the complete path+file‐ name of the original file and suggest a name for the link. You can change either one. Sometimes you may want to change the absolute path of the original into a relative path. An absolute path starts from the root directory: /home/frodo/mc/mc -> /home/frodo/new/mc A relative link describes the original file's location starting from the location of the link itself: /home/frodo/mc/mc -> ../new/mc You can force Midnight Commander to suggest a relative path by pressing "C-x v" instead of "C-x s". Rename/Move (F6, F16) Press F6 to pop up an input dialog to copy the currently selected file (or the tagged files, if there is at least one file tagged) to the directory/filename you specify in the input dia‐ log. The destination defaults to the directory in the non-selected panel. For more details look at Copy (F5) operation above, most of the things are quite similar. F16 (usually F16) is similar, but defaults to the directory in the selected panel. It always operates on the selected file, regardless of any tagged files. On some systems, it is possible to do the copy in the background by clicking on the back‐ ground button (or pressing Alt-b in the dialog box). The Background Jobs is used to control the background process. Mkdir (F7) Pop up an input dialog and creates the directory specified. Delete (F8) Delete the currently selected file or the tagged files in the currently selected panel. Dur‐ ing the process, you can press C-c or Esc to abort the operation. Quick cd (Alt-c) Use the quick cd command if you have full command line and want to cd some‐ where. Select group (+) This is used to select (tag) a group of files. Midnight Commander will prompt for a selection options. When Files only checkbox is on, only files will be selected. If Files only is off, as files as directories will be selected. When Shell Patterns checkbox is on, the regular expression is much like the filename globbing in the shell (* standing for zero or more char‐ acters and ? standing for one character). If Shell Patterns is off, then the tagging of files is done with normal regular expressions (see ed (1)). When Case sensitive checkbox is on, the selection will be case sensitive characters. If Case sensitive is off, the case will be ignored. Unselect group (\) Used to unselect a group of files. This is the opposite of the Select group command. Quit (F10, S-F10) Terminate Midnight Commander. S-F10 is used when you want to quit and you are using the shell wrapper. S-F10 will not take you to the last directory you visited with Midnight Commander, instead it will stay at the directory where you started Midnight Commander. Quick cd This command is useful if you have a full command line and want to cd somewhere without hav‐ ing to yank and paste the command line. This command pops up a small dialog, where you enter everything you would enter after cd on the command line and then you press enter. This fea‐ tures all the things that are already in the internal cd command. Command Menu The Directory tree command shows a tree figure of the directories. The "Find file" command allows you to search for a specific file. The "Swap panels" command swaps the contents of the two directory panels. The "Switch panels on/off" command shows the output of the last shell command. This works only on xterm and on Linux and FreeBSD console. The "Compare directories" command compares the directory panels with each other. You can then use the Copy (F5) command to make the panels identical. There are three compare methods. The quick method compares only file size and file date. The thorough method makes a full byte-by-byte compare. The thorough method is not available if the machine does not support the mmap(2) system call. The size-only compare method just compares the file sizes and does not check the contents or the date times, it just checks the file size. The "External panelize" allows you to execute an external program, and make the output of that program the contents of the current panel. The "Command history" command shows a list of typed commands. The selected command is copied to the command line. The command history can also be accessed by typing Alt-p or Alt-n. The "Directory hotlist" command makes changing of the current directory to often used direc‐ tories faster. The "Screen list" command shows a dialog window with the list of currently running internal editors, viewers and other MC modules that support this mode. The "Edit extension file" command allows you to specify programs to executed when you try to execute, view, edit and do a bunch of other thing on files with certain extensions (filename endings). The "Edit Menu File" command may be used for editing the user menu (which appears by pressing F2). Directory Tree The Directory Tree command shows a tree figure of the directories. You can select a directory from the figure and Midnight Commander will change to that directory. There are two ways to invoke the tree. The real directory tree command is available from Com‐ mands menu. The other way is to select tree view from the Left or Right menu. To get rid of long delays, Midnight Commander creates the tree figure by scanning only a small subset of all the directories. If the directory which you want to see is missing, move to its parent directory and press C-r (or F2). You can use the following keys: General movement keys are accepted. Enter. In the directory tree, exits the directory tree and changes to this directory in the current panel. In the tree view, changes to this directory in the other panel and stays in tree view mode in the current panel. C-r, F2 (Rescan). Rescan this directory. Use this when the tree figure is out of date: it is missing subdirectories or shows some subdirectories which don't exist any more. F3 (Forget). Delete this directory from the tree figure. Use this to remove clutter from the fig‐ ure. If you want the directory back to the tree figure press F2 in its parent direc‐ tory. F4 (Static/Dynamic). Toggle between the dynamic navigation mode (default) and the static navigation mode. In the static navigation mode you can use the Up and Down keys to select a directory. All known directories are shown. In the dynamic navigation mode you can use the Up and Down keys to select a sibling direc‐ tory, the Left key to move to the parent directory, and the Right key to move to a child di‐ rectory. Only the parent, sibling and children directories are shown, others are left out. The tree figure changes dynamically as you traverse. F5 (Copy). Copy the directory. F6 (RenMov). Move the directory. F7 (Mkdir). Make a new directory below this directory. F8 (Delete). Delete this directory from the file system. C-s, Alt-s. Search the next directory matching the search string. If there is no such directory these keys will move one line down. C-h, Backspace. Delete the last character of the search string. Any other character. Add the character to the search string and move to the next directory which starts with these characters. In the tree view you must first activate the search mode by pressing C-s. The search string is shown in the mini status line. The following actions are available only in the directory tree. They aren't supported in the tree view. F1 (Help). Invoke the help viewer and show this section. Esc, F10. Exit the directory tree. Do not change the directory. The mouse is supported. A double-click behaves like Enter. See also the section on mouse sup‐ port. Find File The Find File feature first asks for the start directory for the search and the filename to be searched for. By pressing the Tree button you can select the start directory from the di‐ rectory tree figure. The "File name" input field contains a filename pattern to be searched for. It is interpreted as a shell pattern or as a regular expression depending on the state of the "Using shell pat‐ terns" checkbox. An empty value is valid and matches any file name. The "Content" input field contains a string to search for within the files. Leave this field empty to disable searching file contents. Option "Whole words" allows select only those files containing matches that form whole words. Like grep -w. You can start the search by pressing the OK button. During the search you can stop from the Stop button and continue from the Start button. You can browse the filelist with the up and down arrow keys. The Chdir button will change to the directory of the currently selected file. The Again button will ask for the parameters for a new search. The Quit button quits the search operation. The Panelize button will place the found files to the current directory panel so that you can do additional operations on them (view, copy, move, delete and so on). To return to the normal file listing, change di‐ rectory to "..". The 'Enable ignore directories' checkbox and input field below it allow one to set up the list of directories that should be skip during the search files (for example, you may want to avoid searches on a CD-ROM or on a NFS directory that is mounted across a slow link). List components must be separated with a colon, here is an example: /cdrom:/nfs/wuarchive:/afs Relative paths are supported also. The following example shows how to skip special directo‐ ries of version control systems: /cdrom:/nfs/wuarchive:/afs:.svn:.git:CVS Attention: input field can contain a dot (.), this means the current absolute path. You may consider using the External panelize command for some operations. Find file command is for simple queries only, while using External panelize you can do as mysterious searches as you would like. External panelize The External panelize allows you to execute an external program, and make the output of that program the contents of the current panel. For example, if you want to manipulate in one of the panels all the symbolic links in the current directory, you can use external panelization to run the following command: find . -type l -print Upon command completion, the directory contents of the panel will no longer be the directory listing of the current directory, but all the files that are symbolic links. If you want to panelize all of the files that have been downloaded from your FTP server, you can use this awk command to extract the file name from the transfer log files: awk '$9 ~! /incoming/ { print $9 }' < /var/log/xferlog You may want to save often used panelize commands under a descriptive name, so that you can recall them quickly. You do this by typing the command on the input line and pressing Add new button. Then you enter a name under which you want the command to be saved. Next time, you just choose that command from the list and do not have to type it again. Hotlist The Directory hotlist command shows the labels of the directories in the directory hotlist. Midnight Commander will change to the directory corresponding to the selected label. From the hotlist dialog, you can remove already created label/directory pairs and add new ones. To add new directories quickly, you can use the Add to hotlist command (C-x h), which adds the current directory into the directory hotlist, asking just for the label for the direc‐ tory. This makes cd to often used directories faster. You may consider using the CDPATH variable as described in internal cd command description. Edit Extension File This will invoke your editor on the file ~/.config/mc/mc.ext. The format of this file fol‐ lowing: All lines starting with # or empty lines are thrown away. Lines starting in the first column should have following format: keyword/expr, i.e. everything after the slash until new line is expr. keyword can be: shell - expr is an extension (no wildcards). File matches it its name ends with expr. Ex‐ ample: shell/.tar matches *.tar. regex - expr is a regular expression. File matches if its name matches the regular expres‐ sion. directory - expr is a regular expression. File matches if it is a directory and its name matches the regular expression. type - expr is a regular expression. File matches if the output of file %f without the initial "filename:" part matches regular expression expr. default - matches any file. expr is ignored. include - denotes a common section. expr is the name of the section. Other lines should start with a space or tab and should be of the format: keyword=command (with no spaces around =), where keyword should be: Open (invoked on Enter or double click), View (F3), Edit (F4) or Include (to add rules from the common section). command is any one-line shell command, with the simple macro substitution. Rules are matched from top to bottom, thus the order is important. If the appropriate action is missing, search continues as if this rule didn't match (i.e. if a file matches the first and second entry and View action is missing in the first one, then on pressing F3 the View action from the second entry will be used). default should match all the actions. Background Jobs This lets you control the state of any background Midnight Commander process (only copy and move files operations can be done in the background). You can stop, restart and kill a back‐ ground job from here. Edit Menu File The user menu is a menu of useful actions that can be customized by the user. When you access the user menu, the file .mc.menu from the current directory is used if it exists, but only if it is owned by user or root and is not world-writable. If no such file found, ~/.con‐ fig/mc/menu is tried in the same way, and otherwise mc uses the default system-wide menu /usr/share/mc/mc.menu. The format of the menu file is very simple. Lines that start with anything but space or tab are considered entries for the menu (in order to be able to use it like a hot key, the first character should be a letter). All the lines that start with a space or a tab are the com‐ mands that will be executed when the entry is selected. When an option is selected all the command lines of the option are copied to a temporary file in the temporary directory (usually /usr/tmp) and then that file is executed. This allows the user to put normal shell constructs in the menus. Also simple macro substitution takes place before executing the menu code. For more information, see macro substitution. Here is a sample mc.menu file: A Dump the currently selected file od -c %f B Edit a bug report and send it to root I=`mktemp ${MC_TMPDIR:-/tmp}/mail.XXXXXX` || exit 1 vi $I mail -s "Midnight Commander bug" root < $I rm -f $I M Read mail emacs -f rmail N Read Usenet news emacs -f gnus H Call the info hypertext browser info J Copy current directory to other panel recursively tar cf - . | (cd %D && tar xvpf -) K Make a release of the current subdirectory echo -n "Name of distribution file: " read tar ln -s %d `dirname %d`/$tar cd .. tar cvhf ${tar}.tar $tar = f *.tar.gz | f *.tgz & t n X Extract the contents of a compressed tar file tar xzvf %f Default Conditions Each menu entry may be preceded by a condition. The condition must start from the first col‐ umn with a '=' character. If the condition is true, the menu entry will be the default entry. Condition syntax: = <sub-cond> or: = <sub-cond> | <sub-cond> ... or: = <sub-cond> & <sub-cond> ... Sub-condition is one of following: y <pattern> syntax of current file matching pattern? (for edit menu only) f <pattern> current file matching pattern? F <pattern> other file matching pattern? d <pattern> current directory matching pattern? D <pattern> other directory matching pattern? t <type> current file of type? T <type> other file of type? x <filename> is it executable filename? ! <sub-cond> negate the result of sub-condition Pattern is a normal shell pattern or a regular expression, according to the shell patterns option. You can override the global value of the shell patterns option by writing "shell_pat‐ terns=x" on the first line of the menu file (where "x" is either 0 or 1). Type is one or more of the following characters: n not a directory r regular file d directory l link c character device b block device f FIFO (pipe) s socket x executable file t tagged For example 'rlf' means either regular file, link or fifo. The 't' type is a little special because it acts on the panel instead of the file. The condition '=t t' is true if there are tagged files in the current panel and false if not. If the condition starts with '=?' instead of '=' a debug trace will be shown whenever the value of the condition is calculated. The conditions are calculated from left to right. This means = f *.tar.gz | f *.tgz & t n is calculated as ( (f *.tar.gz) | (f *.tgz) ) & (t n) Here is a sample of the use of conditions: = f *.tar.gz | f *.tgz & t n L List the contents of a compressed tar-archive gzip -cd %f | tar xvf - Addition Conditions If the condition begins with '+' (or '+?') instead of '=' (or '=?') it is an addition condi‐ tion. If the condition is true the menu entry will be included in the menu. If the condition is false the menu entry will not be included in the menu. You can combine default and addition conditions by starting condition with '+=' or '=+' (or '+=?' or '=+?' if you want debug trace). If you want to use two different conditions, one for adding and another for defaulting, you can precede a menu entry with two condition lines, one starting with '+' and another starting with '='. Comments are started with '#'. The additional comment lines must start with '#', space or tab. Options Menu Midnight Commander has some options that may be toggled on and off in several dialogs which are accessible from this menu. Options are enabled if they have an asterisk or "x" in front of them. The Configuration command pops up a dialog from which you can change most of settings of Mid‐ night Commander. The Layout command pops up a dialog from which you specify a bunch of options how mc looks like on the screen. The Panel options command pops up a dialog from which you specify options of file manager panels. The Confirmation command pops up a dialog from which you specify which actions you want to confirm. The Appearance command pops up a dialog from which you specify the skin. The Display bits command pops up a dialog from which you may select which characters is your terminal able to display. The Learn keys command pops up a dialog from which you test some keys which are not working on some terminals and you may fix them. The Virtual FS command pops up a dialog from which you specify some VFS related options. The Save setup command saves the current settings of the Left, Right and Options menus. A small number of other settings is saved, too. Configuration The options in this dialog are divided into several groups: "File operation options", "Esc key mode", "Pause after run" and "Other options". File operation options Verbose operation. This toggles whether the file Copy, Rename and Delete operations are ver‐ bose (i.e., display a dialog box for each operation). If you have a slow terminal, you may wish to disable the verbose operation. It is automatically turned off if the speed of your terminal is less than 9600 bps. Compute totals. If this option is enabled, Midnight Commander computes total byte sizes and total number of files prior to any Copy, Rename and Delete operations. This will provide you with a more accurate progress bar at the expense of some speed. This option has no effect, if Verbose operation is disabled. Classic progressbar. If this option is enabled, the progressbar of Copy/Move/Delete opera‐ tions is always grown form left to right. If disabled, the growing direction of progressbar follows to direction of Copy/Move/Delete operation: from left panel to right one and vice versa. Enabled by default. Mkdir autoname. When you press F7 to create a new directory, the input line in popup dialog will be filled by name of current file or directory in active panel. Disabled by default. Preallocate space. Preallocate space for whole target file, if possible, before copy opera‐ tion. Disabled by default. Esc key mode. By default, Midnight Commander treats the Esc key as a key prefix. Therefore, you should press Esc code twice to exit a dialog. But there is a possibility to use a single press of Esc key for that action. Single press. By default this option is disabled. If you'll enable it, the Esc key will act as a prefix key for set up time interval (see Timeout option below), and if no extra keys have arrived, then the Esc key is interpreted as a cancel key (Esc Esc). Timeout. This options is used to setup the time interval (in microseconds) for single press of Esc key. By default, this interval is one second (1000000 microseconds). Also the timeout can be set via KEYBOARD_KEY_TIMEOUT_US environment variable (also in microseconds), which has higher priority than Timeout option value. Pause after run After executing your commands, Midnight Commander can pause, so that you can examine the out‐ put of the command. There are three possible settings for this variable: Never. Means that you do not want to see the output of your command. If you are using the Linux or FreeBSD console or an xterm, you will be able to see the output of the command by typing C-o. On dumb terminals. You will get the pause message on terminals that are not capable of show‐ ing the output of the last command executed (any terminal that is not an xterm or the Linux console). Always. The program will pause after executing all of your commands. Other options Use internal editor. If this option is enabled, the built-in file editor is used to edit files. If the option is disabled, the editor specified in the EDITOR environment variable is used. If no editor is specified, vi is used. See the section on the internal file editor. Use internal viewer. If this option is enabled, the built-in file viewer is used to view files. If the option is disabled, the pager specified in the PAGER environment variable is used. If no pager is specified, the view command is used. See the section on the internal file viewer. Ask new file name. If this option is enabled, file name is asked before open new file in ed‐ itor. Auto menus. If this option is enabled, the user menu will be invoked at startup. Useful for building menus for non-unixers. Drop down menus. When this option is enabled, the pull down menus will be activated as soon as you press the F9 key. Otherwise, you will only get the menu title, and you will have to activate the menu either with the arrow keys or with the hotkeys. It is recommended if you are using hotkeys. Shell Patterns. By default the Select, Unselect and Filter commands will use shell-like reg‐ ular expressions. The following conversions are performed to achieve this: the '*' is re‐ placed by '.*' (zero or more characters); the '?' is replaced by '.' (exactly one character) and '.' by the literal dot. If the option is disabled, then the regular expressions are the ones described in ed(1). Complete: show all. By default, Midnight Commander pops up all possible completions if the completion is ambiguous only when you press Alt-Tab for the second time. For the first time, it just completes as much as possible and beeps in the case of ambiguity. Enable this option if you want to see all possible completions even after pressing Alt-Tab the first time. Rotating dash. If this option is enabled, the Midnight Commander shows a rotating dash in the upper right corner as a work in progress indicator. Cd follows links. This option, if set, causes Midnight Commander to follow the logical chain of directories when changing current directory either in the panels, or using the cd command. This is the default behavior of bash. When unset, Midnight Commander follows the real direc‐ tory structure, so cd .. if you've entered that directory through a link will move you to the current directory's real parent and not to the directory where the link was present. Safe delete. If this option is enabled, deleting files and directory hotlist entries unin‐ tentionally becomes more difficult. The default selection in the confirmation dialogs for deletion changes from Yes to No. This option is disabled by default. Safe overwrite. If this option is enabled, overwriting files unintentionally becomes more difficult. The default selection in the overwrite confirmation dialog changes from Yes to No. This option is disabled by default. Auto save setup. If this option is enabled, when you exit Midnight Commander, the config‐ urable options of Midnight Commander are saved in the ~/.config/mc/ini file. Layout The layout dialog gives you a possibility to change the general layout of screen. The options in this dialog are divided into several groups: "Panel split", "Console output" and "Other options". Panel split The rest of the screen area is used for the two directory panels. You can specify whether the area is split to the panels in Vertical or Horizontal direction. Panel layout can be changed using Alt-, (Alt-comma) shortcut. Equal split. By default, panels have equal sizes. Using this option you can specify an un‐ equal split. Console output On the Linux or FreeBSD console you can specify how many lines are shown in the output win‐ dow. This option is available if Midnight Commander runs on native console only. Other options Menu bar visible. If enabled, main menu of Midnight Commander is always visible on the top row of screen above panels. Enabled by default. Command prompt. If enabled, command line is available. Enabled by default. Keybar visible. If enabled, 10 labels associated with F1-F10 keys are located at the bottom row of screen. Enabled by default. Hintbar visible. If enabled, the one-line hints are visible below panels. Enabled by de‐ fault. XTerm window title. When run in a terminal emulator for X11, Midnight Commander sets the terminal window title to the current working directory and updates it when necessary. If your terminal emulator is broken and you see some incorrect output on startup and directory change, turn off this option. Enabled by default. Show free space. If enabled, free space and total space of current file system is shown at the bottom frame of panel. Enabled by default. Panel options Main panel options Show mini-status. If enabled, one line of status information about the currently selected item is shown at the bottom of the panels. Enabled by default. Use SI size units. If this option is enabled, Midnight Commander will use SI prefixes (base 10) when displaying any byte sizes. If disabled (default), Midnight Commander will use IEC prefixes (base 2). Mix all files. If this option is enabled, all files and directories are shown mixed to‐ gether. If the option is disabled (default), directories (and links to directories) are shown at the beginning of the listing, and other files below. Show backup files. If enabled, Midnight Commander will show files ending with a tilde. Oth‐ erwise, they won't be shown (like GNU's ls option -B). Enabled by default. Show hidden files. If enabled, Midnight Commander will show all files that start with a dot (like ls -a). Disabled by default. Fast directory reload. If this option is enabled, Midnight Commander will use a trick to de‐ termine if the directory contents have changed. The trick is to reload the directory only if the i-node of the directory has changed; this means that reloads only happen when files are created or deleted. If what changes is the i-node for a file in the directory (file size changes, mode or owner changes, etc) the display is not updated. In these cases, if you have the option on, you have to rescan the directory manually (with C-r). Disabled by default. Mark moves down. If enabled, the selection bar will move down when you mark a file (with In‐ sert key). Enabled by default. Reverse files only. Allow revert selection of files only. Enabled by default. If enabled, the reverse selection is applied to files only, not to directories. The selection of direc‐ tories is untouched. If off, the reverse selection is applied to files as well to directo‐ ries: all unselected items become selected, and vice versa. Simple swap. If both panels contain file listing, simple swap means that panels exchange its screen positions: left panel become right one, and vice versa. If this option is unchecked, file listing panels exchange its content keeping listing format and sort options. Unchecked by default. Auto save panels setup. If this option is enabled, when you exit Midnight Commander, the current settings of panels are saved in the ~/.config/mc/panels.ini file. Disabled by de‐ fault. Navigation Lynx-like motion. If this option is enabled, you may use the arrows keys to automatically chdir if the current selection is a subdirectory and the shell command line is empty. By de‐ fault, this setting is off. Page scrolling. If set (the default), panel will scroll by half the display when the cursor reaches the end or the beginning of the panel, otherwise it will just scroll a file at a time. Center scrolling. If set, panel will scroll when the cursor reaches the middle of the panel column, only hitting the top or bottom of the panel when actually on the first or last file. This behavior applies when scrolling one file at a time, and does not apply to the page up/down keys. Mouse page scrolling. Controls whenever scrolling with the mouse wheel is done by pages or line by line on the panels. File highlight You can specify whether permissions and file types should be highlighted with distinctive Colors. If the permission highlighting is enabled, the parts of the perm and mode display fields which apply to the user running Midnight Commander are highlighted with the color de‐ fined by the selected keyword. If the file type highlighting is enabled, file names are col‐ ored according to rules described in /etc/mc/filehighlight.ini file. See Filenames Highlight for more info. Quick search You can specify how the Quick search mode should work: case insensitively, case sensitively or be matched to the panel sort order: case sensitive or not. Confirmation In this dialog you configure the confirmation options for file deletion, overwriting files, execution by pressing enter, quitting the program, directory hotlist entries deletion and history cleanup. Appearance In this dialog you can select the skin to be used and enable shadow for dialogs and drop down menus. See the Skins section for technical details about the skin definition files. Shadows. If this option is enabled, all dialogs and drop down menus will have a shadow. Display bits This is used to configure the range of visible characters on the screen. This setting may be 7-bits if your terminal/curses supports only seven output bits, ISO-8859-1 displays all the characters in the ISO-8859-1 map and full 8 bits is for those terminals that can display full 8 bit characters. Learn keys This dialog allows you to test and redefine functional keys, cursor arrows and some other keys to make them work properly on your terminal. They often don't, since many terminal databases are incomplete or broken. You can move around with the Tab key and with the vi moving keys ('h' left, 'j' down, 'k' up and 'l' right). Once you press any cursor movement key and it is recognized, you can use that key as well. You can test keys just by pressing each of them. When you press a key and it is recognized properly, OK should appear next to the name of that key. Once a key is marked OK it starts working as usually, e.g. F1 pressed the first time will just check that the F1 key works, but after that it will show help. The same applies to the arrow keys. The Tab key should be working always. If some keys do not work properly then you won't see OK appear after pressing one of these. Then you may want to redefine it. Do it by pressing the button with the name of that key (either by the mouse or by Enter or Space after selecting the button with Tab or arrows). Then a message box will appear asking you to press that key. Do it and wait until the mes‐ sage box disappears. If you want to abort, just press Escape once and wait. When you finish with all the keys, you can Save them. The definitions for the keys you have redefined will be written into the [terminal:TERM] section of your ~/.config/mc/ini file (where TERM is the name of your current terminal). The definitions of the keys that were al‐ ready working properly are not saved. Virtual FS This option gives you control over the settings of the Virtual File System. Midnight Commander keeps in memory the information related to some of the virtual file sys‐ tems to speed up the access to the files in the file system (for example, directory listings fetched from FTP servers). Also, in order to access the contents of compressed files (for example, compressed tar files), Midnight Commander needs to create temporary uncompressed files on your disk. Since both the information in memory and the temporary files on disk take up resources, you may want to tune the parameters of the cached information to decrease your resource usage or to maximize the speed of access to frequently used file systems. Because of the format of the tar archives, the Tar filesystem needs to read the whole file just to load the file entries. Since most tar files are usually kept compressed (plain tar files are species in extinction), the tar file system has to uncompress the file on the disk in a temporary location and then access the uncompressed file as a regular tar file. Now, since we all love to browse files and tar files all over the disk, it's common that you will leave a tar file and then re-enter it later. Since decompression is slow, Midnight Com‐ mander will cache the information in memory for a limited time. When the timeout expires, all the resources associated with the file system are released. The default timeout is set to one minute. The FTP File System (ftpfs) allows you to browse directories on remote FTP servers. It has several options. ftp anonymous password is the password used when you login as "anonymous". Some sites re‐ quire a valid e-mail address. On the other hand, you probably don't want to give your real e-mail address to untrusted sites, especially if you are not using spam filtering. ftpfs keeps the directory listing it fetches from a FTP server in a cache. The cache expire time is configurable with the ftpfs directory cache timeout option. A low value for this op‐ tion may slow down every operation on the ftpfs because every operation would require sending a request to the FTP server. You can define an FTP proxy host for doing FTP. Note that most modern firewalls are fully transparent at least for passive FTP (see below), so FTP proxies are considered obsolete. If Always use ftp proxy is not set, you can use the exclamation sign to enable proxy for cer‐ tain hosts. See FTP File System for examples. If this option is set, the program will do two things: consult the /usr/lib/mc/mc.no_proxy file for lines containing host names that are local (if the host name starts with a dot, it is assumed to be a domain) and to assume that any hostnames without dots in their names are directly accessible. All other hosts will be accessed through the specified FTP proxy. You can enable using ~/.netrc file, which keeps login names and passwords for ftp servers. See netrc (5) for the description of the .netrc format. Use passive mode enables using FTP passive mode, when the connection for data transfer is initiated by the client, not by the server. This option is recommended and enabled by de‐ fault. If this option is turned off, the data connection is initiated by the server. This may not work with some firewalls. Save Setup At startup, Midnight Commander tries to load initialization information from the ~/.con‐ fig/mc/ini file. If this file doesn't exist, the system-wide file /etc/mc/mc.ini is used. If this file doesn't exist, the system-wide file /usr/share/mc/mc.ini is used. If this file doesn't exist, MC uses the default settings. The Save Setup command creates the ~/.config/mc/ini file by saving the current settings of the Left, Right and Options menus. If you activate the auto save setup option, MC will always save the current settings when ex‐ iting. There also exist settings which can't be changed from the menus. To change these settings you have to edit the setup file with your favorite editor. See the section on Special Settings for more information. Executing operating system commands You may execute commands by typing them directly in Midnight Commander's input line, or by selecting the program you want to execute with the selection bar in one of the panels and hitting Enter. If you press Enter over a file that is not executable, Midnight Commander checks the exten‐ sion of the selected file against the extensions in the Extensions File. If a match is found then the code associated with that extension is executed. A very simple macro expansion takes place before executing the command. The cd internal command The cd command is interpreted by Midnight Commander, it is not passed to the command shell for execution. Thus it may not handle all of the nice macro expansion and substitution that your shell does, although it does some of them: Tilde substitution. The (~) will be substituted with your home directory, if you append a username after the tilde, then it will be substituted with the login directory of the speci‐ fied user. For example, ~guest is the home directory for the user guest, while ~/guest is the directory guest in your home directory. Previous directory. You can jump to the directory you were previously by using the special directory name '-' like this: cd - CDPATH directories. If the directory specified to the cd command is not in the current di‐ rectory, then Midnight Commander uses the value in the environment variable CDPATH to search for the directory in any of the named directories. For example you could set your CDPATH variable to ~/src:/usr/src, allowing you to change your directory to any of the directories inside the ~/src and /usr/src directories, from any place in the file system by using its relative name (for example cd linux could take you to /usr/src/linux). Macro Substitution When accessing a user menu, or executing an extension dependent command, or running a command from the command line input, a simple macro substitution takes place. The macros are: %i The indent of blank space, equal the cursor column position. For edit menu only. %y The syntax type of current file. For edit menu only. %k The block file name. %e The error file name. %m The current menu name. %f and %p In file manager user menu: the current file name in selected panel. In mcedit user menu: the name of opened file. %x The extension of current file name. %b The current file name without extension. %d The current directory name. %F The current file in the unselected panel. %D The directory name of the unselected panel. %t The currently tagged files. %T The tagged files in the unselected panel. %u and %U Similar to the %t and %T macros, but in addition the files are untagged. You can use this macro only once per menu file entry or extension file entry, because next time there will be no tagged files. %s and %S The selected files: The tagged files if there are any. Otherwise the current file. %cd This is a special macro that is used to change the current directory to the directory specified in front of it. This is used primarily as an interface to the Virtual File System. %view This macro is used to invoke the internal viewer. This macro can be used alone, or with arguments. If you pass any arguments to this macro, they should be enclosed in brackets. The arguments are: ascii to force the viewer into ascii mode; hex to force the viewer into hex mode; nroff to tell the viewer that it should interpret the bold and under‐ line sequences of nroff; unformatted to tell the viewer to not interpret nroff com‐ mands for making the text bold or underlined. %% The % character %{some text} Prompt for the substitution. An input box is shown and the text inside the braces is used as a prompt. The macro is substituted by the text typed by the user. The user can press Esc or F10 to cancel. This macro doesn't work on the command line yet. %var{ENV:default} If environment variable ENV is unset, the default is substituted. Otherwise, the value of ENV is substituted. The subshell support The subshell support is a compile time option, that works with the shells: bash, ash (BusyBox and Debian), tcsh, zsh and fish. When the subshell support is active, Midnight Commander will spawn a concurrent copy of your shell (the one defined in the SHELL variable and if it is not defined, then the one in the /etc/passwd file) and run it in a pseudo terminal, instead of invoking a new shell each time you execute a command, the command will be passed to the subshell as if you had typed it. This also allows you to change the environment variables, use shell functions and define aliases that are valid until you quit Midnight Commander. bash users may specify startup commands in ~/.local/share/mc/bashrc (fallback ~/.bashrc) and special keyboard maps in ~/.local/share/mc/inputrc (fallback ~/.inputrc). ash/dash users (BusyBox or Debian) may specify startup commands in ~/.local/share/mc/ashrc (fallback ~/.profile). zsh users may specify startup commands in ~/.local/share/mc/.zshrc (fallback ~/.zshrc). tcsh, fish users cannot specify mc-specific startup commands at present. They have to rely on shell-specific startup files. The following paragraphs are relevant only when the subshell support is active: You can suspend applications at any time with the sequence C-o and jump back to Midnight Com‐ mander, if you interrupt an application, you will not be able to run other external commands until you quit the application you interrupted. The basic prompt displayed by Midnight Commander is of the form "user@host:current_path$ ". When using a capable shell, like Bash, the prompt displayed by Midnight Commander will be the same prompt that you are currently using in your shell. (There's a known problem when using fish: the prompt is displayed only in full screen mode (Ctrl-o), not when the panels are visible.) The OPTIONS section has more information on how you can control subshell usage (-U/-u). Fur‐ thermore, to set a specific subshell different from your current SHELL variable or login shell defined in /etc/passwd, you may call MC like this: SHELL=/bin/myshell mc Chmod The Chmod window is used to change the attribute bits in a group of files and directories. It can be invoked with the C-x c key combination. The Chmod window has two parts - Permissions and File. In the File section are displayed the name of the file or directory and its permissions in octal form, as well as its owner and group. In the Permissions section there is a set of check buttons which correspond to the file at‐ tribute bits. As you change the attribute bits, you can see the octal value change in the File section. To move between the widgets (buttons and check buttons) use the arrow keys or the Tab key. To change the state of the check buttons or to select a button use Space. You can also use the hotkeys on the buttons to quickly activate them. Hotkeys are shown as highlighted let‐ ters on the buttons. To set the attribute bits, use the Enter key. When working with a group of files or directories, you just click on the bits you want to set or clear. Once you have selected the bits you want to change, you select one of the action buttons (Set marked or Clear marked). Finally, to set the attributes exactly to those specified, you can use the [Set all] button, which will act on all the tagged files. [Marked all] set only marked attributes to all selected files [Set marked] set marked bits in attributes of all selected files [Clean marked] clear marked bits in attributes of all selected files [Set] set the attributes of one file [Cancel] cancel the Chmod command Chown The Chown command is used to change the owner/group of a file. The hot key for this command is C-x o. Advanced Chown The Advanced Chown command is the Chmod and Chown command combined into one window. You can change the permissions and owner/group of files at once. Chattr The Chattr window is used to change the attributes of a group of files and directories on a Linux file system. It can be invoked with the C-x e key combination. Not all attributes are supported or utilized by all filesystems. List of available attribute flags is represented as a set of check buttons which correspond to the attribute flags (see chattr(1) for details). As you change the attribute flags, you can see the symbolic value change below file name. To move between the widgets (buttons and check buttons) use the arrow keys or the Tab key. To change the state of the check buttons or to select a button use Space. To set the attributes, use the Enter key. When working with a group of files or directories, you just click on the flags you want to set or clear. Once you have selected the flags you want to change, you select one of the ac‐ tion buttons (Set marked or Clear marked). Finally, to set the attributes exactly to those specified, you can use the [Set all] button, which will act on all the tagged files. [Marked all] set only marked attributes to all selected files. [Set marked] set marked flags in attributes of all selected files. [Clean marked] clear marked flags in attributes of all selected files. [Set] set the attributes of one file. [Cancel] cancel the Chattr command. File Operations When you copy, move or delete files, Midnight Commander shows the file operations dialog. It shows the files currently being processed and uses up to three progress bars. The file bar indicates the percentage of the current file that has been processed so far. The count bar shows how many of the tagged files have been handled. The bytes bar indicates the percentage of the total size of the tagged files that has been handled. If the verbose option is off, the file and bytes bars are not shown. There are two buttons at the bottom of the dialog. Pressing the Skip button will skip the rest of the current file. Pressing the Abort button will abort the whole operation, the rest of the files are skipped. There are three other dialogs which you can run into during the file operations. The error dialog informs about error conditions and has three choices. Normally you select either the Skip button to skip the file or the Abort button to abort the operation alto‐ gether. You can also select the Retry button if you fixed the problem from another terminal. The replace dialog is shown when you attempt to copy or move a file on the top of an existing file. The dialog shows the dates and sizes of the both files. Press the Yes button to over‐ write the file, the No button to skip the file, the All button to overwrite all the files, the None button to never overwrite and the Update button to overwrite if the source file is newer than the target file. You can abort the whole operation by pressing the Abort button. The recursive delete dialog is shown when you try to delete a directory which is not empty. Press the Yes button to delete the directory recursively, the No button to skip the direc‐ tory, the All button to delete all the directories and the None button to skip all the non-empty directories. You can abort the whole operation by pressing the Abort button. If you selected the Yes or All button you will be asked for a confirmation. Type "yes" only if you are really sure you want to do the recursive delete. If you have tagged files and perform an operation on them only the files on which the opera‐ tion succeeded are untagged. Failed and skipped files are left tagged. Mask Copy/Rename The copy/move operations let you translate the names of files in an easy way. To do it, you have to specify the correct source mask and usually in the trailing part of the destination specify some wildcards. All the files matching the source mask are copied/renamed according to the target mask. If there are tagged files, only the tagged files matching the source mask are renamed. There are other options which you can set: Follow links determines whether make the symlinks and hardlinks in the source directory (recursively in subdirectories) new links in the target directory or whether would you like to copy their content. Dive into subdirs determines the behavior when the source directory is about to be copied, but the target di‐ rectory already exists. The default action is to copy the contents of the source directory into the target directory. Enabling this option causes copying the source directory itself into the target directory. For example, you want to copy directory /foo containing file bar to /bla/foo, which is an al‐ ready existing directory. Normally (when Dive into subdirs is not set), mc would copy file /foo/bar into the file /bla/foo/bar. By enabling this option the /bla/foo/foo directory will be created, and /foo/bar will be copied into /bla/foo/foo/bar. Preserve attributes determines whether to preserve the permissions, timestamps and (if you are root) the owner‐ ship of the original files. If this option is not set, the current value of the umask will be respected. Use shell patterns When this option is on you can use the '*' and '?' wildcards in the source mask. They work like they do in the shell. In the target mask only the '*' and '\<digit>' wildcards are al‐ lowed. The first '*' wildcard in the target mask corresponds to the first wildcard group in the source mask, the second '*' corresponds to the second group and so on. The '\1' wildcard corresponds to the first wildcard group in the source mask, the '\2' wildcard corresponds to the second group and so on all the way up to '\9'. The '\0' wildcard is the whole filename of the source file. Two examples: If the source mask is "*.tar.gz", the destination is "/bla/*.tgz" and the file to be copied is "foo.tar.gz", the copy will be "foo.tgz" in "/bla". Suppose you want to swap basename and extension so that "file.c" would become "c.file" and so on. The source mask for this is "*.*" and the destination is "\2.\1". Use shell patterns off When the shell patterns option is off the MC doesn't do automatic grouping anymore. You must use '\(...\)' expressions in the source mask to specify meaning for the wildcards in the tar‐ get mask. This is more flexible but also requires more typing. Otherwise target masks are similar to the situation when the shell patterns option is on. Two examples: If the source mask is "^\(.*\)\.tar\.gz$", the destination is "/bla/*.tgz" and the file to be copied is "foo.tar.gz", the copy will be "/bla/foo.tgz". Let's suppose you want to swap basename and extension so that "file.c" will become "c.file" and so on. The source mask for this is "^\(.*\)\.\(.*\)$" and the destination is "\2.\1". Case Conversions You can also change the case of the filenames. If you use '\u' or '\l' in the target mask, the next character will be converted to uppercase or lowercase correspondingly. If you use '\U' or '\L' in the target mask, the next characters will be converted to upper‐ case or lowercase correspondingly up to the next '\E' or next '\U', '\L' or the end of the file name. The '\u' and '\l' are stronger than '\U' and '\L'. For example, if the source mask is '*' ( Use shell patterns on) or '^\(.*\)$' ( Use shell patterns off) and the target mask is '\L\u*' the file names will be converted to have initial upper case and otherwise lower case. You can also use '\' as a quote character. For example, '\\' is a backslash and '\*' is an asterisk. Stable symlinks commands Midnight Commander, that it should change symlinks in the target, so that they'll point to the same location as it did before. With absolute symbolic links this does nothing, but if you have a relative one, it will recompute its value, adding necessary ../ and other directory parts and making the value as short as possible (most modern filesystems keep short symlinks inside inodes and thus don't waste much disk space). Select/Unselect Files The dialog of group of files and directories selection or uselection. The input line allow enter the regular expression of filenames that will be selected/unselected. When Files only checkbox is on, only files will be selected. If Files only is off, as files as directories will be selected. When Shell Patterns checkbox is on, the regular expression is much like the filename globbing in the shell (* standing for zero or more characters and ? standing for one character). If Shell Patterns is off, then the tagging of files is done with normal regular expressions (see ed (1)). When Case sensitive checkbox is on, the selection will be case sensitive characters. If Case sensitive is off, the case will be ignored. Internal Diff Viewer The mcdiff is a visual diff tool. You can compare two files and edit them in-place (diffs are updated dynamically). You can browse and view a working copy from popular version control systems (GIT, Subversion, etc). Following shortcuts are available in internal diff viewer of Midnight Commander. F1 Invoke the built-in hypertext help viewer. F2 Save modified files. F4 Edit file of the left panel in the internal editor. F14 Edit file of the right panel in the internal editor. F5 Merge the current hunk. Only the current hunk will be merged. F7 Start search. F17 Continue search. F10, Esc, q Exit from diff viewer. Alt-s, s Toggle show of hunk status. Alt-n, l Toggle show of line numbers. f Maximize left panel. = Make panels equal in width. > Reduce the size of the right panel. < Reduce the size of the left panel. c Toggle show of trailing carriage return (CR) symbol as ^M. 2, 3, 4, 8 Set tabulation size C-u Swap contents of diff panels. C-r Refresh the screen. C-o Switch to the subshell and show the command screen. Enter, Space, n Find next diff hunk. Backspace, p Find previous diff hunk. g Go to line. Down Scroll one line forward. Up Scroll one line backward. PageUp Move one page up. PageDown Mves one page down. Home, A1 Moves to the line beginning. End Moves to the line end. C-Home Move to the file beginning. C-End, C1 Move to the file end. Internal File Viewer The internal file viewer provides two display modes: ASCII and hex. To toggle between modes, use the F4 key. The viewer will try to use the best method provided by your system or the file type to dis‐ play the information. Some character sequences, which appear most often in preformatted man‐ ual pages, are displayed bold and underlined, thus making a pretty display of your files. When in hex mode, the search function accepts text in quotes and constant numbers. Text in quotes is matched exactly after removing the quotes. Each number matches one byte. You can mix quoted text with constants like this: "String" 34 0xBB 012 "more text" Numbers are always interpreted in hex. In the example above, "34" is interpreted as 0x34. The prefix "0x" isn't really needed: we could type "BB" instead of "0xBB". And "012" is inter‐ preted as 0x12, not as an octal number. Here is a listing of the actions associated with each key that the Midnight Commander handles in the internal file viewer. F1 Invoke the built-in hypertext help viewer. F2 Toggle the wrap mode. F4 Toggle the hex mode. F5 Goto. You can specify a line number, offset or percentage of file size of position that you want to view. F7, /, ? Start search. These keys call the dialog window that allows you to set up the search options. If key is ? the "Backwards" option is on. C-s Continue forward search. C-r Continue reverse search. F17, n Continue search in the chosen direction. N Temporary change the search direction: backwards if forward search is chosen, and vice versa. F8 Toggle Raw/Parsed mode: This will show the file as found on disk or if a processing filter has been specified in the mc.ext file, then the output from the filter. Current mode is always the other than written on the button label, since on the button is the mode which you enter by that key. F9 Toggle the format/unformat mode: when format mode is on the viewer will interpret some string sequences to show bold and underline with different colors. Also, on button la‐ bel is the other mode than current. F10, Esc. Exit the internal file viewer. PageDown, space, C-v. Scroll one page forward. PageUp, Alt-v, C-b, Backspace. Scroll one page backward. Down Scroll one line forward. Up Scroll one line backward. C-l Refresh the screen. C-o Switch to the subshell and show the command screen. [n] m Set the mark n. [n] r Jump to the mark n. C-f Jump to the next file. C-b Jump to the previous file. Alt-r Toggle the ruler. Alt-e to change charset of displayed text may use Alt-e (M-e). Recoding is made from se‐ lected codepage into system codepage. To cancel the recoding you may select "<No translation>" in charset selection dialog. It's possible to instruct the file viewer how to display a file, look at the Edit Extension File section Internal File Editor The internal file editor is a full-featured full screen editor. It can edit files up to 64 megabytes. It is possible to edit binary files. The internal file editor is invoked using F4 if the use_internal_edit option is set in the initialization file. The features it presently supports are: block copy, move, delete, cut, paste; key for key undo; pull-down menus; file insertion; macro commands; regular expression search and replace; S-arrow text highlighting (if supported by the terminal); insert-overwrite toggle; word wrap; autoindent; tunable tab size; syntax highlighting for various file types; and an option to pipe text blocks through shell commands like indent and ispell. Sections: Options of editor in ini-file The editor is very easy to use and requires no tutoring. To see what keys do what, just con‐ sult the appropriate pull-down menu. Other keys are: Shift movement keys do text highlight‐ ing. C-Ins copies to the file mcedit.clip and S-Ins pastes from mcedit.clip. S-Del cuts to mcedit.clip, and C-Del deletes highlighted text. Mouse highlighting also works, and you can override the mouse as usual by holding down the shift key while dragging the mouse to let normal terminal mouse highlighting work. To define a macro, press C-R and then type out the key strokes you want to be executed. Press C-R again when finished. You can then assign the macro to any key you like by pressing that key. The macro is executed when you press C-A and then the assigned key. The macro is also executed if you press Meta, Ctrl, or Esc and the assigned key, provided that the key is not used for any other function. Once defined, the macro commands go into the file ~/.lo‐‐ cal/share/mc/mcedit/mcedit.macros You can delete a macro by deleting the appropriate line in this file. To change charset of displayed text may use Alt-e (M-e). Recoding is made from selected codepage into system codepage. To cancel the recoding you may select "<No translation>" in charset selection dialog. F19 will format the currently highlighted block (plain text or C or C++ code or another). This is controlled by the file /usr/share/mc/edit.indent.rc which is copied to ~/.lo‐‐ cal/share/mc/mcedit/edit.indent.rc in your home directory the first time you use it. The editor also displays non-us characters (160+). When editing binary files, you should set display bits to 7 bits in the options menu to keep the spacing clean. Options of editor in ini-file Some editor options of ini-file are described in this section. Options are placed in [Mid‐ night-Commander] section editor_wordcompletion_collect_entire_file Search autocomplete candidates in entire of file or just from begin of file to cursor position (0) Screen selector Midnight Commander supports running many internal modules (such as editor, viewer and diff viewer) simultaneously and switching between them without closing open files. Using several file managers at a time, however, is not currently supported. Let's call each of these modules a screen. There are three ways to switch between screens, using one of these global shortcuts: Alt-} switch to the next screen; Alt-{ switch to the previous screen; Alt-` open a dialog window with the list of currently open screens (or use the "Screen list" menu item). Completion Let Midnight Commander type for you. Attempt to perform completion on the text before current position. MC attempts completion treating the text as variable (if the text begins with $), username (if the text begins with ~), hostname (if the text begins with @) or command (if you are on the command line in the position where you might type a command, possible completions then include shell reserved words and shell built-in commands as well) in turn. If none of these matches, filename com‐ pletion is attempted. Filename, username, variable and hostname completion works on all input lines, command com‐ pletion is command line specific. If the completion is ambiguous (there are more different possibilities), MC beeps and the following action depends on the setting of the Complete: show all option in the Configuration dialog. If it is enabled, a list of all possibilities pops up next to the current position and you can select with the arrow keys and Enter the correct entry. You can also type the first letters in which the possibilities differ to move to a subset of all possibilities and complete as much as possible. If you press Alt-Tab again, only the subset will be shown in the listbox, otherwise the first item which matches all the previous characters will be highlighted. As soon as there is no ambiguity, dialog disappears, but you can hide it by canceling keys Esc, F10 and left and right arrow keys. If Complete: show all is disabled, the dialog pops up only if you press Alt-Tab for the second time, for the first time MC just beeps. Apply escaping of ?, *, and & symbols (as \?, \*, and \&) in filenames to disallow use them as metasymbols in regular expressions when substitution is performed in the input line. Virtual File System Midnight Commander is provided with a code layer to access the file system; this code layer is known as the virtual file system switch. The virtual file system switch allows Midnight Commander to manipulate files not located on the Unix file system. Currently, Midnight Commander is packaged with some Virtual File Systems (VFS): the local file system, used for accessing the regular Unix file system; the ftpfs, used to manipulate files on remote systems with the FTP protocol; the tarfs, used to manipulate tar and com‐ pressed tar files; the undelfs, used to recover deleted files on ext2 file systems (the de‐ fault file system for Linux systems), fish (for manipulating files over shell connections such as rsh and ssh). If the code was compiled with sftpfs (for manipulating files over SFTP connections). If the code was compiled with smbfs support, you can manipulate files on re‐ mote systems with the SMB (CIFS) protocol. A generic extfs (EXTernal virtual File System) is provided in order to easily expand VFS ca‐ pabilities using scripts and external software. The VFS switch code will interpret all of the path names used and will forward them to the correct file system, the formats used for each one of the file systems is described later in their own section. FTP File System The FTP File System (ftpfs) allows you to manipulate files on remote machines. To actually use it, you can use the FTP link item in the menu or directly change your current directory using the cd command to a path name that looks like this: ftp://[!][user[:pass]@]machine[:port][remote-dir] The user, port and remote-dir elements are optional. If you specify the user element, Mid‐ night Commander will login to the remote machine as that user, otherwise it will use anony‐ mous login or the login name from the ~/.netrc file. The optional pass element is the pass‐ word used for the connection. Using the password in the VFS directory name is not recom‐ mended, because it can appear on the screen in clear text and can be saved to the directory history. To enable using FTP proxy, prepend ! (an exclamation sign) to the hostname. Examples: ftp://ftp.nuclecu.unam.mx/linux/local ftp://tsx-11.mit.edu/pub/linux/packages ftp://!behind.firewall.edu/pub ftp://guest AT remote-host.com:40/pub ftp://miguel:xxx@server/pub Please check the Virtual File System dialog box for ftpfs options. Tar File System The tar file system provides you with read-only access to your tar files and compressed tar files by using the chdir command. To change your directory to a tar file, you change your current directory to the tar file by using the following syntax: /filename.tar/utar://[dir-inside-tar] The mc.ext file already provides a shortcut for tar files, this means that usually you just point to a tar file and press return to enter into the tar file, see the Edit Extension File section for details on how this is done. Examples: mc-3.0.tar.gz/utar://mc-3.0/vfs /ftp/GCC/gcc-2.7.0.tar/utar:// The latter specifies the full path of the tar archive. FIle transfer over SHell filesystem The fish file system is a network based file system that allows you to manipulate the files in a remote machine as if they were local. To use this, the other side has to either run fish server, or has to have bash-compatible shell. To connect to a remote machine, you just need to chdir into a special directory which name is in the following format: sh://[user@]machine[:options]/[remote-dir] The user, options and remote-dir elements are optional. If you specify the user element, Midnight Commander will try to login on the remote machine as that user, otherwise it will use your login name. The available options are: 'C' - use compression; 'r' - use rsh instead of ssh; port - specify the port used by remote server. If the remote-dir element is present, your current directory on the remote machine will be set to this one. Examples: sh://onlyrsh.mx:r/linux/local sh://joe AT want.edu:C/private sh://joe AT noncompressed.edu/private sh://joe AT somehost.edu:2222/private SFTP (SSH File Transfer Protocol) filesystem The SFTP file system is a network based file system that allows you to manipulate the files in a remote machine as if they were local. To connect to a remote machine, you just need to chdir into a special directory which name is in the following format: sftp://[user@]machine:[port]/[remote-dir] The user, port and remote-dir elements are optional. If you specify the user element, Mid‐ night Commander will try to login on the remote machine as that user, otherwise it will use your login name. port - specify the port used by remote server (22 by default). If the re‐ mote-dir element is present, your current directory on the remote machine will be set to this one. Examples: sftp://onlyrsh.mx/linux/local sftp://joe:password AT want.edu/private sftp://joe AT noncompressed.edu/private sftp://joe AT somehost.edu:2222/private When establishing the connection, server key fingerprint is verified using the ~/.ssh/known_hosts file. If the host/key pair is not found or the host is found, but the key doesn't match, an appropriate message is shown. There are three buttons in the message dia‐ log: [Yes] add new host/key pair to the ~/.ssh/known_hosts file and continue. [Ignore] do not add new host/key pair to the ~/.ssh/known_hosts file, but continue neverthe‐ less (at you own risk). [No] abort connection. Undelete File System On Linux systems, if you asked configure to use the ext2fs undelete facilities, you will have the undelete file system available. Recovery of deleted files is only available on ext2 file systems. The undelete file system is just an interface to the ext2fs library to retrieve all of the deleted files names on an ext2fs and provides and to extract the selected files into a regular partition. To use this file system, you have to chdir into the special file name formed by the "un‐ del://" prefix and the file name where the actual file system resides. For example, to recover deleted files on the second partition of the first SCSI disk on Linux, you would use the following path name: undel://sda2 It may take a while for the undelfs to load the required information before you start brows‐ ing files there. SMB File System The smbfs allows you to manipulate files on remote machines with SMB (or CIFS) protocol. These include Windows for Workgroups, Windows 9x/ME/XP, Windows NT, Windows 2000 and Samba. To actually use it, you may try to use the panel command "SMB link..." (accessible from the menubar) or you may directly change your current directory to it using the cd command to a path name that looks like this: smb://[user@]machine[/service][/remote-dir] The user, service and remote-dir elements are optional. The user, domain and password can be specified in an input dialog. Examples: smb://machine/Share smb://other_machine smb://guest@machine/Public/Irlex EXTernal File System extfs allows you to integrate numerous features and file types into GNU Midnight Commander in an easy way, by writing scripts. Extfs filesystems can be divided into two categories: 1. Stand-alone filesystems, which are not associated with any existing file. They represent certain system-wide data as a directory tree. You can invoke them by typing cd fsname:// where fsname is an extfs short name (see below). Examples of such filesystems include audio (list audio tracks on the CD) or apt (list of all Debian packages in the system). For example, to list CD-Audio tracks on your CD-ROM drive, type cd audio:// 2. 'Archive' filesystems (like rpm, patchfs and more), which represent contents of a file as a directory tree. It can consist of 'real' files compressed in an archive (urar, rpm) or virtual files, like messages in a mailbox (mailfs) or parts of a patch (patchfs). To access such filesystems fsname:// should be appended to the archive name. Note that the archive it‐ self can be on another vfs. For example, to list contents of a zip archive documents.zip type cd documents.zip/uzip:// In many aspects, you could treat extfs like any other directory. For instance, you can add it to the hotlist or change to it from directory history. An important limitation is that you cannot invoke shell commands inside extfs, just like any other non-local VFS. Common extfs scripts included with Midnight Commander are: a access 'A:' DOS/Windows diskette (cd a://). apt front end to Debian's APT package management system (cd apt://). audio audio CD ripping and playing (cd audio:// or cd device/audio://). bpp package of Bad Penguin GNU/Linux distribution (cd file.bpp/bpp://). deb package of Debian GNU/Linux distribution (cd file.deb/deb://). dpkg Debian GNU/Linux installed packages (cd deb://). hp48 view and copy files to/from a HP48 calculator (cd hp48://). lslR browsing of lslR listings as found on many FTPs (cd filename/lslR://). mailfs mbox-style mailbox files support (cd mailbox/mailfs://). patchfs extfs to handle unified and context diffs (cd filename/patchfs://). rpm RPM package (cd filename/rpm://). rpms RPM database management (cd rpms://). ulha, urar, uzip, uzoo, uar, uha archivers (cd archive/xxxx:// where xxxx is one of: ulha, urar, uzip, uzoo, uar, uha). You could bind file type/extension to specified extfs as described in the Edit Extension File section. Here is an example entry for Debian packages: regex/.deb$ Open=%cd %p/deb:// Colors Midnight Commander will try to detect if your terminal supports color using the terminal database and your terminal name. Sometimes it gets confused, so you may force color mode or disable color mode using the -c and -b flag respectively. If the program is compiled with the S-Lang screen manager instead of ncurses, it will also check the variable COLORTERM, if it is set, it has the same effect as the -c flag. You may specify terminals that always force color mode by adding the color_terminals variable to the Colors section of the initialization file. This will prevent Midnight Commander from trying to detect if your terminal supports color. Example: [Colors] color_terminals=linux,xterm color_terminals=terminal-name1,terminal-name2... The program can be compiled with both ncurses and S-Lang, ncurses does not provide a way to force color mode: ncurses uses just the information in the terminal database. Midnight Commander provides a way to change the default colors. Currently the colors are configured using the environment variable MC_COLOR_TABLE or the Colors section in the ini‐ tialization file. In the Colors section, the default color map is loaded from the base_color variable. You can specify an alternate color map for a terminal by using the terminal name as the key in this section. Example: [Colors] base_color= xterm=menu=magenta:marked=,magenta:markselect=,red The format for the color definition is: <keyword>=<fgcolor>,<bgcolor>,<attributes>:<keyword>=... The colors are optional, and the keywords are: normal, selected, disabled, marked, markse‐ lect, errors, input, inputmark, inputunchanged, commandlinemark, reverse, gauge, header, in‐ puthistory, commandhistory. Button bar colors are: bbarhotkey, bbarbutton. Status bar color: statusbar. Menu colors are: menunormal, menusel, menuhot, menuhotsel, menuinactive. Dialog colors are: dnormal, dfocus, dhotnormal, dhotfocus, dtitle. Error dialog colors are: errdfo‐ cus, errdhotnormal, errdhotfocus, errdtitle. Help colors are: helpnormal, helpitalic, help‐ bold, helplink, helpslink, helptitle. Viewer colors are: viewnormal, viewbold, viewunder‐ line, viewselected. Editor colors are: editnormal, editbold, editmarked, editwhitespace, ed‐ itlinestate. Popup menu colors are: pmenunormal, pmenusel, pmenutitle. header determines the color of panel header, the line that contains column titles and sort mode indicator. input determines the color of input lines used in query dialogs. gauge determines the color of the filled part of the progress bar (gauge), which is used to show the user the progress of file operations, such as copying. disabled determines the color of the widget that cannot be selected. The dialog boxes use the following colors: dnormal is used for the normal text, dfocus is the color used for the currently selected component, dhotnormal is the color used to differenti‐ ate the hotkey color in normal components, whereas the dhotfocus color is used for the high‐ lighted color in the currently selected component. Menus use the same scheme but uses the menunormal, menusel, menuhot, menuhotsel and menuinac‐ tive tags instead. Help uses the following colors: helpnormal is used for normal text, helpitalic is used for text which is emphasized in italic in the manual page, helpbold is used for text which is em‐ phasized in bold in the manual page, helplink is used for not selected hyperlinks and help‐ slink is used for selected hyperlink. Popup menu uses following colors: pmenunormal is used for non-selected menu items and as a main color of popup menu window, pmenusel is used for selected menu item, pmenutitle is used for popup menu title. The possible colors are: black, gray, red, brightred, green, brightgreen, brown, yellow, blue, brightblue, magenta, brightmagenta, cyan, brightcyan, lightgray and white. And there is a special keyword for transparent background. It is 'default'. The 'default' can only be used for background color. Another special keyword "base" means mc's main colors. When 256 colors are available, they can be specified either as color16 to color255, or as rgb000 to rgb555 and gray0 to gray23. Example: [Colors] base_color=normal=white,default:marked=magenta,default Attributes can be any of bold, italic, underline, reverse and blink, appended by a plus sign if more than one are desired. The special word "none" means no attributes, without attempt‐ ing to fall back to base_color. Example: menuhotsel=yellow;black;bold+underline Skins You can change the appearance of Midnight Commander. To do this, you must specify a file that contain descriptions of colors and lines to draw boxes. Redefining of the colors is en‐ tirely compatible with the assignment of colors, as described in Section Colors. If your skin contains any true-color definitions, you should define the 'truecolors' key set to TRUE value in [skin] section. If true-color is not used but 256-color is, you should de‐ fine '256colors' instead. A skin-file is searched on the following algorithm (to the first one found): 1) command line option -S <skin> or --skin=<skin> 2) Environment variable MC_SKIN 3) Parameter skin in section [Midnight-Commander] in config file. 4) File /etc/mc/skins/default.ini 5) File /usr/share/mc/skins/default.ini Command line option, environment variable and parameter in config file may contain the abso‐ lute path to the skin-file (with the extension .ini or without it). Search of skin-file will occur in (to the first one found): 1) ~/.local/share/mc/skins/ 2) /etc/mc/skins/ 3) /usr/share/mc/skins/ For getting extended info, refer to: Description of section and parameters Color pair definitions Color and attribute aliases Draw lines Compatibility Description of section and parameters Section [skin] contain metainfo for skin-file. Parameter description contain short text about skin. Section [filehighlight] contain descriptions of color pairs for filenames highlighting. Name of parameters must be equal to names of sections into filehighlight.ini file. See Filenames Highlight for getting more info. Section [core] describes the elements that are used everywhere. _default_ Default color pair. Used in all other sections if they not contain color definitions selected cursor marked selected data markselect cursor on selected data gauge color of the filled part of the progress bar input color of input lines used in query dialogs inputmark color of input selected text inputunchanged color of input text before first modification or cursor movement commandlinemark color of selected text in command line reverse reverse color Section [dialog] describes the elements that are placed on dialog windows (except error di‐ alogs). _default_ Default color for this section. Used [core]._default_ if not specified dfocus Color of active element (in focus) dhotnormal Color of hotkeys dhotfocus Color of hotkeys in focused element Section [error] describes the elements that are placed on error dialog windows _default_ Default color for this section. Used [core]._default_ if not specified errdhotnormal Color of hotkeys errdhotfocus Color of hotkeys in focused element Section [menu] describes the elements that are placed in menu. This section describes system menu (called by F9) and user-defined menus (called by F2 in panels and by F11 in editor). _default_ Default color for this section. Used [core]._default_ if not specified entry Color of menu items menuhot Color of menu hotkeys menusel Color of active menu item (in focus) menuhotsel Color of menu hotkeys in focused menu item menuinactive Color of inactive menu Section [help] describes the elements that are placed on help window. _default_ Default color for this section. Used [core]._default_ if not specified helpitalic Color pair for element with italic attribute helpbold Color pair for element with bold attribute helplink Color of links helpslink Color of active link (on focus) Section [editor] describes the colors of elements placed in editor. _default_ Default color for this section. Used [core]._default_ if not specified editbold Color pair for element with bold attribute editmarked Color of selected text editwhitespace Color of tabs and trailing spaces highlighting editlinestate Color for line state area Section [viewer] describes the colors of elements placed in viewer. viewunderline Color pair for element with underline attribute Color pair definitions Any parameter in skin-file contain definition of color pair. Color pairs described as two colors and the optional attributes separated by ';'. First field sets the foreground color, second field sets background color, third field sets the at‐ tributes. Any of the fields may be omitted, in this case value will be taken from default color pair (global color pair or from default color pair of this section). Example: [core] # green on black _default_=green;black # green (default) on blue selected=;blue # yellow on black (default) # underlined yellow on black (default) marked=yellow;;underline Possible colors (names) and attributes are described in Colors. section. Color and attribute aliases This optional section might define aliases for single colors (not color pairs) as well as combination of attributes; in other words, for semicolon-separated fragments of parameters. Aliases can refer to other aliases as long as they don't form a loop. Example: [aliases] myfavfg=green myfavbg=black myfavattr=bold+italic [core] _default_=myfavfg;myfavbg;myfavattr Draw lines Lines sets in section [Lines] into skin-file. By default single lines are used, but you may redefine to usage of any utf-8 symbols (like to lines, for example). WARNING!!! When you build Midnight Commander with the ncurses screen library usage of draw‐ ing lines is limited! Possible only drawing a single lines. For all questions and comments please contact the developers of ncurses. Descriptions of parameters [Lines]: lefttop left-top line fragment. righttop right-top line fragment. centertop down branch of horizontal line centerbottom up branch of horizontal line leftbottom left-bottom line fragment rightbottom right-bottom line fragment leftmiddle right branch of vertical line rightmiddle left branch of vertical line centermiddle cross of lines horiz horizontal line vert vertical line thinhoriz thin horizontal line thinvert thin vertical line Compatibility Appointment of color by skin-files fully compatible with the appointment of the colors de‐ scribed in Colors. section. In this case, reassignment of colors has priority over the skin file and is complementary. Filenames Highlight Section [filehighlight] in current skin-file contains key names as highlight groups and val‐ ues as color pairs. Color pairs is documented in Skins section. Rules of filenames highlight are placed in /usr/share/mc/filehighlight.ini file (~/.con‐ fig/mc/filehighlight.ini). Name of section in this file must be equal to parameters names in [filehighlight] section (in current skin-file). Keys in these groups are: type file type. If present, all other options are ignored. regexp regular expression. If present, 'extensions' option is ignored. extensions list of extensions of files. Separated by ';' sign. extensions_case (make sense only with 'extensions' parameter) make 'extensions' rule case sensitive (true) or not (false). `type' key may have values: - FILE (all files) - FILE_EXE - DIR (all directories) - LINK_DIR - LINK (all links except stale link) - HARDLINK - SYMLINK - STALE_LINK - DEVICE (all device files) - DEVICE_BLOCK - DEVICE_CHAR - SPECIAL (all special files) - SPECIAL_SOCKET - SPECIAL_FIFO - SPECIAL_DOOR Special Settings Most of Midnight Commander settings can be changed from the menus. However, there are a small number of settings which can only be changed by editing the setup file. These variables may be set in your ~/.config/mc/ini file: clear_before_exec By default, Midnight Commander clears the screen before executing a command. If you would prefer to see the output of the command at the bottom of the screen, edit your ~/.config/mc/ini file and change the value of the field clear_before_exec to 0. confirm_view_dir If you press F3 on a directory, normally MC enters that directory. If this flag is set to 1, then MC will ask for confirmation before changing the directory if you have files tagged. ftpfs_retry_seconds This value is the number of seconds Midnight Commander will wait before attempting to reconnect to an FTP server that has denied the login. If the value is zero, the login will no be retried. max_dirt_limit Specifies how many screen updates can be skipped at most in the internal file viewer. Normally this value is not significant, because the code automatically adjusts the number of updates to skip according to the rate of incoming keystrokes. However, on very slow machines or terminals with a fast keyboard auto repeat, a big value can make screen updates too jumpy. It seems that setting max_dirt_limit to 10 causes the best behavior, and that is the default value. mouse_move_pages_viewer Controls if scrolling with the mouse is done by pages or line by line on the internal file viewer. only_leading_plus_minus Allow special treatment for '+', '-', '*' in the command line (select, unselect, re‐ verse selection) only if the command line is empty. You don't need to quote those characters in the middle of the command line. On the other hand, you cannot use them to change selection when the command line is not empty. alternate_plus_minus If true, use '+', '-', '\' and '*' keys normally. For select/unselect, use 'Alt-+', 'Alt--' and 'Alt-*'. show_output_starts_shell This variable only works if you are not using the subshell support. When you use the C-o keystroke to go back to the user screen, if this one is set, you will get a fresh shell. Otherwise, pressing any key will bring you back to Midnight Commander. timeformat_recent Change the time format used to display dates less than 6 months from now. See strf‐ time or date man page for the format specification. If this option is absent, default timeformat is used. timeformat_old Change the time format used to display dates older than 6 months from now or for dates in the future. See strftime or date man page for the format specification. If this option is absent, default timeformat is used. torben_fj_mode If this flag is set, then the home and end keys will work slightly different on the panels, instead of moving the selection to the first and last files in the panels, they will act as follows: The home key will: Go up to the middle line, if below it; else go to the top line un‐ less it is already on the top line, in this case it will go to the first file in the panel. The end key has a similar behavior: Go down to the middle line, if over it; else go to the bottom line unless you already are at the bottom line, in such case it will move the selection to the last file name in the panel. use_file_to_guess_type If this variable is on (the default) it will spawn the file command to match the file types listed on the mc.ext file. xtree_mode If this variable is on (default is off) when you browse the file system on a Tree panel, it will automatically reload the other panel with the contents of the selected directory. fish_directory_timeout This variable holds the lifetime of a directory cache entry in seconds. The default value is 900 seconds. clipboard_store This variable contains path (with options) to the external clipboard utility like 'xclip' to read text into X selection from file. For example: clipboard_store=xclip -i clipboard_paste This variable contains path (with options) to the external clipboard utility like 'xclip' to print the selection to standard out. For example: clipboard_paste=xclip -o autodetect_codeset This option allows use the `enca' command to autodetect codeset of text files in in‐ ternal viewer and editor. List of valid values can be obtain by the `enca --list lan‐ guages | cut -d : -f1' command. Option must be located in the [Misc] section. For example: autodetect_codeset=russian Parameters for external editor or viewer Midnight Commander provides a way for specify an options for external editors and viewers. Midnight Commander tries to search the "[External editor or viewer parameters]" section in the system initialization file (the mc.lib file located in Midnight Commander's library di‐ rectory) and then in the ~/.config/mc/ini file. The option name should be equal to the name (full pathname) of external editor or viewer. The option value can contain following vari‐ ables: %filename The filename to edit/view. %lineno The start line in the opening file. For example: [External editor or viewer parameters] vi=%filename +%lineno joe=%filename +%lineno more=%filename +%lineno Start line is passed to the external editor/viewer only if it is called from the Find file results window. If external editor/viewer is launched via F4/F3 keys, MC hopes that program (at least "joe", but probably others too) has an own feature that by default opens the file where it was last open. MC doesn't prevent external editor/viewer to save and restore position in opened files. Terminal databases Midnight Commander provides a way to fix your system terminal database without requiring root privileges. Midnight Commander searches in the system initialization file (the mc.lib file located in Midnight Commander's library directory) and in the ~/.config/mc/ini file for the section "terminal:your-terminal-name" and then for the section "terminal:general", each line of the section contains a key symbol that you want to define, followed by an equal sign and the definition for the key. You can use the special \e form to represent the escape charac‐ ter and the ^x to represent the control-x character. The possible key symbols are: f0 to f20 Function keys f0-f20 bs backspace home home key end end key up up arrow key down down arrow key left left arrow key right right arrow key pgdn page down key pgup page up key insert the insert character delete the delete character complete to do completion For example, to define the key insert to be the Escape + [ + O + p, you set this in the ini file: insert=\e[Op Also now you can use extended learn keys. For example: ctrl-alt-right=\e[[1;6C ctrl-alt-left=\e[[1;6D This means that ctrl+alt+left sends a \e[[1;6D escape sequence and therefore Midnight Comman‐ der interprets "\e[[1;6D" as C-Alt-Left. The complete key symbol represents the escape sequences used to invoke the completion process, this is invoked with Alt-tab, but you can define other keys to do the same work (on those keyboard with tons of nice and unused keys everywhere). FILES Full paths below may vary between installations. They are also affected by the MC_DATADIR environment variable. If it's set, its value is used instead of /usr/share/mc in the paths below. /usr/share/mc/help/mc.hlp The help file for the program. /usr/share/mc/mc.ext The default system-wide extensions file. ~/.config/mc/mc.ext User's own extension, view configuration and edit configuration file. They override the contents of the system wide files if present. /etc/mc/mc.ini /usr/share/mc/mc.ini System-wide setup files for Midnight Commander, used only if the user doesn't have his own ~/.config/mc/ini file. If /etc/mc/mc.ini exists, /usr/share/mc/mc.ini isn't used. /usr/share/mc/mc.lib Global settings for Midnight Commander. Settings in this file affect all users, whether they have ~/.config/mc/ini or not. Currently, only terminal settings are loaded from mc.lib. ~/.config/mc/ini User's own setup. If this file is present then the setup is loaded from here instead of the system-wide startup file. /usr/share/mc/hints/mc.hint This file contains the hints displayed by the program. /usr/share/mc/mc.menu This file contains the default system-wide applications menu. ~/.config/mc/menu User's own application menu. If this file is present it is used instead of the sys‐ tem-wide applications menu. ~/.cache/mc/Tree The directory list for the directory tree and tree view features. ~/.local/share/mc.menu Local user-defined menu. If this file is present, it is used instead of the home or system-wide applications menu. To change default root directory of MC, you can use MC_PROFILE_ROOT environment variable. The value of MC_PROFILE_ROOT must be an absolute path. If MC_PROFILE_ROOT is unset or empty, HOME variable is used. If HOME is unset or empty, MC directories are get from GLib library. LICENSE This program is distributed under the terms of the GNU General Public License as published by the Free Software Foundation. See the built-in help for details on the License and the lack of warranty. AVAILABILITY The latest version of this program can be found at http://ftp.midnight-commander.org/. SEE ALSO ed(1), gpm(1), terminfo(1), view(1), sh(1), bash(1), tcsh(1), zsh(1). Midnight Commander's page on the World Wide Web: http://www.midnight-commander.org/ AUTHORS Authors and contributors are listed in the AUTHORS file in the source distribution. BUGS See the file TODO in the distribution for information on what remains to be done. If you want to report a problem with the program, please create bugreport at http://www.mid‐ night-commander.org/. Provide a detailed description of the bug, the version of the program you are running (mc -V displays this information), the operating system you are running the program on. If the pro‐ gram crashes, we would appreciate a stack trace. MC Version 4.8.27 August 2021 MC(1)
Generated by phpman v3.7.12 Author: Che Dong Under GNU General Public License
2026-06-13 17:55 @216.73.217.0
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)