From 3612642b0e2eb85015838df5dcfbacb61f15db98 Mon Sep 17 00:00:00 2001 From: Lukas Reineke Date: Wed, 3 Apr 2024 14:25:58 +0900 Subject: [PATCH] fix: keep format command args fix #84 --- lua/lsp-format/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/lsp-format/init.lua b/lua/lsp-format/init.lua index 2c0c7b8..5a8aadc 100644 --- a/lua/lsp-format/init.lua +++ b/lua/lsp-format/init.lua @@ -35,8 +35,9 @@ end M.setup = function(format_options) M.format_options = vim.tbl_deep_extend("force", M.format_options, format_options or {}) - vim.api.nvim_create_user_command("Format", function() - M.format { buf = vim.api.nvim_get_current_buf() } + vim.api.nvim_create_user_command("Format", function(args) + args.buf = vim.api.nvim_get_current_buf() + M.format(args) end, { nargs = "*", bar = true, force = true }) vim.api.nvim_create_user_command( "FormatToggle",