pkgs(nixvim): Add some language supports for formatting
This commit is contained in:
parent
37914d6957
commit
d242144445
10 changed files with 352 additions and 0 deletions
31
pkgs/nixvim/lang/lua/formatting.nix
Normal file
31
pkgs/nixvim/lang/lua/formatting.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
plugins.conform-nvim.settings = {
|
||||
formatters_by_ft.lua = {
|
||||
__unkeyed-1 = "stylua";
|
||||
lsp_format = "fallback";
|
||||
};
|
||||
formatters.stylua = {
|
||||
__raw =
|
||||
#lua
|
||||
''
|
||||
function()
|
||||
local defaultFormatter = require("conform.formatters.stylua")
|
||||
return vim.tbl_extend("force", defaultFormatter, {
|
||||
command = function()
|
||||
local exe = vim.fn["exepath"]("stylua")
|
||||
if exe ~= "" then
|
||||
return exe
|
||||
else
|
||||
return "${lib.getExe pkgs.stylua}"
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue