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] file
10
11       mcedit [-bcCdfhstVx?] file:lineno[:]
12

DESCRIPTION

14       mcedit  is  a  link  to mc, the main GNU Midnight Commander executable.
15       Executing GNU Midnight Commander under this name requests  staring  the
16       internal  editor  and  opening  the file specified on the command line.
17       The editor is based on the terminal version of  cooledit  -  standalone
18       editor for X Window 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).
24
25       -b     Force black and white display.
26
27       -c     Force ANSI color mode on terminals that don't seem to have color
28              support.
29
30       -C <keyword>=<FGcolor>,<BGcolor>:<keyword>= ...
31              Specify  a different color set.  See the Colors section in mc(1)
32              for more information.
33
34       -d     Disable mouse support.
35
36       -f     Display the compiled-in search path for GNU  Midnight  Commander
37              data files.
38
39       -t     Force  using  termcap database instead of terminfo.  This option
40              is only applicable if GNU Midnight Commander was  compiled  with
41              S-Lang library with terminfo support.
42
43       -V     Display the version of the program.
44
45       -x     Force  xterm mode.  Used when running on xterm-capable terminals
46              (two screen modes, and able to send mouse escape sequences).
47

FEATURES

49       The internal file editor is a full-featured full screen editor.  It can
50       edit  files  up  to 64 megabytes.  It is possible to edit binary files.
51       The features it presently supports are: block copy, move, delete,  cut,
52       paste;  key  for  key undo; pull-down menus; file insertion; macro com‐
53       mands; regular expression search and replace (and our own  scanf-printf
54       search and replace); shift-arrow text highlighting (if supported by the
55       terminal); insert-overwrite toggle; word wrap; autoindent; tunable  tab
56       size; syntax highlighting for various file types; and an option to pipe
57       text blocks through shell commands like indent and ispell.
58

KEYS

60       The editor is easy to use  and  can  be  used  without  learning.   The
61       pull-down  menu  is  invoked  by pressing F9.  You can learn other keys
62       from the menu and from the button bar labels.
63
64       In addition to that, Shift combined with arrows does text  highlighting
65       (if   supported   by   the  terminal):  Ctrl-Ins  copies  to  the  file
66       ~/.mc/cedit/cooledit.clip,        Shift-Ins         pastes         from
67       ~/.mc/cedit/cooledit.clip, Shift-Del cuts to ~/.mc/cedit/cooledit.clip,
68       and Ctrl-Del deletes highlighted text.  Mouse highlighting  also  works
69       on  some terminals.  To use the standard mouse support provided by your
70       terminal, hold the Shift key.  Please note that the  mouse  support  in
71       the terminal doesn't share the clipboard with mcedit.
72
73       The  completion key (usually Meta-Tab or Escape Tab) completes the word
74       under the cursor using the words used earlier in the file.
75
76       To define a macro, press Ctrl-R and then type out the keys you want  to
77       be  executed.   Press  Ctrl-R again when finished.  You can then assign
78       the macro to any key you like by pressing that key.  The macro is  exe‐
79       cuted  when  you  press Ctrl-A and then the assigned key.  The macro is
80       also executed if you press Meta, Ctrl, or Esc  and  the  assigned  key,
81       provided  that  the  key is not used for any other function.  The macro
82       commands are stored in the file  ~/.mc/cedit/cooledit.macros.   Do  NOT
83       edit this file if you are going to use macros again in the same editing
84       session, because mcedit caches macro key defines in memory.  mcedit now
85       overwrites  a macro if a macro with the same key already exists, so you
86       won't have to edit this file. You will also have to restart other  run‐
87       ning editors for macros to take effect.
88
89       F19  will  format C, C++, Java or HTML code when it is highlighted.  An
90       executable file called ~/.mc/cedit/edit.indent.rc will be  created  for
91       you from the default template.  Feel free to edit it if you need.
92
93       C-p  will  run  ispell on a block of text in a similar way.  The script
94       file will be called ~/.mc/cedit/edit.spell.rc.
95
96       If some keys don't work, you can use Learn Keys in the Options menu.
97

CODE NAVIGATION

99       mcedit can be used to navigation through code with tags  files  created
100       by  etags  or  ctags commands. If there is no file TAGS code navigation
101       would not work.  In example, in case of exuberant-ctags for C  language
102       command will be:
103
104       ctags -e --language-force=C -R ./
105
106       Meta-Enter  show  list  box  to  select item under cursor (cusor should
107       stand at end of word).
108
109       Meta-Minus where minus is symbol "-" go to previous function in naviga‐
110       tion list (like a browser Back).
111
112       Meta-Equal  where equal is symbol "=" go to next function in navigation
113       list (like a browser Forward).
114

SYNTAX HIGHLIGHTING

116       mcedit supports syntax highlighting.  This means that keywords and con‐
117       texts  (like C comments, string constants, etc) are highlighted in dif‐
118       ferent colors.  The following section explains the format of  the  file
119       ~/.mc/cedit/Syntax.     If    this   file   is   missing,   system-wide
120       /usr/share/mc/syntax/Syntax is used.  The  file  ~/.mc/cedit/Syntax  is
121       rescanned on opening of a any new editor file.  The file contains rules
122       for highlighting, each of which is given on a separate line, and define
123       which keywords will be highlighted to what color.
124
125       The  file is divided into sections, each beginning with a line with the
126       file command.  The sections are normally put into separate files  using
127       the include command.
128
129       The  file command has three arguments.  The first argument is a regular
130       expression that is applied to the file name to determine if the follow‐
131       ing  section  applies to the file.  The second argument is the descrip‐
132       tion of the file type.  It is used  in  cooledit;  future  versions  of
133       mcedit  may  use  it as well.  The third optional argument is a regular
134       expression to match the first line of text of the file.  The  rules  in
135       the  following  section apply if either the file name or the first line
136       of text matches.
137
138       A section ends with the start of  another  section.   Each  section  is
139       divided into contexts, and each context contains rules.  A context is a
140       scope within the text that a particular set of rules belongs  to.   For
141       instance,  the  text  within a C style comment (i.e. between /* and */)
142       has its own color.  This is a context, although it has no further rules
143       inside  it  because  there is probably nothing that we want highlighted
144       within a C comment.
145
146       A trivial C programming section might look like this:
147
148       file .\*\\.c C\sProgram\sFile (#include|/\\\*)
149
150       wholechars abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_
151
152       # default colors
153       define  comment   brown
154       context default
155         keyword  whole  if       yellow
156         keyword  whole  else     yellow
157         keyword  whole  for      yellow
158         keyword  whole  while    yellow
159         keyword  whole  do       yellow
160         keyword  whole  switch   yellow
161         keyword  whole  case     yellow
162         keyword  whole  static   yellow
163         keyword  whole  extern   yellow
164         keyword         {        brightcyan
165         keyword         }        brightcyan
166         keyword         '*'      green
167
168       # C comments
169       context /\* \*/ comment
170
171       # C preprocessor directives
172       context linestart # \n red
173         keyword  \\\n  brightred
174
175       # C string constants
176       context " " green
177         keyword  %d    brightgreen
178         keyword  %s    brightgreen
179         keyword  %c    brightgreen
180         keyword  \\"   brightgreen
181
182       Each context starts with a line of the form:
183
184       context  [exclusive]  [whole|wholeright|wholeleft]  [linestart]   delim
185       [linestart] delim [foreground] [background]
186
187       The first context is an exception.  It must start with the command
188
189       context default [foreground] [background]
190
191       otherwise  mcedit will report an error.  The linestart option specifies
192       that delim must start at the beginning of a  line.   The  whole  option
193       tells  that  delim  must  be a whole word.  To specify that a word must
194       begin on the word boundary only on the  left  side,  you  can  use  the
195       wholeleft option, and similarly a word that must end on the word bound‐
196       ary is specified by wholeright.
197
198       The set of characters that constitute a whole word can  be  changed  at
199       any  point in the file with the wholechars command.  The left and right
200       set of characters can be set separately with
201
202       wholechars [left|right] characters
203
204       The exclusive option causes the text between the delimiters to be high‐
205       lighted, but not the delimiters themselves.
206
207       Each rule is a line of the form:
208
209       keyword   [whole|wholeright|wholeleft]  [linestart]  string  foreground
210       [background]
211
212       Context or keyword strings are interpreted, so  that  you  can  include
213       tabs and spaces with the sequences \t and \s.  Newlines and backslashes
214       are specified with \n and \\ respectively.  Since whitespace is used as
215       a  separator, it may not be used as is.  Also, \* must be used to spec‐
216       ify an asterisk.  The * itself is a wildcard that matches any length of
217       characters.  For example,
218
219         keyword         '*'      green
220
221       colors all C single character constants green.  You also could use
222
223         keyword         "*"      green
224
225       to  color string constants, but the matched string would not be allowed
226       to span across multiple newlines.  The wildcard may be used within con‐
227       text  delimiters as well, but you cannot have a wildcard as the last or
228       first character.
229
230       Important to note is the line
231
232         keyword  \\\n  brightgreen
233
234       This line defines a keyword containing the backslash and newline  char‐
235       acters.   Since the keywords are matched before the context delimiters,
236       this keyword prevents the context from ending at the end of  the  lines
237       that end in a backslash, thus allowing C preprocessor directive to con‐
238       tinue across multiple lines.
239
240       The possible colors are: black, gray, red,  brightred,  green,  bright‐
241       green,  brown,  yellow, blue, brightblue, magenta, brightmagenta, cyan,
242       brightcyan, lightgray and white.  If the syntax  file  is  shared  with
243       cooledit,  it  is  possible  to specify different colors for mcedit and
244       cooledit by separating them with a slash, e.g.
245
246       keyword  #include  red/Orange
247
248       mcedit uses the color before the slash.  See cooledit(1) for  supported
249       cooledit colors.
250
251       Comments may be put on a separate line starting with the hash sign (#).
252
253       If you are describing case insensitive language you need to use casein‐
254       sensitive derective. It should be specified at the begining  of  syntax
255       file.
256
257       Because of the simplicity of the implementation, there are a few intri‐
258       cacies that will not be dealt with correctly  but  these  are  a  minor
259       irritation.  On the whole, a broad spectrum of quite complicated situa‐
260       tions are handled with these simple rules.  It is a good idea to take a
261       look at the syntax file to see some of the nifty tricks you can do with
262       a little imagination.  If you cannot get  by  with  the  rules  I  have
263       coded, and you think you have a rule that would be useful, please email
264       me with your request.  However, do not ask for regular expression  sup‐
265       port, because this is flatly impossible.
266
267       A  useful  hint is to work with as much as possible with the things you
268       can do rather than try to do things  that  this  implementation  cannot
269       deal  with.   Also  remember  that the aim of syntax highlighting is to
270       make programming less prone to error, not to make code look pretty.
271
272       The syntax highlighting can be toggled using Ctrl-s shortcut.
273

COLORS

275       The default colors may be changed by appending  to  the  MC_COLOR_TABLE
276       environment  variable.   Foreground  and background colors pairs may be
277       specified for example with:
278
279       MC_COLOR_TABLE="$MC_COLOR_TABLE:\
280       editnormal=lightgray,black:\
281       editbold=yellow,black:\
282       editmarked=black,cyan"
283

OPTIONS

285       Most options can now be set from the editors options dialog  box.   See
286       the  Options  menu.  The following options are defined in ~/.mc/ini and
287       have obvious counterparts in the dialog box.  You can  modify  them  to
288       change the editor behavior, by editing the file.  Unless specified, a 1
289       sets the option to on, and a 0 sets it to off, as is usual.
290
291       use_internal_edit
292              This option is ignored when invoking mcedit.
293
294       editor_tab_spacing
295              Interpret the tab character as being of this length.  Default is
296              8.  You should avoid using other than 8 since most other editors
297              and  text  viewers  assume  a  tab  spacing  of  8.   Use   edi‐
298              tor_fake_half_tabs to simulate a smaller tab spacing.
299
300       editor_fill_tabs_with_spaces
301              Never  insert  a  tab space. Rather insert spaces (ascii 20h) to
302              fill to the desired tab size.
303
304       editor_return_does_auto_indent
305              Pressing return will tab across to match the indentation of  the
306              first line above that has text on it.
307
308       editor_backspace_through_tabs
309              Make  a single backspace delete all the space to the left margin
310              if there is no text between the cursor and the left margin.
311
312       editor_fake_half_tabs
313              This will emulate a half tab for those who want to program  with
314              a  tab spacing of 4, but do not want the tab size changed from 8
315              (so that the code will be formatted the same when  displayed  by
316              other  programs). When editing between text and the left margin,
317              moving and tabbing will be as though a tab space were  4,  while
318              actually using spaces and normal tabs for an optimal fill.  When
319              editing anywhere else, a normal tab is inserted.
320
321       editor_option_save_mode
322              Possible values 0, 1 and 2.  The save mode (see the options menu
323              also)  allows  you to change the method of saving a file.  Quick
324              save (0) saves the file by immediately, truncating the disk file
325              to  zero  length  (i.e.   erasing it) and the writing the editor
326              contents to the file.  This method is fast, but dangerous, since
327              a  system error during a file save will leave the file only par‐
328              tially written, possibly rendering the data irretrievable.  When
329              saving, the safe save (1) option enables creation of a temporary
330              file into which the file contents are  first  written.   In  the
331              event  of  an problem, the original file is untouched.  When the
332              temporary file is successfully written, it  is  renamed  to  the
333              name of the original file, thus replacing it.  The safest method
334              is create backups (2).  Where a backup file  is  created  before
335              any  changes  are  made.   You  can specify your own backup file
336              extension in the dialog.  Note that saving  twice  will  replace
337              your backup as well as your original file.
338
339       editor_word_wrap_line_length
340              line length to wrap. 72 default.
341
342       editor_backup_extension
343              symbol for add extension to name of backup files. Default "~".
344
345       editor_line_state
346              show  state  line  of editor now it show number of file line (in
347              future it can show things like folding, breakpoints, etc.).  M-n
348              toglle this option.
349
350       editor_visible_spaces
351              Toggle  show  visible  trailing  spaces  (TWS),  if editor_visi‐
352              ble_spaces=1 TWS showed as '.'
353
354       editor_visible_tabs
355              Toggle show visible tabs, if editor_visible_tabs=1  tabs  showed
356              as '<---->'
357
358       editor_persistent_selections
359              Do not remove block selection after moving the cursor.
360
361       editor_cursor_beyond_eol
362              Allow moving cursor beyond the end of line.
363
364       editor_syntax_highlighting
365              enable syntax highlighting.
366
367       editor_edit_confirm_save
368              show confirm dialog on save.
369
370       editor_option_typewriter_wrap
371              to be described
372
373       editor_option_auto_para_formatting
374              to be described
375
376       editor_option_save_position
377              save file position on exit.
378
379       source_codepage
380              symbol  representation of codepage name for file (i.e. CP1251, ~
381              - default).
382
383       editor_wordcompletion_collect_entire_file
384              Search autocomplete candidates in entire of file  or  just  from
385              begin of file to cursor position (0)
386
387

MISCELLANEOUS

389       You  can  use scanf search and replace to search and replace a C format
390       string.  First take a look at the sscanf and sprintf man pages  to  see
391       what  a  format string is and how it works.  Here's an example: suppose
392       that you want to replace all occurrences  of  an  open  bracket,  three
393       comma separated numbers, and a close bracket, with the word apples, the
394       third number, the word oranges and then the second number.   You  would
395       fill in the Replace dialog box as follows:
396
397       Enter search string
398       (%d,%d,%d)
399       Enter replace string
400       apples %d oranges %d
401       Enter replacement argument order
402       3,2
403
404       The  last  line specifies that the third and then the second number are
405       to be used in place of the first and second.
406
407       It is advisable to use this feature with Prompt On Replace on,  because
408       a  match  is thought to be found whenever the number of arguments found
409       matches the number given, which is not always a real match. Scanf  also
410       treats  whitespace  as being elastic.  Note that the scanf format %[ is
411       very useful for scanning strings, and whitespace.
412
413       The editor also displays non-us characters (160+).  When editing binary
414       files,  you should set display bits to 7 bits in the Midnight Commander
415       options menu to keep the spacing clean.
416

FILES

418       /usr/share/mc/mc.hlp
419
420              The help file for the program.
421
422       /usr/share/mc/mc.ini
423
424              The default system-wide setup for GNU Midnight  Commander,  used
425              only if the user's own ~/.mc/ini file is missing.
426
427       /usr/share/mc/mc.lib
428
429              Global  settings  for  the Midnight Commander.  Settings in this
430              file affect all users, whether they have ~/.mc/ini or not.
431
432       /usr/share/mc/syntax/*
433
434              The default system-wide syntax files for mcedit,  used  only  if
435              the corresponding user's own ~/.mc/cedit/ file is missing.
436
437       $HOME/.mc/ini
438
439              User's  own  setup.   If  this file is present then the setup is
440              loaded from here instead of the system-wide setup file.
441
442       $HOME/.mc/cedit/
443
444              User's own directory where  block  commands  are  processed  and
445              saved and user's own syntax files are located.
446

LICENSE

448       This  program  is distributed under the terms of the GNU General Public
449       License as published by the Free Software Foundation.  See the built-in
450       help  of the Midnight Commander for details on the License and the lack
451       of warranty.
452

AVAILABILITY

454       The latest version of this program can be found at http://midnight-com
455       mander.org/.
456

SEE ALSO

458       cooledit(1), mc(1), gpm(1), terminfo(1), scanf(3).
459

AUTHORS

461       Paul  Sheer  (psheer@obsidian.co.za) is the original author of the Mid‐
462       night Commander's internal editor.
463

BUGS

465       Bugs should be reported to mc-devel@gnome.org
466
467
468
469MC Version 4.7.5.5            @DATE_OF_MAN_PAGE@                     MCEDIT(1)
Impressum