Skip to content

Refactoring Extra

editor.refactoring installs refactoring.nvim, a Treesitter-powered refactoring helper for extracting, inlining, and print-debug workflows.

return {
extras = {
enabled = {
"editor.refactoring",
},
},
}

Because this extra adds a plugin, run:

:BlakExtras sync
Surface Contribution
Plugin ThePrimeagen/refactoring.nvim
Dependencies plenary.nvim, nvim-treesitter
Keymap <leader>re extracts a function
Keymap <leader>rf extracts a function to a file
Keymap <leader>rv extracts a variable
Keymap <leader>ri inlines a variable
Keymap <leader>rI inlines a function
Keymap <leader>rp inserts a print-debug statement
Keymap <leader>rc cleans up print-debug statements

The keymaps appear in :BlakKeys.

Most refactors are visual-mode actions because they operate on a selected code range.