From 545a3bc5fafb719ee3f8fbc7fc7a2033fe9e5997 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 16 Apr 2024 14:00:20 +0800 Subject: [PATCH] feat(format): support `:Format! filetype` --- bundle/format.nvim/lua/format.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bundle/format.nvim/lua/format.lua b/bundle/format.nvim/lua/format.lua index 1ab38da34..1e7de9c64 100644 --- a/bundle/format.nvim/lua/format.lua +++ b/bundle/format.nvim/lua/format.lua @@ -11,6 +11,10 @@ function M.format(bang, user_input, start_line, end_line) end local filetype = vim.o.filetype + local argvs = vim.split(user_input, '%s+') + if bang and #argvs > 0 then + filetype = argvs[1] + end if filetype == '' then return util.msg('format: skip empty filetype')