Skip to content

A simple neovim plugin for refactoring code

License

Notifications You must be signed in to change notification settings

tiyashbasu/refactor.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

refactor.nvim

A neovim plugin to refactor code.

The implementation is just a set of thin wrappers over a few basic vim functions, but these expose a few convenient functions in a more approachable manner, that help me get over my inertia.

The plugin contains the following functions:

  • lsp_rename_symbol(): Replace the current symbol using the LSP.
  • text_replace_word(): Replace the current word using s///g
  • text_replace_selection(): Replace the current selection using s///g

Installation and Usage

lazy.nvim

Here is an example of how to use refactor.nvim with lazy.nvim, with custom keybindings:

{
    "tiyashbasu/refactor.nvim",
    config = function()
        local refactor = require("refactor")

        vim.keymap.set("n", "<F2>", function()
            refactor.lsp_rename_symbol()
        end, {})

        vim.keymap.set("n", "<F3>", function()
            refactor.text_replace_word()
        end, {})


        vim.keymap.set("v", "<F3>", function()
            refactor.text_replace_selection()
        end, {})
    end,
}

I do not know any other neovim plugin manager, so this is it ¯\_(ツ)_/¯

About

A simple neovim plugin for refactoring code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages