mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-05 21:10:15 -04:00
rename and finish ft->lang migration
This commit is contained in:
parent
30dbf73113
commit
def8c20dd7
4 changed files with 36 additions and 36 deletions
|
|
@ -21,14 +21,14 @@ local function install_info()
|
|||
end
|
||||
end
|
||||
|
||||
local function print_info_module(sorted_filetypes, mod)
|
||||
local max_str_len = #sorted_filetypes[1]
|
||||
local function print_info_module(sorted_languages, mod)
|
||||
local max_str_len = #sorted_languages[1]
|
||||
local header = string.format('%s%s', string.rep(' ', max_str_len + 2), mod)
|
||||
api.nvim_out_write(header..'\n')
|
||||
for _, ft in pairs(sorted_filetypes) do
|
||||
local padding = string.rep(' ', max_str_len - #ft + #mod / 2 + 1)
|
||||
api.nvim_out_write(ft..":"..padding)
|
||||
if configs.is_enabled(mod, ft) then
|
||||
for _, lang in pairs(sorted_languages) do
|
||||
local padding = string.rep(' ', max_str_len - #lang + #mod / 2 + 1)
|
||||
api.nvim_out_write(lang..":"..padding)
|
||||
if configs.is_enabled(mod, lang) then
|
||||
api.nvim_out_write('✓')
|
||||
else
|
||||
api.nvim_out_write('✗')
|
||||
|
|
@ -37,23 +37,23 @@ local function print_info_module(sorted_filetypes, mod)
|
|||
end
|
||||
end
|
||||
|
||||
local function print_info_modules(sorted_filetypes)
|
||||
local max_str_len = #sorted_filetypes[1]
|
||||
local function print_info_modules(sorted_languages)
|
||||
local max_str_len = #sorted_languages[1]
|
||||
local header = string.rep(' ', max_str_len + 2)
|
||||
for _, mod in pairs(configs.available_modules()) do
|
||||
header = string.format('%s%s ', header, mod)
|
||||
end
|
||||
api.nvim_out_write(header..'\n')
|
||||
|
||||
for _, ft in pairs(sorted_filetypes) do
|
||||
local padding = string.rep(' ', max_str_len - #ft)
|
||||
api.nvim_out_write(ft..":"..padding)
|
||||
for _, lang in pairs(sorted_languages) do
|
||||
local padding = string.rep(' ', max_str_len - #lang)
|
||||
api.nvim_out_write(lang..":"..padding)
|
||||
|
||||
for _, mod in pairs(configs.available_modules()) do
|
||||
local pad_len = #mod / 2 + 1
|
||||
api.nvim_out_write(string.rep(' ', pad_len))
|
||||
|
||||
if configs.is_enabled(mod, ft) then
|
||||
if configs.is_enabled(mod, lang) then
|
||||
api.nvim_out_write('✓')
|
||||
else
|
||||
api.nvim_out_write('✗')
|
||||
|
|
@ -67,12 +67,12 @@ end
|
|||
local function module_info(mod)
|
||||
if mod and not configs.get_config()[mod] then return end
|
||||
|
||||
local ft_by_len = parsers.available_parsers()
|
||||
table.sort(ft_by_len, function(a, b) return #a > #b end)
|
||||
local parserlist = parsers.available_parsers()
|
||||
table.sort(parserlist, function(a, b) return #a > #b end)
|
||||
if mod then
|
||||
print_info_module(ft_by_len, mod)
|
||||
print_info_module(parserlist, mod)
|
||||
else
|
||||
print_info_modules(ft_by_len)
|
||||
print_info_modules(parserlist)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue