mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-13 18:54:30 +02:00
filetype: Add a module to wrap vim.filetype.add (#277)
This commit is contained in:
parent
58b6c74e2f
commit
cbae935d89
2 changed files with 81 additions and 0 deletions
41
tests/test-sources/modules/filetypes.nix
Normal file
41
tests/test-sources/modules/filetypes.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
example = {
|
||||
filetype = {
|
||||
extension = {
|
||||
foo = "fooscript";
|
||||
bar.__raw = ''
|
||||
function(path, bufnr)
|
||||
if some_condition() then
|
||||
return 'barscript', function(bufnr)
|
||||
-- Set a buffer variable
|
||||
vim.b[bufnr].barscript_version = 2
|
||||
end
|
||||
end
|
||||
return 'bar'
|
||||
end
|
||||
'';
|
||||
};
|
||||
filename = {
|
||||
".foorc" = "toml";
|
||||
"/etc/foo/config" = "toml";
|
||||
};
|
||||
pattern = {
|
||||
".*/etc/foo.*" = "fooscript";
|
||||
".*/etc/foo.*%.conf" = [
|
||||
"dosini"
|
||||
{priority = 10;}
|
||||
];
|
||||
"\${XDG_CONFIG_HOME}/foo/git" = "git";
|
||||
"README.(a+)$".__raw = ''
|
||||
function(path, bufnr, ext)
|
||||
if ext == 'md' then
|
||||
return 'markdown'
|
||||
elseif ext == 'rst' then
|
||||
return 'rst'
|
||||
end
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue