Compare commits

...

3 Commits

Author SHA1 Message Date
2d146ff779 Fix: chemin vers les templates incorrectes 2022-02-04 22:08:19 +01:00
0249e9cb61 Renommage commande Tpl en Header 2022-02-04 22:07:55 +01:00
e60919f6a7 Fix: typo dans le template css 2022-02-04 22:07:30 +01:00
3 changed files with 8 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# Reset (Source: https://css-tricks.com/notes-on-josh-comeaus-custom-css-reset/) /* Reset (Source: https://css-tricks.com/notes-on-josh-comeaus-custom-css-reset/) */
* { * {
margin: 0; margin: 0;
padding: 0; padding: 0;

View File

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

View File

@ -20,7 +20,7 @@ EOF
endfunction endfunction
command! Greet lua require'greetings'.greet() command! Greet lua require'greetings'.greet()
command! Tpl lua require'tpl'.header() command! Header lua require'tpl'.header()
augroup ReloadingGroup augroup ReloadingGroup
autocmd! autocmd!