From 141edf7114839ba7656c4484f852199179c4f11f Mon Sep 17 00:00:00 2001 From: Huynh Duc Dung Date: Fri, 1 Mar 2024 20:20:32 +0800 Subject: [PATCH] feat(autocmds): Add filetype for .hurl files --- lua/config/autocmds.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index f7101c1c..7e18deb6 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -14,3 +14,19 @@ vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { vim.opt_local.filetype = "sh" end, }) + +local is_stable_version = true +if vim.fn.has("nvim-0.10.0") == 1 then + is_stable_version = false +end + +if is_stable_version then + -- Set filetype for .hurl files + vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + group = augroup("env_filetype"), + pattern = { "*.hurl" }, + callback = function() + vim.opt_local.filetype = "sh" + end, + }) +end