Skip to content

How can I disable the 'format code on save" #6

Answered by adoyle-h
x2c3z4 asked this question in Q&A
Discussion options

You must be logged in to vote

Disable formatting for temporary

If you want to disable it for temporary, use :ToggleLSP to disable LSP (But it will be enabled after refreshing buffer) for current buffer. And :ToggleNullLSP to disable NullLS formatting source for all buffers.

Disable formatting on-save for permanent

If you want to only disable formatting on-save,

require('one').setup {
	config = {
		lsp = {
			format = {
				_ = { on_save = true },

				c = { on_save = false },

				lua = {
					on_save = true,
				},
			},
		},
	},
}

For above config, c filetype buffers will disable formatting on-save, while other filetypes enabled.

The c and lua key are filetype. You can change it as your demand.
the "_" will match al…

Replies: 1 comment 16 replies

Comment options

You must be logged in to vote
16 replies
@x2c3z4
Comment options

@adoyle-h
Comment options

@x2c3z4
Comment options

@adoyle-h
Comment options

@x2c3z4
Comment options

Answer selected by x2c3z4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants