tangled
alpha
login
or
join now
da157.id
/
nixvim-cfg
0
fork
atom
0xda157's nixvim config
0
fork
atom
overview
issues
pulls
pipelines
formatter thingy
awwpotato
11 months ago
0036a82c
6714c5ac
+30
-4
2 changed files
expand all
collapse all
unified
split
modules
plugins
conform
default.nix
lsp
default.nix
+29
modules/plugins/conform/default.nix
···
92
92
"_" = [ "trim_whitespace" ];
93
93
};
94
94
};
95
95
+
luaConfig.post = ''
96
96
+
require("conform").setup({
97
97
+
format_on_save = function(bufnr)
98
98
+
-- Disable with a global or buffer-local variable
99
99
+
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
100
100
+
return
101
101
+
end
102
102
+
return { timeout_ms = 500, lsp_format = "fallback" }
103
103
+
end,
104
104
+
})
105
105
+
106
106
+
vim.api.nvim_create_user_command("FormatDisable", function(args)
107
107
+
if args.bang then
108
108
+
-- FormatDisable! will disable formatting just for this buffer
109
109
+
vim.b.disable_autoformat = true
110
110
+
else
111
111
+
vim.g.disable_autoformat = true
112
112
+
end
113
113
+
end, {
114
114
+
desc = "Disable autoformat-on-save",
115
115
+
bang = true,
116
116
+
})
117
117
+
vim.api.nvim_create_user_command("FormatEnable", function()
118
118
+
vim.b.disable_autoformat = false
119
119
+
vim.g.disable_autoformat = false
120
120
+
end, {
121
121
+
desc = "Re-enable autoformat-on-save",
122
122
+
})
123
123
+
'';
95
124
};
96
125
}
+1
-4
modules/plugins/lsp/default.nix
···
61
61
# - config -
62
62
yamlls.enable = true;
63
63
jsonls.enable = true;
64
64
-
nixd = {
65
65
-
enable = true;
66
66
-
settings.formatting.command = [ "nix fmt" ];
67
67
-
};
64
64
+
nixd.enable = true;
68
65
ansiblels.enable = true;
69
66
dockerls.enable = true;
70
67
# - general -