LnL7/vim-nix

Detect nix-shell shebangs

ashkitten opened this issue · 10 comments

Detect nix-shell shebangs

What exactly do you mean with detect nix-shell shebangs?

LnL7 commented

I assume having something like this higlight as python.

#!/usr/bin/env nix-shell
#!nix-shell -i python3.6 -p "python36.withPackages (p: with p; [ pyyaml ])"

import yaml
print(42)

@LnL7: That doesn't make sense because this should already be highlighted as Python.

LnL7 commented

How? Unless I add a modeline it doesn't for me, standard shebang filetype detection only works for #!/usr/bin/env foo or #!/bin/foo.

@LnL7: Well, in my case it's because of the .py suffix, but yeah... now I understand what they meant.

I'd like to tackle this issue, but given that vim-nix is currently straddling between this repository and vim upstream, I'm not sure where this should be implemented.

@jsoo1 @equill any opinions?

jsoo1 commented

@ncfavier I am not really the person to ask about this since I'm not a user of or even a contributor to the plugin.

Does this sort of thing end up in the vim tree often?

I have no idea! I'm asking because you initiated #47.

I guess it doesn't hurt to implement the nix-shell detection logic here and then see if it can be upstreamed...

jsoo1 commented

I know for certain that vim has syntax in the tree but I don't know about other features. I would probably be hesitant to add more if I were a maintainer.

So I would agree. Probably do the work in the plugin and see if it could be upstreamed afterwards.

Opened #51 as a half-working proof of concept.