File tree Expand file tree Collapse file tree 3 files changed +54
-16
lines changed Expand file tree Collapse file tree 3 files changed +54
-16
lines changed Original file line number Diff line number Diff line change
1
+ require (" conform" ).setup ({
2
+ formatters_by_ft = {
3
+ lua = { " stylua" },
4
+ -- Uses ruff. If ruff unavailable, use isot and black
5
+ python = function (bufnr )
6
+ if require (" conform" ).get_formatter_info (" ruff_format" , bufnr ).available then
7
+ return { " ruff_format" , " ruff_organize_imports" }
8
+ else
9
+ return { " isort" , " black" }
10
+ end
11
+ end ,
12
+ rust = { " rustfmt" , lsp_format = " fallback" },
13
+ cpp = { " clang-format" }
14
+ },
15
+
16
+ format_on_save = {
17
+ -- timeout_ms = 200,
18
+ -- async = true,
19
+ lsp_format = " fallback" ,
20
+ },
21
+ })
22
+
23
+ vim .api .nvim_create_autocmd (" BufWritePre" , {
24
+ pattern = " *" ,
25
+ callback = function (args )
26
+ require (" conform" ).format ({ bufnr = args .buf })
27
+ end ,
28
+ })
Original file line number Diff line number Diff line change @@ -13,22 +13,23 @@ null_ls.setup({
13
13
formatting .stylua ,
14
14
-- formatting.rustfmt,
15
15
formatting .clang_format ,
16
- formatting .black .with ({
17
- extra_args = function (_ )
18
- return {
19
- " --fast" ,
20
- " --quiet" ,
21
- " --target-version" ,
22
- " py38" ,
23
- " py39" ,
24
- " py310" ,
25
- " py311" ,
26
- " py312" ,
27
- " -l" ,
28
- vim .opt_local .colorcolumn :get ()[1 ] or " 88" ,
29
- }
30
- end ,
31
- }),
16
+ -- formatting.black.with({
17
+ -- extra_args = function(_)
18
+ -- return {
19
+ -- "--fast",
20
+ -- "--quiet",
21
+ -- "--target-version",
22
+ -- "py38",
23
+ -- "py39",
24
+ -- "py310",
25
+ -- "py311",
26
+ -- "py312",
27
+ -- "-l",
28
+ -- vim.opt_local.colorcolumn:get()[1] or "88",
29
+ -- }
30
+ -- end,
31
+ -- }),
32
+ formatting .black ,
32
33
require (" none-ls.formatting.rustfmt" ),
33
34
--[[ diagnostics.flake8.with {
34
35
extra_args = function(_)
Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ lsp({
105
105
})
106
106
107
107
lsp ({
108
+ enabled = false ,
108
109
" nvimtools/none-ls.nvim" ,
109
110
event = { " InsertEnter" },
110
111
dependencies = {
@@ -121,3 +122,11 @@ lsp({
121
122
require (" modules.lsp.servers.lua_ls" ).setup (opts )
122
123
end ,
123
124
})
125
+
126
+ lsp ({
127
+ " stevearc/conform.nvim" ,
128
+ event = { " BufWritePre" },
129
+ config = function ()
130
+ require (" modules.lsp.conform" )
131
+ end
132
+ })
You can’t perform that action at this time.
0 commit comments