diff --git a/docs/release-notes/rl-0.5.adoc b/docs/release-notes/rl-0.5.adoc index d04f0fa..10bb4a8 100644 --- a/docs/release-notes/rl-0.5.adoc +++ b/docs/release-notes/rl-0.5.adoc @@ -22,6 +22,8 @@ https://github.com/horriblename[horriblename]: * Add lua LSP and treesitter support, and neodev.nvim plugin support +* Add <> keybind + https://github.com/amanse[amanse]: * Added daily notes options for obsidian plugin diff --git a/modules/lsp/config.nix b/modules/lsp/config.nix index 9cbe760..eacbfa2 100644 --- a/modules/lsp/config.nix +++ b/modules/lsp/config.nix @@ -41,6 +41,7 @@ in { ${mkBinding mappings.renameSymbol "vim.lsp.buf.rename()"} ${mkBinding mappings.codeAction "vim.lsp.buf.code_action()"} ${mkBinding mappings.format "vim.lsp.buf.format()"} + ${mkBinding mappings.toggleFormatOnSave "vim.b.disableFormatSave = not vim.b.disableFormatSave"} end -- Enable formatting @@ -56,6 +57,10 @@ in { ${ if config.vim.lsp.null-ls.enable then '' + if vim.b.disableFormatSave 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 9b24825..38d73b1 100644 --- a/modules/lsp/module.nix +++ b/modules/lsp/module.nix @@ -63,6 +63,9 @@ in { format = mkMappingOption "Format" "lf"; + toggleFormatOnSave = + mkMappingOption "Toggle format on save" + "ltf"; }; }; }