improve detection of hosts.yml
This commit is contained in:
parent
f6f917bd54
commit
ff1732f8c5
@ -11,6 +11,7 @@ local M = {}
|
|||||||
|
|
||||||
M.example = function()
|
M.example = function()
|
||||||
local bufnr = vim.api.nvim_get_current_buf()
|
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 lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||||
local parser = ts.get_parser(bufnr, 'yaml')
|
local parser = ts.get_parser(bufnr, 'yaml')
|
||||||
local tree = parser:parse()[1]
|
local tree = parser:parse()[1]
|
||||||
@ -95,7 +96,7 @@ M.example = function()
|
|||||||
end
|
end
|
||||||
local current_prefix = split_line[1]
|
local current_prefix = split_line[1]
|
||||||
-- special case for hosts.yml
|
-- special case for hosts.yml
|
||||||
if current_prefix == 'lfops' then
|
if file_basename == 'hosts.yml' then
|
||||||
current_prefix = obj.sort_line
|
current_prefix = obj.sort_line
|
||||||
end
|
end
|
||||||
-- print('current_prefix', current_prefix)
|
-- print('current_prefix', current_prefix)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user