Is it possible (and how) make user customization for syntax highlighting in build-in Midnight Commander editor/viewer?
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
(or also ~/.local/share/mc/mcedit
in the newer versions). After that you should create and edit your qwe.syntax
file based on the other ones.