Skip to content

Latest commit

 

History

History
55 lines (36 loc) · 1.17 KB

README.md

File metadata and controls

55 lines (36 loc) · 1.17 KB

nvim-rename-state

Rename the getter and a setter of a state hook in react/solidjs at the same time using :RenameState.

// Initial code
const [anchorEl, setAnchorEl] = useState(null)

// After renaming with `:RenameState` or `:RenameState anchor`
const [anchor, setAnchor] = useState(null)

Features

  • Leverages Treesitter (requires neovim >= 0.5.0).
  • Supports Javascript and Typescript files.
  • Supports React and Solid state hooks.

Installation

lazy.nvim

{ "olrtg/nvim-rename-state" }

packer.nvim

use { "olrtg/nvim-rename-state" }

vim-plug

Plug 'olrtg/nvim-rename-state'

Usage

Put your cursor in the row of the defined useState or createSignal hook and use:

:RenameState

Or if you want to pass the new name for the hook in advance:

:RenameState <new_name>

Contributing

All contributions are welcomed! Just open a pull request or an issue.