Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Shebang detection fail #59

Closed
th4tkh13m opened this issue Dec 7, 2021 · 2 comments
Closed

Shebang detection fail #59

th4tkh13m opened this issue Dec 7, 2021 · 2 comments

Comments

@th4tkh13m
Copy link

When I open a file with shebang, I get the following error:

Error detected while processing BufReadPost Autocommands for "*":
E5108: Error executing lua ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:165: Vim(echomsg):E114: Missing quote: "Error in packer_compiled: ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:155: Vim(lua):E5108: Error executing lua ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:183:
 attempt to index upvalue 'custom_map' (a nil value)
stack traceback:
        [C]: in function 'cmd'
        ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:165: in function <...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:161>
        [string ":lua"]:1: in main chunk
E5108: Error executing lua ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:183: attempt to index upvalue 'custom_map' (a nil value)
stack traceback:
        ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:183: in function 'resolve'
        [string ":lua"]:1: in main chunk

I'm using NeoVim 0.6 but this issue occurs in 0.5 too.

Note that this only occurs with some files only, in particular:

  • A new file with shebang only (I created a file named test, with the content #!\bin\sh)
  • Some system file with shebang (finish and run file for services in Void Linux)
    For example: finish file:
#!/bin/sh
set -e
exec alsactl store
@clason
Copy link

clason commented Dec 7, 2021

See #56

@mohamed-abdelnour
Copy link
Contributor

mohamed-abdelnour commented Dec 8, 2021

Hello, everyone. Even after #56, this wouldn't work properly on the main branch.

shebang = custom_map.shebang[shebang]

On the main branch, shebangs are only applied from custom_map. This means that unless you configure a custom override for sh shebangs, the file type wouldn't get set to sh.

This has been fixed on the dev branch in #53. You can switch to using dev in the meantime until it gets merged into main.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants