From d43afa4316455684da5a02b0ecf93c15d41f8080 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sat, 14 Oct 2023 15:01:34 +0200 Subject: [PATCH 1/2] feat: keybind to toggle format on save --- modules/lsp/config.nix | 5 +++++ modules/lsp/module.nix | 3 +++ 2 files changed, 8 insertions(+) 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"; }; }; } From b01536c8acadecfcd848c0f63ffbc95d0f5b396d Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Mon, 23 Oct 2023 18:53:51 +0200 Subject: [PATCH 2/2] docs: update release notes --- docs/release-notes/rl-0.5.adoc | 2 ++ 1 file changed, 2 insertions(+) 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