From 865dcad2fbad7fbe3f9fb6a8260eee454bac9473 Mon Sep 17 00:00:00 2001 From: Garrett Date: Tue, 10 Dec 2024 19:15:20 -0500 Subject: [PATCH] feat: add equalprg --- lua/conform/formatters/equalprg.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lua/conform/formatters/equalprg.lua diff --git a/lua/conform/formatters/equalprg.lua b/lua/conform/formatters/equalprg.lua new file mode 100644 index 00000000..d7f92fe9 --- /dev/null +++ b/lua/conform/formatters/equalprg.lua @@ -0,0 +1,14 @@ +---@type conform.FileLuaFormatterConfig +return { + meta = { + url = "https://github.com/stevearc/conform.nvim/blob/master/lua/conform/formatters/equalprg.lua", + description = "Vim's own equalprg", + }, + format = function(self, ctx, lines, callback) + local cursor_position = vim.api.nvim_win_get_cursor(0) + vim.cmd.normal("gg") + vim.cmd.normal("=G") + vim.api.nvim_win_set_cursor(0, cursor_position) + callback(nil, nil) + end, +}