Skip to content

Commit

Permalink
fix: crash in preview on nvim 0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Jan 25, 2025
1 parent 6f9e105 commit 81b2c5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/oil/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ M.read_file_to_scratch_buffer = function(path, preview_method)
return
end
local ft = vim.filetype.match({ filename = path, buf = bufnr })
if ft and ft ~= "" then
if ft and ft ~= "" and vim.treesitter.language.get_lang then
local lang = vim.treesitter.language.get_lang(ft)
if not pcall(vim.treesitter.start, bufnr, lang) then
vim.bo[bufnr].syntax = ft
Expand Down

0 comments on commit 81b2c5f

Please sign in to comment.