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)
- Leverages Treesitter (requires neovim >= 0.5.0).
- Supports Javascript and Typescript files.
- Supports React and Solid state hooks.
{ "olrtg/nvim-rename-state" }
use { "olrtg/nvim-rename-state" }
Plug 'olrtg/nvim-rename-state'
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>
All contributions are welcomed! Just open a pull request or an issue.