Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

21 lines
636 B

local function load_skeleton(filetype)
-- do nothing if no filetype
if filetype == "" then return end
-- glob every directory of 'runtimepath' to search for skeleton/filetype
local skeletons = vim.api.nvim_get_runtime_file('skeleton/' .. filetype, true)
if #skeletons == 0 then return end
-- read last skeleton into 1st line.
vim.api.nvim_command('0read ' .. skeletons[#skeletons])
end
-- augroup setup
vim.api.nvim_create_augroup('aug_skeleton', {clear = true})
vim.api.nvim_create_autocmd('BufNewFile', {
group = 'aug_skeleton',
pattern = '*',
callback = function()
load_skeleton(vim.bo.filetype)
end,
})