Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Recently I discover a power of MC to view/edit certain types of file. For example this:

    View=%view{ascii} tmp=%p; javap -c ${tmp%%.class}

from ~/.mc/bindings take me brief look for Java class methods/fields by pressing F3. But it is hard to look when all code use same colors. I would like to see keywords and types highlighted in some form.

Is it possible (and how) make user customization for syntax highlighting in build-in Midnight Commander editor/viewer (by regex)?

share|improve this question
up vote 1 down vote accepted

Syntax related files are stored in /usr/share/mc/syntax. These files are provided by the package management system. They could be edited as root, and it should work, but this would be a hack.

The correct solution is to copy /usr/share/mc/syntax/Syntax to your home directory: ~/.config/mc/mcedit/Syntax. (Note: old version could use other path e.g: ~/.mc/cedit) This file defines file types associations, and if it is present in your home directory, then it will override the default one. So it could be edited now.

For example if you want to add a syntax file for qwe extensions you should add these lines:

file ..\*\\.qwe$ qwe\sFile
include /home/username/.config/mc/mcedit/qwe.syntax

Note that include needs an absolute path, if the file is not located in /usr/share/mc/syntax. After that you should create and edit your qwe.syntax file based on the other ones.

share|improve this answer
Thanks for effort to answer the question! +1 – gavenkoa Feb 25 '15 at 23:11

Can't say anything about colours, but the binding needs to be updated to view class files within a jar:

     View=%view{ascii} tmp=%f; xyxy=${tmp##*/}; javap -classpath ${tmp%/*.class} -c ${xyxy%.class}
share|improve this answer
Sorry but you just copy what I write by myself (( – gavenkoa Oct 20 '12 at 17:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.