-
| 
         When saving buffer to disk, the code is formatted, how can I close it.  | 
  
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 16 replies
-
        Disable formatting for temporaryIf you want to disable it for temporary, use  Disable formatting on-save for permanentIf 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,  The  You can press  This feature are implemented in adoyle-h/lsp-format.nvim (a fork from lukas-reineke/lsp-format.nvim) and plugins/lsp/format. The  Disable formatting for permanentIf you want to completely disable it for permanent, require('one').setup {
	config = {
		lsp = {
			format = {
				lua = {
					exclude = { -- exclude is a table of LSP servers that should not format the buffer whose filetype matching "lua".
						'sumneko_lua',
						'null-ls',
					},
				},
			},
		},
	}
}Read   | 
  
Beta Was this translation helpful? Give feedback.
Disable formatting for temporary
If you want to disable it for temporary, use
:ToggleLSPto disable LSP (But it will be enabled after refreshing buffer) for current buffer. And:ToggleNullLSPto disable NullLS formatting source for all buffers.Disable formatting on-save for permanent
If you want to only disable formatting on-save,
For above config,
cfiletype buffers will disable formatting on-save, while other filetypes enabled.The
candluakey are filetype. You can change it as your demand.the "_" will match al…