From: Ruben Beltran del Rio Date: Wed, 4 Oct 2023 14:30:51 +0000 (+0200) Subject: Use filetype instead of autocmd X-Git-Url: https://git.r.bdr.sh/rbdr/tree-sitter-api-notation/commitdiff_plain/5b3c29fedf2c2cc4e9da582d4cdb0a6bafbfe55d?ds=sidebyside;hp=60e517c96db9fc7c2bedbf04905f16cd253bf4ef Use filetype instead of autocmd --- diff --git a/lua/tree-sitter-api-notation.lua b/lua/tree-sitter-api-notation.lua index 184cb57..95d5bd5 100644 --- a/lua/tree-sitter-api-notation.lua +++ b/lua/tree-sitter-api-notation.lua @@ -12,9 +12,11 @@ function M.setup() branch = 'main' } } - vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, { - pattern = {'*.api', '*.apinotation'}, - callback = function () vim.opt.filetype = 'api_notation' end + vim.filetype.add({ + extension = { + api = 'api_notation', + apinotation = 'api_notation' + } }) end