{"id":13494358,"url":"https://github.com/Balagha/nvim-ReFact","last_synced_at":"2025-03-28T14:31:03.490Z","repository":{"id":53337270,"uuid":"358641852","full_name":"Balagha/nvim-ReFact","owner":"Balagha","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-29T16:55:45.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-31T09:36:35.072Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Balagha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-04-16T15:24:39.000Z","updated_at":"2023-01-20T06:29:55.000Z","dependencies_parsed_at":"2024-01-16T09:53:13.239Z","dependency_job_id":"10e71b61-e1eb-4a16-ab76-6fe183aa0828","html_url":"https://github.com/Balagha/nvim-ReFact","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Balagha%2Fnvim-ReFact","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Balagha%2Fnvim-ReFact/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Balagha%2Fnvim-ReFact/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Balagha%2Fnvim-ReFact/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Balagha","download_url":"https://codeload.github.com/Balagha/nvim-ReFact/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246045858,"owners_count":20714858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:01:24.240Z","updated_at":"2025-03-28T14:31:03.181Z","avatar_url":"https://github.com/Balagha.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"# nvim-ReFact\n\n\u003eA [Neovim](https://neovim.io/) plugin Inspired by VSCode extension [Glean](https://github.com/wix/vscode-glean)\n\nThe plugin provides refactoring tools for your React codebase. Extract JSX into a new component, wrapping with Hooks and more!\n\n## Highlights\n\n- Allows extracting JSX into new component\n- Allows wrapping JSX with conditional\n\n## Requirements\n\n- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) including a parser for your language\n\n- [nui.nvim](https://github.com/MunifTanjim/nui.nvim)\n\n## Installation\n\n\u003cdetails\u003e\n\t\u003csummary\u003e\u003ca href=\"https://github.com/wbthomason/packer.nvim\"\u003ePacker.nvim\u003c/a\u003e\u003c/summary\u003e\n\n```lua\nuse 'Balagha/nvim-ReFact'\n```\n\u003c/details\u003e\n\u003cdetails\u003e\n\t\u003csummary\u003e\u003ca href=\"https://github.com/junegunn/vim-plug\"\u003evim-plug\u003c/a\u003e\u003c/summary\u003e\n\n```vim\nPlug 'Balagha/nvim-ReFact'\n```\n\u003c/details\u003e\n\u0026nbsp;\n\n## Extracting JSX into a new Component\n\ntreesitter-refact-react allows easy extraction of JSX into new React components (in the same or other file). Just select the JSX to extract, and it will handle all the rest:\n\n- Generate Functional Component, such that the extracted JSX will continue to function.\n- It will identify all inputs to the newly created component.\n- Replace extracted JSX with newly created component, while providing it with all the props.\n\nExamples:\n- `vv` to select the inner unit\n- `r` to change the JSX into new React components\n\ngif...\n\n### Useful mappings\n\u003cdetails\u003e\n\t\u003csummary\u003e\u003ca href=\"https://github.com/wbthomason/packer.nvim\"\u003einit.lua\u003c/a\u003e\u003c/summary\u003e\n\n```lua\nvim.api.nvim_set_keymap('n', 'vv', ':lua require\"nvim-ReFact\".select()\u003cCR\u003e', {noremap=true})\n\nvim.api.nvim_set_keymap('v', 'r', ':lua require\"nvim-ReFact\".change()\u003cCR\u003e', {noremap=true})\n```\n\u003c/details\u003e\n\u003cdetails\u003e\n\t\u003csummary\u003e\u003ca href=\"https://github.com/wbthomason/packer.nvim\"\u003einit.vim\u003c/a\u003e\u003c/summary\u003e\n\n```vim\nxnoremap vv :lua require\"nvim-ReFact\".select()\u003cCR\u003e\n\nxnoremap r :lua require\"nvim-ReFact\".change()\u003cCR\u003e\n```\n\u003c/details\u003e\n\u0026nbsp;\n\n## How to run this project into your machine\nmake sure you have fulfilled the [requirements](https://github.com/tamanna190101/nvim-ReFact#requirements) and necessary [key mappings](https://github.com/tamanna190101/nvim-ReFact#useful-mappings)\n```sh\n# clone this repo\n$ git clone https://github.com/tamanna190101/nvim-ReFact.git\n\n$ cd nvim-ReFact\n\n# set runtime path and open lua init.lua file and example.js file for test lua implementation\n$ nvim --cmd \"set rtp+=./\" lua/nvim-ReFact/init.lua -O example.js\n```\nTo setup Neovim Treesitter Playground follow this [link](https://github.com/nvim-treesitter/playground).\n## Licensing\n\nLicensed under the Apache License. Check the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBalagha%2Fnvim-ReFact","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBalagha%2Fnvim-ReFact","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBalagha%2Fnvim-ReFact/lists"}