Refactor: Add parsers.get_buf_lang

This commit is contained in:
Stephan Seitz 2020-07-10 21:47:50 +02:00 committed by Thomas Vigouroux
parent 1849f30bb5
commit a4e2692c7b
5 changed files with 18 additions and 11 deletions

View file

@ -104,7 +104,7 @@ end
local function enable_module(mod, bufnr, lang)
local bufnr = bufnr or api.nvim_get_current_buf()
local lang = lang or parsers.ft_to_lang(api.nvim_buf_get_option(bufnr, 'ft'))
local lang = lang or parsers.get_buf_lang(bufnr)
if not parsers.list[lang] then
return
@ -157,7 +157,7 @@ end
local function disable_module(mod, bufnr, lang)
local bufnr = bufnr or api.nvim_get_current_buf()
local lang = lang or parsers.ft_to_lang(api.nvim_buf_get_option(bufnr, 'ft'))
local lang = lang or parsers.get_buf_lang(bufnr)
if not lang then
return
end