1MCEDIT(1)                   GNU Midnight Commander                   MCEDIT(1)
2
3
4

NAME

6       mcedit - Internal file editor of GNU Midnight Commander.
7

USAGE

9       mcedit [-bcCdfhstVx?] [+lineno] [file1] [file2] ...
10
11       mcedit [-bcCdfhstVx?] file1:lineno[:] file2:lineno[:] ...
12

DESCRIPTION

14       mcedit  is  a  link  to mc, the main GNU Midnight Commander executable.
15       Executing GNU Midnight Commander under this name runs the internal edi‐
16       tor  and opens files specified on the command line. The editor is based
17       on the terminal version of cooledit - standalone editor  for  X  Window
18       System.
19

OPTIONS

21       +lineno
22              Go  to  the line specified by number (do not put a space between
23              the + sign and the number). Several line numbers are allowed but
24              only  the  last  one will be used, and it will be applied to the
25              first file only.
26
27       -b     Force black and white display.
28
29       -c     Force ANSI color mode on terminals that don't seem to have color
30              support.
31
32       -C <keyword>=<fgcolor>,<bgcolor>,<attributes>:<keyword>= ...
33              Specify  a different color set.  See the Colors section in mc(1)
34              for more information.
35
36       -d     Disable mouse support.
37
38       -f     Display the compiled-in search path for GNU  Midnight  Commander
39              data files.
40
41       -t     Force  using  termcap database instead of terminfo.  This option
42              is only applicable if GNU Midnight Commander was  compiled  with
43              S-Lang library with terminfo support.
44
45       -V     Display the version of the program.
46
47       -x     Force  xterm mode.  Used when running on xterm-capable terminals
48              (two screen modes, and able to send mouse escape sequences).
49

FEATURES

51       The internal file editor is a full-featured windowed  editor.   It  can
52       edit  several  files  at the same time. Maximum size of each file is 64
53       megabytes. It is  possible  to  edit  binary  files.  The  features  it
54       presently  supports  are: block copy, move, delete, cut, paste; key for
55       key undo; pull-down menus;  file  insertion;  macro  commands;  regular
56       expression  search  and replace; shift-arrow text highlighting (if sup‐
57       ported by the terminal); insert-overwrite toggle;  autoindent;  tunable
58       tab  size; syntax highlighting for various file types; and an option to
59       pipe text blocks through shell commands like indent and ispell.
60
61       Each file is opened in its own window in full-screen mode. Window  con‐
62       trol  in  mcedit is similar to the window control in other multi-window
63       program:  double  click  on  window  title  maximizes  the  window   to
64       full-screen  or restores window size and position; left-click on window
65       title and mouse drag moves the window in  editor  area;  left-click  on
66       low-right frame corner and mouse drag resizes the window. These actions
67       can be made using "Window" menu.
68

KEYS

70       The editor is easy to use  and  can  be  used  without  learning.   The
71       pull-down  menu  is  invoked  by pressing F9.  You can learn other keys
72       from the menu and from the button bar labels.
73
74       In addition to that, Shift combined with arrows does text  highlighting
75       (if   supported   by   the  terminal):  Ctrl-Ins  copies  to  the  file
76       ~/.cache/mc/mcedit/mcedit.clip,       Shift-Ins       pastes       from
77       ~/.cache/mc/mcedit/mcedit.clip,         Shift-Del        cuts        to
78       ~/.cache/mc/mcedit/mcedit.clip, and Ctrl-Del deletes highlighted  text.
79       Mouse  highlighting  also works on some terminals.  To use the standard
80       mouse support provided by your terminal, hold the  Shift  key.   Please
81       note that the mouse support in the terminal doesn't share the clipboard
82       with mcedit.
83
84       The completion key (usually Meta-Tab or Escape Tab) completes the  word
85       under the cursor using the words used in the file.
86

MACRO

88       To  define a macro, press Ctrl-R and then type out the keys you want to
89       be executed.  Press Ctrl-R again  when  finished.   The  macro  can  be
90       assigned  to  any key by pressing that key.  The macro is executed when
91       you press the assigned key.
92
93       The  macro  commands  are  stored  in  section  [editor]  it  the  file
94       ~/.local/share/mc/mc.macros.
95
96       External  scripts (filters) can be assigned into the any hotkey by edit
97       mc.macros like following:
98
99       [editor]
100       ctrl-W=ExecuteScript:25;
101
102       This means that ctrl-W hotkey initiates the  ExecuteScript(25)  action,
103       then    editor    handler    translates    this   into   execution   of
104       ~/.local/share/mc/mcedit/macros.d/macro.25.sh shell script.
105
106       External  scripts  are  stored  in   ~/.local/share/mc/mcedit/macros.d/
107       directory  and  must be named as macro.XXXX.sh where XXXX is the number
108       from 0 to 9999.  See Edit Menu File for more detail about format of the
109       script.
110
111       Following macro definition and directives can be used:
112
113       #silent
114              If this directive is set, then script starts without interactive
115              subshell.
116
117       %c     The cursor column position number.
118
119       %i     The indent of blank space, equal the cursor column.
120
121       %y     The syntax type of current file.
122
123       %b     The block file name.
124
125       %f     The current file name.
126
127       %n     Only the current file name without extension.
128
129       %x     The extension of current file name.
130
131       %d     The current directory name.
132
133       %F     The current file in the unselected panel.
134
135       %D     The directory name of the unselected panel.
136
137       %t     The currently tagged files.
138
139       %T     The tagged files in the unselected panel.
140
141       %u and %U
142              Similar to the %t and %T macros, but in addition the  files  are
143              untagged.  You  can use this macro only once per menu file entry
144              or extension file entry, because next  time  there  will  be  no
145              tagged files.
146
147       %s and %S
148              The selected files: The tagged files if there are any. Otherwise
149              the current file.
150
151       Feel free to edit this files, if you need.  Here is a  sample  external
152       script:
153
154       l       comment selection
155            TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1
156            echo #if 0 > $TMPFILE
157            cat %b >> $TMPFILE
158            echo #endif >> $TMPFILE
159            cat $TMPFILE > %b
160            rm -f $TMPFILE
161
162       If some keys don't work, you can use Learn Keys in the Options menu.
163

CODE NAVIGATION

165       mcedit  can be used for navigation through code with tags files created
166       by etags or ctags commands. If there is no TAGS  file  code  navigation
167       will  not work.  For example, in case of exuberant-ctags for C language
168       command will be:
169
170       ctags -e --language-force=C -R ./
171
172       Meta-Enter shows list box to select item under  cursor  (cursor  should
173       stand at the end of the word).
174
175       Meta-Minus where minus is symbol "-" goes to previous function in navi‐
176       gation list (like browser's Back button).
177
178       Meta-Equal where equal is symbol "=" goes to next function  in  naviga‐
179       tion list (like browser's Forward button).
180

SYNTAX HIGHLIGHTING

182       mcedit supports syntax highlighting.  This means that keywords and con‐
183       texts (like C comments, string constants, etc) are highlighted in  dif‐
184       ferent  colors.   The following section explains the format of the file
185       ~/.config/mc/mcedit/Syntax.   If  this  file  is  missing,  system-wide
186       /usr/share/mc/syntax/Syntax is used.  The file ~/.config/mc/mcedit/Syn‐
187       tax is rescanned on opening of every new editor file.   The  file  con‐
188       tains  rules  for  highlighting,  each  of which is given on a separate
189       line, and define which keywords will be highlighted with what color.
190
191       The file is divided into sections, each beginning with a line with  the
192       file  command.  The sections are normally put into separate files using
193       the include command.
194
195       The file command has three arguments.  The first argument is a  regular
196       expression that is applied to the file name to determine if the follow‐
197       ing section applies to the file.  The second argument is  the  descrip‐
198       tion  of  the  file  type.   It is used in cooledit; future versions of
199       mcedit may use it as well.  The third optional argument  is  a  regular
200       expression  to  match the first line of text of the file.  The rules in
201       the following section apply if either the file name or the  first  line
202       of text matches.
203
204       A  section  ends  with  the  start of another section.  Each section is
205       divided into contexts, and each context contains rules.  A context is a
206       scope  within  the text that a particular set of rules belongs to.  For
207       instance, the text within a C style comment (i.e. between  /*  and  */)
208       has its own color.  This is a context, although it has no further rules
209       inside it because there is probably nothing that  we  want  highlighted
210       within a C comment.
211
212       A trivial C programming section might look like this:
213
214       file .\*\\.c C\sProgram\sFile (#include|/\\\*)
215
216       wholechars abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_
217
218       # default colors
219       define  comment   brown
220       context default
221         keyword  whole  if       yellow
222         keyword  whole  else     yellow
223         keyword  whole  for      yellow
224         keyword  whole  while    yellow
225         keyword  whole  do       yellow
226         keyword  whole  switch   yellow
227         keyword  whole  case     yellow
228         keyword  whole  static   yellow
229         keyword  whole  extern   yellow
230         keyword         {        brightcyan
231         keyword         }        brightcyan
232         keyword         '*'      green
233
234       # C comments
235       context /\* \*/ comment
236
237       # C preprocessor directives
238       context linestart # \n red
239         keyword  \\\n  brightred
240
241       # C string constants
242       context " " green
243         keyword  %d    brightgreen
244         keyword  %s    brightgreen
245         keyword  %c    brightgreen
246         keyword  \\"   brightgreen
247
248       Each context starts with a line of the form:
249
250       context   [exclusive]  [whole|wholeright|wholeleft]  [linestart]  delim
251       [linestart] delim [foreground] [background] [attributes]
252
253       The first context is an exception.  It must start with the command
254
255       context default [foreground] [background] [attributes]
256
257       otherwise mcedit will report an error.  The linestart option  specifies
258       that  delim  must  start  at the beginning of a line.  The whole option
259       tells that delim must be a whole word.  To specify  that  a  word  must
260       begin  on  the  word  boundary  only  on the left side, you can use the
261       wholeleft option, and similarly a word that must end on the word bound‐
262       ary is specified by wholeright.
263
264       The  set  of  characters that constitute a whole word can be changed at
265       any point in the file with the wholechars command.  The left and  right
266       set of characters can be set separately with
267
268       wholechars [left|right] characters
269
270       The exclusive option causes the text between the delimiters to be high‐
271       lighted, but not the delimiters themselves.
272
273       Each rule is a line of the form:
274
275       keyword  [whole|wholeright|wholeleft]  [linestart]  string   foreground
276       [background] [attributes]
277
278       Context  or  keyword  strings  are interpreted, so that you can include
279       tabs and spaces with the sequences \t and \s.  Newlines and backslashes
280       are specified with \n and \\ respectively.  Since whitespace is used as
281       a separator, it may not be used as is.  Also, \* must be used to  spec‐
282       ify an asterisk.  The * itself is a wildcard that matches any length of
283       characters.  For example,
284
285         keyword         '*'      green
286
287       colors all C single character constants green.  You also could use
288
289         keyword         "*"      green
290
291       to color string constants, but the matched string would not be  allowed
292       to span across multiple newlines.  The wildcard may be used within con‐
293       text delimiters as well, but you cannot have a wildcard as the last  or
294       first character.
295
296       Important to note is the line
297
298         keyword  \\\n  brightgreen
299
300       This  line defines a keyword containing the backslash and newline char‐
301       acters.  Since the keywords are matched before the context  delimiters,
302       this  keyword  prevents the context from ending at the end of the lines
303       that end in a backslash, thus allowing C preprocessor directive to con‐
304       tinue across multiple lines.
305
306       The  possible  colors  are: black, gray, red, brightred, green, bright‐
307       green, brown, yellow, blue, brightblue, magenta,  brightmagenta,  cyan,
308       brightcyan,  lightgray  and  white. The special keyword "default" means
309       the terminal's default. Another special keyword "base" means mc's  main
310       colors, it is useful as a placeholder if you want to specify attributes
311       without modifying the background color. When 256 colors are  available,
312       they  can  be  specified either as color16 to color255, or as rgb000 to
313       rgb555 and gray0 to gray23.
314
315       If the syntax file is shared with cooledit, it is possible  to  specify
316       different  colors  for  mcedit  and  cooledit by separating them with a
317       slash, e.g.
318
319       keyword  #include  red/Orange
320
321       mcedit uses the color before the slash.  See cooledit(1) for  supported
322       cooledit colors.
323
324       Attributes  can  be  any of bold, italic, underline, reverse and blink,
325       appended by a plus sign if more than one are desired.
326
327       Comments may be put on a separate line starting with the hash sign (#).
328
329       If you are describing case insensitive language you need to use casein‐
330       sensitive  directive. It should be specified at the beginning of syntax
331       file.
332
333       Because of the simplicity of the implementation, there are a few intri‐
334       cacies  that  will  not  be  dealt with correctly but these are a minor
335       irritation.  On the whole, a broad spectrum of quite complicated situa‐
336       tions are handled with these simple rules.  It is a good idea to take a
337       look at the syntax file to see some of the nifty tricks you can do with
338       a  little  imagination.   If  you  cannot  get by with the rules I have
339       coded, and you think you have a rule that would be useful, please email
340       me  with your request.  However, do not ask for regular expression sup‐
341       port, because this is flatly impossible.
342
343       A useful hint is to work with as much as possible with the  things  you
344       can  do  rather  than  try to do things that this implementation cannot
345       deal with.  Also remember that the aim of  syntax  highlighting  is  to
346       make programming less prone to error, not to make code look pretty.
347
348       The syntax highlighting can be toggled using Ctrl-s shortcut.
349

COLORS

351       The  default  colors  may be changed by appending to the MC_COLOR_TABLE
352       environment variable.  Foreground and background colors  pairs  may  be
353       specified for example with:
354
355       MC_COLOR_TABLE="$MC_COLOR_TABLE:\
356       editnormal=lightgray,black:\
357       editbold=yellow,black:\
358       editmarked=black,cyan"
359

OPTIONS

361       Most options can be set from Options dialog box.  See the Options menu.
362       The following options are defined in ~/.config/mc/ini and have  obvious
363       counterparts in the dialog box.  You can modify them to change the edi‐
364       tor behavior, by editing the file.  Unless  specified,  a  1  sets  the
365       option to on, and a 0 sets it to off, as usual.
366
367       use_internal_edit
368              This option is ignored when invoking mcedit.
369
370       editor_tab_spacing
371              Interpret the tab character as being of this length.  Default is
372              8. You should avoid using other than 8 since most other  editors
373              and   text   viewers  assume  a  tab  spacing  of  8.  Use  edi‐
374              tor_fake_half_tabs to simulate a smaller tab spacing.
375
376       editor_fill_tabs_with_spaces
377              Never insert a tab character. Rather insert spaces (ascii 32) to
378              fill to the desired tab size.
379
380       editor_return_does_auto_indent
381              Pressing  return will tab across to match the indentation of the
382              first line above that has text on it.
383
384       editor_backspace_through_tabs
385              Make a single backspace delete all the space to the left  margin
386              if there is no text between the cursor and the left margin.
387
388       editor_fake_half_tabs
389              This  will emulate a half tab for those who want to program with
390              a tab spacing of 4, but do not want the tab size changed from  8
391              (so  that  the code will be formatted the same when displayed by
392              other programs). When editing between text and the left  margin,
393              moving  and  tabbing will be as though a tab space were 4, while
394              actually using spaces and normal tabs for an optimal fill.  When
395              editing anywhere else, a normal tab is inserted.
396
397       editor_option_save_mode
398              Possible values 0, 1 and 2.  The save mode (see the options menu
399              also) allows you to change the method of saving a  file.   Quick
400              save (0) saves the file immediately, truncating the disk file to
401              zero length (i.e.  erasing it) and then writing the editor  con‐
402              tents  to the file.  This method is fast, but dangerous, since a
403              system error during a file save will leave the  file  only  par‐
404              tially written, possibly rendering the data irretrievable.  When
405              saving, the safe save (1) option enables creation of a temporary
406              file  into  which  the  file contents are first written.  In the
407              event of a problem, the original file is  untouched.   When  the
408              temporary  file  is  successfully  written, it is renamed to the
409              name of the original file, thus replacing it.  The safest method
410              is  create  backups  (2):  a  backup  file is created before any
411              changes are made.  You can specify your own backup  file  exten‐
412              sion  in  the  dialog.  Note that saving twice will replace your
413              backup as well as your original file.
414
415       editor_word_wrap_line_length
416              Line length to wrap at. Default is 72.
417
418       editor_backup_extension
419              Symbol to add to name of backup files. Default is "~".
420
421       editor_line_state
422              Show state line of editor. Currently it shows current line  num‐
423              ber  (in  the  future  it might show things like folding, break‐
424              points, etc.). M-n toggles this option.
425
426       editor_visible_spaces
427              Toggle "show visible trailing spaces".   If  editor_visible_spa‐
428              ces=1, they are shown as '.'
429
430       editor_visible_tabs
431              Toggle  "show visible tabs".  If editor_visible_tabs=1, tabs are
432              shown as '<---->'
433
434       editor_persistent_selections
435              Do not remove block selection after cursor movement.
436
437       editor_drop_selection_on_copy
438              Reset selection after copy to clipboard.
439
440       editor_cursor_beyond_eol
441              Allow moving cursor beyond the end of line.
442
443       editor_cursor_after_inserted_block
444              Allow moving cursor after inserted block.
445
446       editor_syntax_highlighting
447              enable syntax highlighting.
448
449       editor_edit_confirm_save
450              Show confirmation dialog on save.
451
452       editor_option_typewriter_wrap
453              to be described
454
455       editor_option_auto_para_formatting
456              to be described
457
458       editor_option_save_position
459              Save file position on exit.
460
461       source_codepage
462              Symbol representation of codepage name for file (i.e. CP1251,  ~
463              - default).
464
465       editor_group_undo
466              Combine  UNDO  actions  for  several  of the same type of action
467              (inserting/overwriting, deleting, navigating, typing)
468
469       editor_wordcompletion_collect_entire_file
470              Search autocomplete candidates in entire file (1) or  just  from
471              beginning of file to cursor position (0).
472
473       spell_language
474              Spelling  language  (en,  en-variant_0,  ru, etc) installed with
475              aspell package (a full list can be obtained using 'aspell' util‐
476              ity).   Use  spell_language  =  NONE  to disable aspell support.
477              Default value is 'en'. Option must be located in the [Misc] sec‐
478              tion.
479
480       editor_stop_format_chars
481              Set  of characters to stop paragraph formatting. If one of those
482              characters is found in the beginning of line, that line and  all
483              following lines of paragraph will be untouched. Default value is
484              "-+*\,.;:&>".
485
486       editor_state_full_filename
487              Show full path name in the status line. If  disabled  (default),
488              only base name of the file is shown.
489

MISCELLANEOUS

491       The editor also displays non-us characters (160+).  When editing binary
492       files, you should set display bits to 7 bits  in  Midnight  Commander's
493       options menu to keep the spacing clean.
494

FILES

496       /usr/share/mc/help/mc.hlp
497
498              The help file for the program.
499
500       /usr/share/mc/mc.ini
501
502              The  default  system-wide setup for GNU Midnight Commander, used
503              only if the user's own ~/.config/mc/ini file is missing.
504
505       /usr/share/mc/mc.lib
506
507              Global settings for Midnight Commander. Settings  in  this  file
508              affect all users, whether they have ~/.config/mc/ini or not.
509
510       /usr/share/mc/syntax/*
511
512              The  default  system-wide  syntax files for mcedit, used only if
513              the corresponding user's own ~/.local/share/mc/mcedit/  file  is
514              missing.
515
516       ~/.config/mc/ini
517
518              User's  own  setup.   If  this file is present then the setup is
519              loaded from here instead of the system-wide setup file.
520
521       ~/.local/share/mc/mcedit/
522
523              User's own directory where  block  commands  are  processed  and
524              saved and user's own syntax files are located.
525

LICENSE

527       This  program  is distributed under the terms of the GNU General Public
528       License as published by the Free Software Foundation.  See the built-in
529       help  of  Midnight Commander for details on the License and the lack of
530       warranty.
531

AVAILABILITY

533       The latest version of this program  can  be  found  at  http://ftp.mid
534       night-commander.org/.
535

SEE ALSO

537       cooledit(1), mc(1), gpm(1), terminfo(1), scanf(3).
538

AUTHORS

540       Paul  Sheer  (psheer@obsidian.co.za) is the original author of Midnight
541       Commander's internal editor.
542

BUGS

544       Bugs should be reported to http://www.midnight-commander.org/.
545
546
547
548MC Version 4.8.23                  June 2019                         MCEDIT(1)
Impressum