Skip to content

Register code actions to be run automatically on file save, based on file patterns.

License

Notifications You must be signed in to change notification settings

fnune/codeactions-on-save.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

codeactions-on-save.nvim

A Neovim plugin to register specific code actions to be run automatically on file save, based on file patterns.

Installation

Using lazy.nvim:

{
  "fnune/codeactions-on-save.nvim",
  config = function()
    local cos = require("codeactions-on-save")
    cos.register({ "*.py" }, { "source.organizeImports" })
    cos.register({ "*.ts", "*.tsx" }, { "source.organizeImports.biome", "source.fixAll" })
  end
}

The default timeout for code actions is 100ms. You can pass anything else if necessary, in ms:

cos.register({ "*.ts" }, { "source.organizeImports" }, 3000)

Inspecting code actions

To find out the action kind of the action you want to run, use this while inside a buffer with an LSP client attached:

:lua require("codeactions-on-save").inspect()

About

Register code actions to be run automatically on file save, based on file patterns.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages