change api for new filetypes

This commit is contained in:
Oliver Hartmann 2025-04-20 23:00:32 +02:00
parent 9914c9bd88
commit 23dd1811ee

View File

@ -7,37 +7,22 @@ api.nvim_create_autocmd('TextYankPost', {
group = yankGrp,
})
-- Filetypes
local fileGrp = api.nvim_create_augroup('file_type', { clear = true })
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
pattern = { '*.simvis', '*.manifest' },
callback = function() vim.bo.filetype = 'xml' end,
group = fileGrp,
})
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
pattern = { '*.simcfg', '*.simcon', '*.simudex' },
callback = function() vim.bo.filetype = 'xml' end,
group = fileGrp,
})
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
pattern = { 'JenkinsFile*' },
callback = function() vim.bo.filetype = 'groovy' end,
group = fileGrp,
})
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
pattern = { 'SConstruct', 'SConscript' },
callback = function() vim.bo.filetype = 'python' end,
group = fileGrp,
})
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
pattern = { 'doskey' },
callback = function() vim.bo.filetype = 'dosini' end,
group = fileGrp,
})
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
pattern = { '.clangd', '.clang-tidy' },
callback = function() vim.bo.filetype = 'yaml' end,
group = fileGrp,
vim.filetype.add({
extension = {
simvis = 'xml',
manifest = 'xml',
simcfg = 'xml',
simcon = 'xml',
simudex = 'xml'
},
filename = {
['JenkinsFile'] = 'groovy',
['SConstruct'] = 'python',
['SConscript'] = 'python',
['doskey'] = 'dosini',
['.clangd'] = 'yaml',
['.clang-tidy'] = 'yaml',
},
})
-- Read and write shada file