Skip to content

Commit 3a33bf3

Browse files
committed
feat: add Format command and mapping (#1378).
1 parent 38c3ee4 commit 3a33bf3

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lua/keymap/completion.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ local map_callback = bind.map_callback
55

66
local plug_map = {
77
["n|<A-f>"] = map_cmd("<Cmd>FormatToggle<CR>"):with_noremap():with_desc("formatter: Toggle format on save"),
8+
["n|<A-S-f>"] = map_cmd("<Cmd>Format<CR>"):with_noremap():with_desc("formatter: Format buffer manually"),
89
}
910
bind.nvim_load_mapping(plug_map)
1011

lua/modules/configs/completion/formatting.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ vim.api.nvim_create_user_command("FormatToggle", function()
1212
M.toggle_format_on_save()
1313
end, {})
1414

15+
vim.api.nvim_create_user_command("Format", function()
16+
M.format({
17+
timeout = format_timeout,
18+
filter = M.format_filter,
19+
})
20+
end, {})
21+
1522
local block_list = settings.formatter_block_list
1623
vim.api.nvim_create_user_command("FormatterToggleFt", function(opts)
1724
if block_list[opts.args] == nil then

0 commit comments

Comments
 (0)