LnL7 / vim-nix

Vim configuration files for Nix http://nixos.org/nix
MIT License
286 stars 26 forks source link

Detect nix-shell shebangs #10

Open ashkitten opened 7 years ago

aszlig commented 6 years ago

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

LnL7 commented 6 years ago

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)
aszlig commented 6 years ago

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

LnL7 commented 6 years ago

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.

aszlig commented 6 years ago

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

ncfavier commented 1 year ago

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 1 year ago

@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?

ncfavier commented 1 year ago

I have no idea! I'm asking because you initiated https://github.com/LnL7/vim-nix/issues/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 1 year ago

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.

ncfavier commented 1 year ago

Opened https://github.com/LnL7/vim-nix/pull/51 as a half-working proof of concept.