vim-nix icon indicating copy to clipboard operation
vim-nix copied to clipboard

Detect nix-shell shebangs

Open ashkitten opened this issue 7 years ago • 10 comments

ashkitten avatar Mar 29 '17 17:03 ashkitten

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

aszlig avatar Aug 17 '18 05:08 aszlig

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 avatar Aug 17 '18 06:08 LnL7

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

aszlig avatar Aug 17 '18 10:08 aszlig

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 avatar Aug 17 '18 18:08 LnL7

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

aszlig avatar Aug 17 '18 19:08 aszlig

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?

ncfavier avatar Jun 06 '23 17:06 ncfavier

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

jsoo1 avatar Jun 06 '23 17:06 jsoo1

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...

ncfavier avatar Jun 06 '23 17:06 ncfavier

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.

jsoo1 avatar Jun 06 '23 18:06 jsoo1

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

ncfavier avatar Jun 08 '23 15:06 ncfavier