Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
The ONE Campaign to make poverty history

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
Copyright Info
Terms of Use
Privacy Info
Masthead / Impressum
Your Account

Private Messages

News Archive
Submit News
User Articles
Web Links


The Web

Who's Online
There are currently, 217 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here




       mcedit [-bcCdfhstVx?] [+number] file


       mcedit  is  a  link to mc, the main GNU Midnight Commander
       executable.  Executing GNU Midnight Commander  under  this
       name  requests staring the internal editor and opening the
       file specified on the command line.  The editor  is  based
       on  the  terminal  version of cooledit - standalone editor
       for X Window System.


              Go  to the line specified by number (do not  put  a
              space between the + sign and the number).

       -b     Force black and white display.

       -c     Force  ANSI color mode on terminals that don't seem
              to have color support.

       -C <keyword>=<FGcolor>,<BGcolor>:<keyword>= ...
              Specify a different color set.  See the Colors sec­
              tion in mc(1) for more information.

       -d     Disable mouse support.

       -f     Display  the  compiled-in  search path for GNU Mid­
              night Commander data files.

       -t     Force using termcap database instead  of  terminfo.
              This option is only applicable if GNU Midnight Com­
              mander was compiled with S-Lang library  with  ter­
              minfo support.

       -V     Display the version of the program.

       -x     Force xterm mode.  Used when running on xterm-capa­
              ble terminals (two screen modes, and able  to  send
              mouse escape sequences).


       The  internal  file  editor is a full-featured full screen
       editor.  It can edit files up to 64 megabytes.  It is pos­
       sible  to  edit  binary  files.  The features it presently
       supports are: block copy, move, delete,  cut,  paste;  key
       for  key undo; pull-down menus; file insertion; macro com­
       mands; regular expression search and replace (and our  own
       scanf-printf  search  and replace); shift-arrow text high­
       lighting (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
       minals.   To  use  the  standard mouse support provided by
       your terminal, hold the Shift key.  Please note  that  the
       mouse  support in the terminal doesn't share the clipboard
       with mcedit.

       The completion key (usually Alt-Tab or  Escape  Tab)  com­
       pletes the word under the cursor using the words used ear­
       lier in the file.

       To define a macro, press Ctrl-R and then type out the keys
       you  want  to  be  executed.  Press Ctrl-R again when fin­
       ished.  You can then assign the macro to any key you  like
       by  pressing  that  key.   The  macro is executed when you
       press Ctrl-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 func­
       tion.    The   macro  commands  are  stored  in  the  file
       ~/.mc/cedit/cooledit.macros.  Do NOT edit this file if you
       are going to use macros again in the same editing session,
       because mcedit caches macro key defines in memory.  mcedit
       now  overwrites  a  macro  if  a  macro  with the same key
       already exists, so you won't have to edit this  file.  You
       will also have to restart other running editors for macros
       to take effect.

       F19 will format C, C++, Java or HTML code when it is high­
       lighted.        An       executable       file      called
       ~/.mc/cedit/edit.indent.rc will be created  for  you  from
       the default template.  Feel free to edit it if you need.

       C-p  will  run ispell on a block of text in a similar way.
       The script file will be called  ~/.mc/cedit/edit.spell.rc.

       If  some  keys  don't  work, you can use Learn Keys in the
       Options menu.


       mcedit supports syntax highlighting.  This means that key­
       words  and  contexts  (like  C comments, string constants,
       etc) are highlighted in different colors.   The  following
       section  explains  the format of the file ~/.mc/cedit/Syn­
       tax.  The file ~/.mc/cedit/Syntax is rescanned on  opening
       of  a  any  new  editor file.  The file contains rules for
       highlighting, each of which is given on a  separate  line,
       and  define  which  keywords  will  be highlighted to what

       The file is divided into sections, each beginning  with  a
       line with the file command.  The sections are normally put
       into separate files using the include command.

       The file command has three arguments.  The first  argument
       its own color.  This is a context, although it has no fur­
       ther rules inside it because  there  is  probably  nothing
       that we want highlighted within a C comment.

       A trivial C programming section might look like this:

       file .\*\\.c C\sProgram\sFile (#include|/\\\*)

       wholechars abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_

       # default colors
       context default
         keyword  whole  if       yellow
         keyword  whole  else     yellow
         keyword  whole  for      yellow
         keyword  whole  while    yellow
         keyword  whole  do       yellow
         keyword  whole  switch   yellow
         keyword  whole  case     yellow
         keyword  whole  static   yellow
         keyword  whole  extern   yellow
         keyword         {        brightcyan
         keyword         }        brightcyan
         keyword         '*'      green

       # C comments
       context /\* \*/ brown

       # C preprocessor directives
       context linestart # \n red
         keyword  \\\n  brightred

       # C string constants
       context " " green
         keyword  %d    brightgreen
         keyword  %s    brightgreen
         keyword  %c    brightgreen
         keyword  \\"   brightgreen

       Each context starts with a line of the form:

       context  [exclusive]  [whole|wholeright|wholeleft] [lines­
       tart] delim [linestart] delim [foreground] [background]

       The first context is an exception.  It must start with the

       context default [foreground] [background]

       otherwise  mcedit  will  report  an  error.  The linestart
       option specifies that delim must start at the beginning of
       a line.  The whole option tells that delim must be a whole

       Each rule is a line of the form:

       keyword  [whole|wholeright|wholeleft]  [linestart]  string
       foreground [background]

       Context  or  keyword  strings are interpreted, so that you
       can include tabs and spaces with the sequences \t and  \s.
       Newlines  and  backslashes  are  specified  with \n and \\
       respectively.  Since whitespace is used as a separator, it
       may  not  be used as is.  Also, \* must be used to specify
       an asterisk.  The * itself is a wildcard that matches  any
       length of characters.  For example,

         keyword         '*'      green

       colors  all  C single character constants green.  You also
       could use

         keyword         "*"      green

       to color string constants, but the  matched  string  would
       not  be  allowed  to  span  across multiple newlines.  The
       wildcard may be used within context  delimiters  as  well,
       but  you cannot have a wildcard as the last or first char­

       Important to note is the line

         keyword  \\\n  brightgreen

       This line defines a keyword containing the  backslash  and
       newline characters.  Since the keywords are matched before
       the context delimiters, this keyword prevents the  context
       from  ending  at  the end of the lines that end in a back­
       slash, thus allowing C preprocessor directive to  continue
       across multiple lines.

       The  possible  colors  are:  black,  gray, red, brightred,
       green,  brightgreen,  brown,  yellow,  blue,   brightblue,
       magenta,  brightmagenta,  cyan,  brightcyan, lightgray and
       white.  If the syntax file is shared with cooledit, it  is
       possible  to  specify  different  colors  for  mcedit  and
       cooledit by separating them with a slash, e.g.

       keyword  #include  red/Orange

       mcedit uses the color before the slash.   See  cooledit(1)
       for supported cooledit colors.

       Comments  may  be put on a separate line starting with the
       A useful hint is to work with as much as possible with the
       things  you  can do rather than try to do things that this
       implementation cannot deal with.  Also remember  that  the
       aim  of  syntax  highlighting  is to make programming less
       prone to error, not to make code look pretty.


       The default colors may be  changed  by  appending  to  the
       MC_COLOR_TABLE environment variable.  Foreground and back­
       ground colors pairs may be specified for example with:



       Most options can now be set from the editors options  dia­
       log box.  See the Options menu.  The following options are
       defined in ~/.mc/ini and have obvious counterparts in  the
       dialog  box.   You  can  modify  them to change the editor
       behavior, by editing the file.  Unless specified, a 1 sets
       the option to on, and a 0 sets it to off, as is usual.

              This option is ignored when invoking mcedit.

              1 for Emacs keys, and 0 for normal Cooledit keys.

              Interpret  the  tab  character  as  being  of  this
              length.  Default is 8. You should avoid using other
              than  8  since  most other editors and text viewers
              assume   a   tab   spacing   of   8.    Use    edi­
              tor_fake_half_tabs  to simulate a smaller tab spac­

              Never insert a  tab  space.  Rather  insert  spaces
              (ascii 20h) to fill to the desired tab size.

              Pressing return will tab across to match the inden­
              tation of the first line above that has text on it.

              Make a single backspace delete all the space to the
              left margin if there is no text between the  cursor
              and the left margin.

              immediately,  truncating  the  disk  file  to  zero
              length  (i.e.  erasing it) and the writing the edi­
              tor contents to the file.  This method is fast, but
              dangerous,  since a system error during a file save
              will leave the file only partially written,  possi­
              bly rendering the data irretrievable.  When saving,
              the safe save (1) option enables creation of a tem­
              porary  file into which the file contents are first
              written.  In the event of an problem, the  original
              file is untouched.  When the temporary file is suc­
              cessfully written, it is renamed to the name of the
              original  file,  thus  replacing  it.   The  safest
              method is create backups (2).  Where a backup  file
              is  created  before  any changes are made.  You can
              specify your own backup file extension in the  dia­
              log.   Note  that  saving  twice  will replace your
              backup as well as your original file.


       You can use scanf search and replace to search and replace
       a  C  format  string.  First take a look at the sscanf and
       sprintf man pages to see what a format string is  and  how
       it  works.   Here's  an  example: suppose that you want to
       replace all occurrences of an open  bracket,  three  comma
       separated  numbers,  and  a  close  bracket, with the word
       apples, the third number, the word oranges  and  then  the
       second  number.   You would fill in the Replace dialog box
       as follows:

       Enter search string
       Enter replace string
       apples %d oranges %d
       Enter replacement argument order

       The last line specifies that the third and then the second
       number are to be used in place of the first and second.

       It is advisable to use this feature with Prompt On Replace
       on, because a match is thought to be  found  whenever  the
       number  of arguments found matches the number given, which
       is not always a real match. Scanf also  treats  whitespace
       as  being  elastic.  Note that the scanf format %[ is very
       useful for scanning strings, and whitespace.

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


              have ~/.mc/ini or not.


              User's  own  setup.   If  this file is present, the
              setup is loaded from here instead  of  the  system-
              wide startup file.


              User's  own setup. If this file is present then the
              setup is loaded from here instead  of  the  system-
              wide startup file.


              User's own temporary directory where block commands
              are processed and saved.


       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 of the Midnight Comman­
       der for details on the License and the lack of warranty.


       The  latest  version  of  this  program  can  be  found at


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


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


       Bugs should be reported to mc-devel@gnome.org

MC Version 4.6.0           January 2003                 MCEDIT(1)
Show your Support for the Linux Tutorial

Purchase one of the products from our new online shop. For each product you purchase, the Linux Tutorial gets a portion of the proceeds to help keep us going.



Security Code
Security Code
Type Security Code

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!

Amazon Wish List

Did You Know?
The Linux Tutorial welcomes your suggestions and ideas.


Tell a Friend About Us

Bookmark and Share

Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.08 Seconds