This repository contains a configuration file that can be used to syntax
highlight Nix expressions in mcedit
, the editor that
comes with Midnight Commander.
Features supported:
- Keywords
- Single and multi-line comments
- Strings, indented strings
- Integer, float, null and boolean literals
- Separators
- Nix builtins
- Limited URL and path support
- Limited anti-quotation support
There are two ways to use the syntax configuration file.
Manual installation can be done by copying the nix.syntax
file to the
corresponding user's configuration folder:
$ mkdir -p ~/.local/share/mc/syntax
$ cp nix.syntax ~/.local/share/mc/syntax
Then we must create our own personalized version of the syntax configuration file. We can save a copy of the syntax file as follows:
- Open
mcedit
- Unfold the 'Options' menu (F9 -> 'Options')
- Pick the option 'Syntax file`
- Press 'F2 (save)` to save.
It may happen that you see an error message about write permissions. Restore write permissions as follows:
$ chmod 644 ~/.local/share/mc/syntax/Syntax
Finally, add the following lines to the configuration file above the unknown entry:
file ..\*\\.nix$ Nix\sExpression
include /home/sander/.local/share/mc/syntax/nix.syntax
Now the syntax highlighting should work.
Alternatively, we can use a Nix expression that patches the Midnight Commander in the Nixpkgs repository to include the Nix expression syntax as part of the default installation.
A Nix-enabled mc
distribution can be installed into the user profile as
follows:
$ nix-env -f default.nix -i mc
The contents of this package uses the same license as Midnight Commander, the GPLv3 or higher.