|
| 1 | +return { |
| 2 | + { |
| 3 | + "ThePrimeagen/refactoring.nvim", |
| 4 | + dependencies = { |
| 5 | + "nvim-lua/plenary.nvim", |
| 6 | + "nvim-treesitter/nvim-treesitter", |
| 7 | + }, |
| 8 | + config = function() |
| 9 | + require("refactoring").setup() |
| 10 | + vim.keymap.set("x", "<leader>re", function() require('refactoring').refactor('Extract Function') end |
| 11 | + , { desc = '[E]xtract Function' }) |
| 12 | + vim.keymap.set("x", "<leader>rf", function() require('refactoring').refactor('Extract Function To File') end, |
| 13 | + { desc = 'Extract Function to [F]ile' }) |
| 14 | + -- Extract function supports only visual mode |
| 15 | + vim.keymap.set("x", "<leader>rv", function() require('refactoring').refactor('Extract Variable') end |
| 16 | + , { desc = 'Extract [V]ariable' }) |
| 17 | + -- Extract variable supports only visual mode |
| 18 | + vim.keymap.set("n", "<leader>rI", function() require('refactoring').refactor('Inline Function') end |
| 19 | + , { desc = '[I]nline Function' }) |
| 20 | + -- Inline func supports only normal |
| 21 | + vim.keymap.set({ "n", "x" }, "<leader>ri", function() require('refactoring').refactor('Inline Variable') end |
| 22 | + , { desc = '[I]nline Variable' }) |
| 23 | + -- Inline var supports both normal and visual mode |
| 24 | + |
| 25 | + vim.keymap.set("n", "<leader>rb", function() require('refactoring').refactor('Extract Block') end, |
| 26 | + { desc = 'Extract [B]lock' }) |
| 27 | + vim.keymap.set("n", "<leader>rbf", function() require('refactoring').refactor('Extract Block To File') end, |
| 28 | + { desc = 'Extract [B]lock to [F]ile' }) |
| 29 | + -- Extract block supports only normal mode |
| 30 | + end, |
| 31 | + }, |
| 32 | +} |
0 commit comments