Skip to content

Latest commit

 

History

17 提交

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

仓库 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>Code操作 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 :Code操作 all command to show a select list of available actions under the cursor.

Run :Code操作 [x] to run a specific code action.
For example: :Code操作 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

关于

A collection of nifty neovim code actions

Topics

Resources

Stars

21 stars

关注者

1 watching

复刻s

发布

贡献者

Languages