svanderburg / nix-syntax-for-mcedit

Nix expression syntax highlighter for mcedit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nix-syntax-for-mcedit

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

Installation

There are two ways to use the syntax configuration file.

Manual installation

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.

Deploying a modified Midnight Commander with the Nix package manager

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

License

The contents of this package uses the same license as Midnight Commander, the GPLv3 or higher.

About

Nix expression syntax highlighter for mcedit

License:GNU General Public License v3.0


Languages

Language:Nix 100.0%