diff --git a/lua/keymap/completion.lua b/lua/keymap/completion.lua index 870f7663d..634a6e961 100644 --- a/lua/keymap/completion.lua +++ b/lua/keymap/completion.lua @@ -1,12 +1,11 @@ local bind = require("keymap.bind") local map_cr = bind.map_cr -local map_cmd = bind.map_cmd local map_callback = bind.map_callback local mappings = { fmt = { - ["n|"] = map_cmd("FormatToggle"):with_noremap():with_desc("formatter: Toggle format on save"), - ["n|"] = map_cmd("Format"):with_noremap():with_desc("formatter: Format buffer manually"), + ["n|"] = map_cr("FormatToggle"):with_noremap():with_silent():with_desc("formatter: Toggle format on save"), + ["n|"] = map_cr("Format"):with_noremap():with_silent():with_desc("formatter: Format buffer manually"), }, } bind.nvim_load_mapping(mappings.fmt) diff --git a/lua/modules/configs/completion/formatting.lua b/lua/modules/configs/completion/formatting.lua index 6b804343d..a64cfe686 100644 --- a/lua/modules/configs/completion/formatting.lua +++ b/lua/modules/configs/completion/formatting.lua @@ -8,10 +8,6 @@ local format_modifications_only = settings.format_modifications_only local server_formatting_block_list = settings.server_formatting_block_list local format_timeout = settings.format_timeout -vim.api.nvim_create_user_command("FormatToggle", function() - M.toggle_format_on_save() -end, {}) - vim.api.nvim_create_user_command("Format", function() M.format({ timeout = format_timeout, @@ -19,6 +15,10 @@ vim.api.nvim_create_user_command("Format", function() }) end, {}) +vim.api.nvim_create_user_command("FormatToggle", function() + M.toggle_format_on_save() +end, {}) + local block_list = settings.formatter_block_list vim.api.nvim_create_user_command("FormatterToggleFt", function(opts) if block_list[opts.args] == nil then