mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-24 09:48:42 +02:00
plugins/conform: add str type for formatAfterSave
This commit is contained in:
parent
ace360b5de
commit
e9564ac336
2 changed files with 51 additions and 14 deletions
|
@ -94,4 +94,30 @@
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
custom_format_after_save_function = {
|
||||
plugins.conform-nvim = {
|
||||
enable = true;
|
||||
|
||||
formattersByFt = {
|
||||
lua = ["stylua"];
|
||||
python = ["isort" "black"];
|
||||
javascript = [["prettierd" "prettier"]];
|
||||
"*" = ["codespell"];
|
||||
"_" = ["trimWhitespace"];
|
||||
};
|
||||
|
||||
formatAfterSave = ''
|
||||
function(bufnr)
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
if not _conform_slow_format_filetypes[vim.bo[bufnr].filetype] then
|
||||
return
|
||||
end
|
||||
return { lsp_fallback = true }
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue