Refactor added
This commit is contained in:
parent
3c296e858c
commit
451718043a
2 changed files with 42 additions and 0 deletions
32
lua/custom/plugins/refactor.lua
Normal file
32
lua/custom/plugins/refactor.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
return {
|
||||
{
|
||||
"ThePrimeagen/refactoring.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
require("refactoring").setup()
|
||||
vim.keymap.set("x", "<leader>re", function() require('refactoring').refactor('Extract Function') end
|
||||
, { desc = '[E]xtract Function' })
|
||||
vim.keymap.set("x", "<leader>rf", function() require('refactoring').refactor('Extract Function To File') end,
|
||||
{ desc = 'Extract Function to [F]ile' })
|
||||
-- Extract function supports only visual mode
|
||||
vim.keymap.set("x", "<leader>rv", function() require('refactoring').refactor('Extract Variable') end
|
||||
, { desc = 'Extract [V]ariable' })
|
||||
-- Extract variable supports only visual mode
|
||||
vim.keymap.set("n", "<leader>rI", function() require('refactoring').refactor('Inline Function') end
|
||||
, { desc = '[I]nline Function' })
|
||||
-- Inline func supports only normal
|
||||
vim.keymap.set({ "n", "x" }, "<leader>ri", function() require('refactoring').refactor('Inline Variable') end
|
||||
, { desc = '[I]nline Variable' })
|
||||
-- Inline var supports both normal and visual mode
|
||||
|
||||
vim.keymap.set("n", "<leader>rb", function() require('refactoring').refactor('Extract Block') end,
|
||||
{ desc = 'Extract [B]lock' })
|
||||
vim.keymap.set("n", "<leader>rbf", function() require('refactoring').refactor('Extract Block To File') end,
|
||||
{ desc = 'Extract [B]lock to [F]ile' })
|
||||
-- Extract block supports only normal mode
|
||||
end,
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue