mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(editor): add refactoring.nvim
More on: https://github.com/ThePrimeagen/refactoring.nvim#features
This commit is contained in:
parent
9b4675ddde
commit
41cca6f695
1 changed files with 121 additions and 0 deletions
121
lua/lazyvim/plugins/extras/editor/refactoring.lua
Normal file
121
lua/lazyvim/plugins/extras/editor/refactoring.lua
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"ThePrimeagen/refactoring.nvim",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>rs",
|
||||||
|
function()
|
||||||
|
require("telescope").extensions.refactoring.refactors()
|
||||||
|
end,
|
||||||
|
mode = "v",
|
||||||
|
desc = "Refactor",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>ri",
|
||||||
|
function()
|
||||||
|
require("refactoring").refactor("Inline Variable")
|
||||||
|
end,
|
||||||
|
mode = { "n", "v" },
|
||||||
|
desc = "Inline Variable",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rb",
|
||||||
|
function()
|
||||||
|
require("refactoring").refactor("Extract Block")
|
||||||
|
end,
|
||||||
|
desc = "Extract Block",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rf",
|
||||||
|
function()
|
||||||
|
require("refactoring").refactor("Extract Block To File")
|
||||||
|
end,
|
||||||
|
desc = "Extract Block To File",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rP",
|
||||||
|
function()
|
||||||
|
require("refactoring").debug.printf({ below = false })
|
||||||
|
end,
|
||||||
|
desc = "Debug Print",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rp",
|
||||||
|
function()
|
||||||
|
require("refactoring").debug.print_var({ normal = true })
|
||||||
|
end,
|
||||||
|
desc = "Debug Print Variable",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rc",
|
||||||
|
function()
|
||||||
|
require("refactoring").debug.cleanup({})
|
||||||
|
end,
|
||||||
|
desc = "Debug Cleanup",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rf",
|
||||||
|
function()
|
||||||
|
require("refactoring").refactor("Extract Function")
|
||||||
|
end,
|
||||||
|
mode = "v",
|
||||||
|
desc = "Extract Function",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rF",
|
||||||
|
function()
|
||||||
|
require("refactoring").refactor("Extract Function To File")
|
||||||
|
end,
|
||||||
|
mode = "v",
|
||||||
|
desc = "Extract Function To File",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rx",
|
||||||
|
function()
|
||||||
|
require("refactoring").refactor("Extract Variable")
|
||||||
|
end,
|
||||||
|
mode = "v",
|
||||||
|
desc = "Extract Variable",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>rp",
|
||||||
|
function()
|
||||||
|
require("refactoring").debug.print_var()
|
||||||
|
end,
|
||||||
|
mode = "v",
|
||||||
|
desc = "Debug Print Variable",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
prompt_func_return_type = {
|
||||||
|
go = false,
|
||||||
|
java = false,
|
||||||
|
cpp = false,
|
||||||
|
c = false,
|
||||||
|
h = false,
|
||||||
|
hpp = false,
|
||||||
|
cxx = false,
|
||||||
|
},
|
||||||
|
prompt_func_param_type = {
|
||||||
|
go = false,
|
||||||
|
java = false,
|
||||||
|
cpp = false,
|
||||||
|
c = false,
|
||||||
|
h = false,
|
||||||
|
hpp = false,
|
||||||
|
cxx = false,
|
||||||
|
},
|
||||||
|
printf_statements = {},
|
||||||
|
print_var_statements = {},
|
||||||
|
},
|
||||||
|
config = function(_, options)
|
||||||
|
require("refactoring").setup(options)
|
||||||
|
require("telescope").load_extension("refactoring")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue