Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olrtg/nvim-rename-state
Rename the getter and the setter of a state hook in react/solidjs at the same time.
https://github.com/olrtg/nvim-rename-state
neovim nvim
Last synced: 4 days ago
JSON representation
Rename the getter and the setter of a state hook in react/solidjs at the same time.
- Host: GitHub
- URL: https://github.com/olrtg/nvim-rename-state
- Owner: olrtg
- License: mit
- Created: 2022-09-23T00:14:03.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-02T01:01:40.000Z (6 months ago)
- Last Synced: 2024-08-02T13:33:11.421Z (3 months ago)
- Topics: neovim, nvim
- Language: Lua
- Homepage:
- Size: 12.7 KB
- Stars: 23
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nvim-rename-state
Rename the getter and a setter of a state hook in react/solidjs at the same time using `:RenameState`.
```javascript
// Initial code
const [anchorEl, setAnchorEl] = useState(null)// After renaming with `:RenameState` or `:RenameState anchor`
const [anchor, setAnchor] = useState(null)
```## Features
- Leverages [Treesitter](https://tree-sitter.github.io/tree-sitter/) (requires [neovim](https://neovim.io/) >= 0.5.0).
- Supports Javascript and Typescript files.
- Supports [React](https://reactjs.org/) and [Solid](https://www.solidjs.com/) state hooks.## Installation
[lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
{ "olrtg/nvim-rename-state" }
```[packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use { "olrtg/nvim-rename-state" }
```[vim-plug](https://github.com/junegunn/vim-plug)
```vim
Plug 'olrtg/nvim-rename-state'
```## Usage
Put your cursor in the row of the defined `useState` or `createSignal` hook and use:
```vim
:RenameState
```Or if you want to pass the new name for the hook in advance:
```vim
:RenameState
```## Contributing
All contributions are welcomed! Just open a pull request or an issue.