Skip to content

Commit 8ab099c

Browse files
committed
feat(format): add Format command and mapping
1 parent f2ab041 commit 8ab099c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lua/keymap/completion.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ local map_cmd = bind.map_cmd
44
local map_callback = bind.map_callback
55

66
local plug_map = {
7-
["n|<A-f>"] = map_cmd("<Cmd>FormatToggle<CR>"):with_noremap():with_desc("Formater: Toggle format on save"),
7+
["n|<A-f>"] = map_cmd("<Cmd>FormatToggle<CR>"):with_noremap():with_desc("formater: 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)