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

Wrong filetype detection for files/paths containing "mak", "mk" and possibly some others #77

Open
nagua opened this issue Feb 28, 2022 · 1 comment

Comments

@nagua
Copy link

nagua commented Feb 28, 2022

Hello everyone,

first off: thank you for your great plugin! It really is a good effort and much easier to read than vimscript.

I'm getting some strange filedetections lately and I wanted to investigate that. The situation:

I created a bash script called 'build_cmake' that uses a shebang at the top of the file.
'filetype.nvim' reports this file as a makefile. I investigated how that could happen and I found that it
matches the complex regex with absolute path check:

if try_regex(absolute_path, complex_maps.complex) then
return
end

This happens to be the case because build_c[mak]e contains the string mak. This could also happen if you have the string mak or mk or dsp in your absolute path. So I would argue that matching on the absolute path should be done after matching a shebang. What do you think about that?

Have a great day!
Nagua

@fragov
Copy link

fragov commented Jan 21, 2023

Yes, I confirm. I use Oil.nvim, and there is 'mak' in my home directory name. If I open anything in the home directory with Oil.nvim, the plugin set the file type to 'make'. And it breaks work of the Oil.nvim plugin.

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

2 participants