vim-nix
vim-nix copied to clipboard
Detect nix-shell shebangs
Fixes https://github.com/LnL7/vim-nix/issues/10
To do:
- [ ] expose and use vim's interpreter → filetype conversion logic. Currently the filetype is set to the interpreter, which breaks for things like
python3orrunhaskell. - [ ] make this work with Neovim; currently the filetype is detected as
nixbecause of https://github.com/neovim/neovim/issues/23880#issuecomment-1573549418 - [ ] upstream this in Vim? (https://github.com/vim/vim/issues/12507)
The implementation of shellwords here should be correct, but doesn't match the one Nix currently uses. That will be fixed by https://github.com/NixOS/nix/pull/8470.
@ncfavier do you need assistance with this? Or, where exactly is this stuck? The neovim issue is closed for instance. Re upstreaming this into mainline vim: I'm fine with integrating this here first considering that this is the de-facto package for Nix users using vim[1]. Re exposing the filetype detection logic: is there anything to be done in upstream vim?
[1] That said, considering the complexity of the code, tests are a hard requirement for me :)
Thanks for taking an interest in this, I kind of lost interest myself.
The main thing is "expose and use vim's interpreter → filetype conversion logic". I brought this up in the vim issue linked above but nothing has happened yet. It should be straightforward to submit a patch. This code should be moved into a separate function and exported.