-
Notifications
You must be signed in to change notification settings - Fork 3
/
formatting.nix
44 lines (43 loc) · 1.01 KB
/
formatting.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ pkgs, unstable, plugin, ... }: {
binaries = with pkgs; [
black
ruff
isort
nodePackages.prettier
nixfmt-rfc-style
];
lazy = with pkgs.vimPlugins;
# lua
''
{
dir = "${conform-nvim}",
name = "conform",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
keys = {
{
"<leader>f",
function()
require("conform").format({ async = true })
end,
mode = "",
desc = "Format buffer",
},
},
---@module "conform"
---@type conform.setupOpts
opts = {
formatters_by_ft = {
python = { "isort", "black", "ruff_fix", "ruff_format" },
javascript = { "prettier" },
nix = { "nixfmt" },
},
default_format_opts = {
lsp_format = "fallback",
},
-- Set up format-on-save
-- format_on_save = { timeout_ms = 500 },
},
},
'';
}