lazyvim/lua/lazyvim/plugins/extras/editor/refactoring.lua
Iordanis Petkakis d92692309c
fix(refactoring)!: conform to upstream breaking changes on 2.0 branch (#7124)
## Description
`refactoring.nvim` had a new 2.0 release with some breaking changes.
Adjust the LazyVim Extra.

Left `opts` with everything default as there've been changes there as
well, but I don't use the plugin.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
Fixes #7122
<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->

## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
2026-04-22 11:32:53 +02:00

88 lines
2.1 KiB
Lua

if LazyVim.has_extra("editor.refactoring") then
if vim.fn.has("nvim-0.12") == 0 then
LazyVim.error("refactoring.nvim requires Neovim 0.12 or higher", { title = "refactoring.nvim" })
return {}
end
end
return {
{ "lewis6991/async.nvim", lazy = true },
{
"ThePrimeagen/refactoring.nvim",
event = { "BufReadPre", "BufNewFile" },
keys = {
{ "<leader>r", "", desc = "+refactor", mode = { "n", "x" } },
{
"<leader>rs",
function()
return require("refactoring").select_refactor()
end,
mode = { "n", "x" },
desc = "Select Refactor",
},
{
"<leader>ri",
function()
return require("refactoring").inline_var()
end,
mode = { "n", "x" },
desc = "Inline Variable",
expr = true,
},
{
"<leader>rP",
function()
return require("refactoring.debug").print_loc({ output_location = "below" })
end,
desc = "Debug Print Location",
expr = true,
},
{
"<leader>rp",
function()
return require("refactoring.debug").print_var({ output_location = "below" }) .. "iw"
end,
mode = { "n", "x" },
desc = "Debug Print Variable",
expr = true,
},
{
"<leader>rc",
function()
return require("refactoring.debug").cleanup({ restore_view = true }) .. "ag"
end,
desc = "Debug Cleanup",
expr = true,
},
{
"<leader>rf",
function()
return require("refactoring").extract_func()
end,
mode = { "n", "x" },
desc = "Extract Function",
expr = true,
},
{
"<leader>rF",
function()
return require("refactoring").extract_func_to_file()
end,
mode = { "n", "x" },
desc = "Extract Function To File",
expr = true,
},
{
"<leader>rx",
function()
return require("refactoring").extract_var()
end,
mode = { "n", "x" },
desc = "Extract Variable",
expr = true,
},
},
opts = {},
},
}