improve detection of hosts.yml
This commit is contained in:
		
							parent
							
								
									f6f917bd54
								
							
						
					
					
						commit
						ff1732f8c5
					
				@ -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)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user