-
Notifications
You must be signed in to change notification settings - Fork 990
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(extras): add refactoring.nvim (#3040)
* feat(editor): add refactoring.nvim More on: https://github.com/ThePrimeagen/refactoring.nvim#features * Update lua/lazyvim/plugins/extras/editor/refactoring.lua Co-authored-by: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> * Update lua/lazyvim/plugins/extras/editor/refactoring.lua Co-authored-by: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> * indent fixes --------- Co-authored-by: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com>
- Loading branch information
1 parent
f449025
commit 73de8dd
Showing
1 changed file
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
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(_, opts) | ||
require("refactoring").setup(opts) | ||
if LazyVim.has("telescope.nvim") then | ||
LazyVim.on_load("telescope.nvim", function() | ||
require("telescope").load_extension("refactoring") | ||
end) | ||
end | ||
end, | ||
}, | ||
} |