Skip to content

Commit

Permalink
feat: allow disabling format on save per buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
horriblename committed Oct 14, 2023
1 parent 5f0b724 commit c6c0425
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions modules/lsp/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion modules/lsp/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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`";
};
}

0 comments on commit c6c0425

Please sign in to comment.