Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate from mhartington/formatter.nvim to stevearc/conform.nvim #3

Open
ttys3 opened this issue Oct 11, 2023 · 0 comments
Open

migrate from mhartington/formatter.nvim to stevearc/conform.nvim #3

ttys3 opened this issue Oct 11, 2023 · 0 comments
Assignees

Comments

@ttys3
Copy link
Owner

ttys3 commented Oct 11, 2023

old https://github.com/mhartington/formatter.nvim

suggest:
https://github.com/stevearc/conform.nvim

conform.nvim has default formatter config which can simple the config.

like: https://github.com/stevearc/conform.nvim/blob/master/lua/conform/formatters/stylua.lua

so in conform.nvim we only need to:

require("conform").setup({
    formatters_by_ft = {
        lua = { "stylua" },
    },
})

but formatter.nvim we need to do like this:

require("formatter").setup {
	-- Enable or disable logging
	logging = false,
	-- Set the log level
	log_level = vim.log.levels.TRACE,
	filetype = {
		lua = {
			-- stylua
			function()
				return {
					exe = "stylua",
					args = { "--search-parent-directories", "--stdin-filepath", vim.api.nvim_buf_get_name(0), "-" },
					stdin = true,
				}
			end,
		},
}
}
@ttys3 ttys3 self-assigned this Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant