diff --git a/modules/lsp/config.nix b/modules/lsp/config.nix index 83da30b26..2dc98487e 100644 --- a/modules/lsp/config.nix +++ b/modules/lsp/config.nix @@ -48,6 +48,10 @@ in { ${ if config.vim.lsp.null-ls.enable then '' + if vim.b.formatsave == false then + return + end + local function is_null_ls_formatting_enabled(bufnr) local file_type = vim.api.nvim_buf_get_option(bufnr, "filetype") local generators = require("null-ls.generators").get_available( diff --git a/modules/lsp/module.nix b/modules/lsp/module.nix index 88a281139..3ec7b5aa3 100644 --- a/modules/lsp/module.nix +++ b/modules/lsp/module.nix @@ -8,6 +8,6 @@ with lib; with builtins; { options.vim.lsp = { enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options"; - formatOnSave = mkEnableOption "format on save"; + formatOnSave = mkEnableOption "format on save, can be disabled per buffer by setting `let b:formatsave = v:false`"; }; }