Skip to content

Commit a3a2eb2

Browse files
committed
Use Conform for Java and Python formatting
1 parent 9037b30 commit a3a2eb2

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

after/ftplugin/python.lua

Lines changed: 0 additions & 17 deletions
This file was deleted.

init.lua

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ require('lazy').setup({
646646

647647
{ -- Autoformat
648648
'stevearc/conform.nvim',
649+
649650
event = { 'BufWritePre' },
650651
cmd = { 'ConformInfo' },
651652
keys = {
@@ -658,11 +659,25 @@ require('lazy').setup({
658659
desc = '[F]ormat buffer',
659660
},
660661
},
662+
-- This will provide type hinting with LuaLS
663+
---@module "conform"
664+
---@type conform.setupOpts
661665
opts = {
666+
-- log_level = vim.log.levels.DEBUG,
662667
notify_on_error = false,
663-
format_on_save = false,
668+
format_on_save = nil, -- Do NOT format when saving a buffer
669+
formatters = {
670+
isort = {
671+
prepend_args = { "-l", "1000000", "--wl", "0", "--sl" }
672+
},
673+
black = {
674+
prepend_args = { "-l", tostring(vim.o.textwidth) },
675+
},
676+
},
664677
formatters_by_ft = {
665678
lua = { 'stylua' },
679+
java = { "google-java-format" },
680+
python = { "black", "isort" },
666681
-- Conform can also run multiple formatters sequentially
667682
-- python = { "isort", "black" },
668683
--

0 commit comments

Comments
 (0)