Fix: chemin vers les templates incorrectes

This commit is contained in:
Yann 2022-02-04 22:08:19 +01:00
parent 0249e9cb61
commit 2d146ff779

View File

@ -16,11 +16,14 @@ end
local function header()
local filetype = vim.api.nvim_buf_get_option(0, 'filetype')
if filetype ~= "" then
if file_exists('data/tpl/header-' .. filetype .. '.tpl') then
local lines = get_lines_from('data/tpl/header-' .. filetype .. '.tpl')
local current_file_fullpath = debug.getinfo(1, "S").source:sub(2)
local current_file_path = current_file_fullpath:match("(.*/)")
local tpl_path = current_file_path .. '../../data/tpl/header-' .. filetype .. '.tpl'
if file_exists(tpl_path) then
local lines = get_lines_from(tpl_path)
vim.api.nvim_put(lines, "l", false, true)
else
print("Pas de fichier pour ce filetype")
print("Pas de fichier pour ce filetype (" .. tpl_path .. ")")
end
else