improve detection of hosts.yml

This commit is contained in:
Navid Sassan 2025-02-19 17:59:38 +01:00
parent f6f917bd54
commit ff1732f8c5

View File

@ -11,6 +11,7 @@ local M = {}
M.example = function()
local bufnr = vim.api.nvim_get_current_buf()
local file_basename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(bufnr), ':t')
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
local parser = ts.get_parser(bufnr, 'yaml')
local tree = parser:parse()[1]
@ -95,7 +96,7 @@ M.example = function()
end
local current_prefix = split_line[1]
-- special case for hosts.yml
if current_prefix == 'lfops' then
if file_basename == 'hosts.yml' then
current_prefix = obj.sort_line
end
-- print('current_prefix', current_prefix)