Skip to content

jdrupal-dev/code-refactor.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

code-refactor.nvim

code-refactor.nvim a collection of nifty code actions that do not require a LSP.

Screen.Recording.2024-01-29.at.9.56.03.mov

🔒 Requirements

📦 Installation

Install this plugin using your favorite plugin manager, and then call require("code-refactor").setup().

{
    "jdrupal-dev/code-refactor.nvim",
    dependencies = { "nvim-treesitter/nvim-treesitter" },
    keys = {
        { "<leader>cc", "<cmd>CodeActions all<CR>", desc = "Show code-refactor.nvim (not LSP code actions)" },
    },
    config = function()
        require("code-refactor").setup({
            -- Configuration here, or leave empty to use defaults.
        })
    end
}

🚀 Usage

Run the :CodeActions all command to show a select list of available actions under the cursor.

Run :CodeActions [x] to run a specific code action.
For example: :CodeActions toggle_arrow_function_braces.

⚙️ Configuration

The default configuration is found in lua/code-refactor/config.lua.
Simply call require("code-refactor").setup with the desired options.

To disable code actions for any given language, simply return an empty table in file_types.

require("code-refactor").setup({
    available_actions = {
        javascript = {
            file_types = {},
        },
    },
})

✨ Available actions

Name JavaScript PHP
General
Flip ternary yes yes
Negate expression yes yes
Convert arrow function yes yes
JavaScript
Toggle arrow function braces yes

About

A collection of nifty neovim code actions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published