mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 11:25:33 +00:00
fix(filetype): remove call to vim.fn.resolve and pass filename to match function
For example on MacOS, /etc/hostname.file is symlinked to /private/etc/hostname.file. We only care about the original file path though.
This commit is contained in:
@@ -12,7 +12,7 @@ vim.api.nvim_create_augroup('filetypedetect', { clear = false })
|
|||||||
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||||
group = 'filetypedetect',
|
group = 'filetypedetect',
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local ft, on_detect = vim.filetype.match({ buf = args.buf })
|
local ft, on_detect = vim.filetype.match({ filename = args.match, buf = args.buf })
|
||||||
if not ft then
|
if not ft then
|
||||||
-- Generic configuration file used as fallback
|
-- Generic configuration file used as fallback
|
||||||
ft = require('vim.filetype.detect').conf(args.file, args.buf)
|
ft = require('vim.filetype.detect').conf(args.file, args.buf)
|
||||||
|
|||||||
@@ -2408,7 +2408,7 @@ function M.match(args)
|
|||||||
local ft, on_detect
|
local ft, on_detect
|
||||||
|
|
||||||
-- First check for the simple case where the full path exists as a key
|
-- First check for the simple case where the full path exists as a key
|
||||||
local path = vim.fn.resolve(vim.fn.fnamemodify(name, ':p'))
|
local path = vim.fn.fnamemodify(name, ':p')
|
||||||
ft, on_detect = dispatch(filename[path], path, bufnr)
|
ft, on_detect = dispatch(filename[path], path, bufnr)
|
||||||
if ft then
|
if ft then
|
||||||
return ft, on_detect
|
return ft, on_detect
|
||||||
|
|||||||
Reference in New Issue
Block a user