Closed Freed-Wu closed 11 months ago
That looks like a restricted version of #28
IMHO it's not a good idea to assume bash for unpackPhase
etc. Also, this highlighting would be pretty incomplete considering that you can define custom phases, have quite a lot of phases and also pre/post hooks and the syntax highlighting would be completely wrong and confusing if you have - for whatever reason - an installPhase
that's not a bash string. To deliver somehow usable results, we'd probably have to scan for stdenv.mkDerivation
which would make this even more error-prone (right now we simply pattern-match for some highlighting even in case of syntax errors) and we'd need some more sophisticated parsing then.
tl;dr what @bew says, the correct solution would be something like #28 (although getting this ready is a different story).
Btw just tried #28 out though and it works relatively well, so you just apply the patch to your local vim-nix
(that's possible via super.vimUtils.vim-nix.overrideAttrs
in an overlay for instance).
How about highlight unpackPhase/installPhase/... as sh syntax? Like markdown/typst highlight code fence:
Refer https://github.com/vim-pandoc/vim-pandoc-syntax