Skip to content

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

License

Notifications You must be signed in to change notification settings

olrtg/nvim-rename-state

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages