{"id":15387252,"url":"https://github.com/rhysd/react-vimjs","last_synced_at":"2025-08-22T08:31:45.451Z","repository":{"id":57347404,"uuid":"43680545","full_name":"rhysd/react-vimjs","owner":"rhysd","description":"Vim in Your Web App","archived":false,"fork":false,"pushed_at":"2016-02-24T09:38:21.000Z","size":9548,"stargazers_count":166,"open_issues_count":5,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-05T10:36:21.762Z","etag":null,"topics":["emscripten","react","react-component","vim"],"latest_commit_sha":null,"homepage":"https://rhysd.github.io/react-vimjs","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhysd.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}},"created_at":"2015-10-05T11:32:57.000Z","updated_at":"2024-10-16T23:02:10.000Z","dependencies_parsed_at":"2022-08-28T04:00:51.930Z","dependency_job_id":null,"html_url":"https://github.com/rhysd/react-vimjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Freact-vimjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Freact-vimjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Freact-vimjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Freact-vimjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhysd","download_url":"https://codeload.github.com/rhysd/react-vimjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229919904,"owners_count":18144850,"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":["emscripten","react","react-component","vim"],"created_at":"2024-10-01T14:53:01.600Z","updated_at":"2024-12-20T11:08:07.257Z","avatar_url":"https://github.com/rhysd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![React TRUE Vim Component](https://raw.githubusercontent.com/rhysd/react-vimjs/master/misc/react-vimjs-bannar.jpg)\n========================\n[![Build Status](https://travis-ci.org/rhysd/react-vimjs.svg)](https://travis-ci.org/rhysd/react-vimjs)\n\nThis is a [Vim.js](https://github.com/coolwanglu/vim.js) component for [React.js](https://facebook.github.io/react/).  You can easily introduce Vim into your React.js web application.\n\nPlease try [Markdown Demo](http://rhysd.github.io/react-vimjs/).  The source code of this demo is [here](example).\n\n## Install\n\nInstall via [npm](https://www.npmjs.com).\n\n```\n$ npm install react-vimjs\n```\n\n## Usage\n\n### Basic Usage\n\nYou can use `\u003cVim\u003e` component.\n\n- `index.js`\n\n```javascript\nimport React from 'react'\nimport Vim from 'react-vimjs'\n\nReact.render(\n  \u003cVim memPath=\"path/to/dist/vim.js.mem\"\u003e Loading... \u003c/Vim\u003e,\n  document.body\n);\n```\n\n- `index.html`\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"utf-8\" /\u003e\n    \u003ctitle\u003eHello, react-vimjs\u003c/title\u003e\n    \u003clink rel=\"stylesheet\" href=\"path/to/dist/vim.css\"\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n  \u003c/body\u003e\n  \u003cscript src=\"path/to/index.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"path/to/dist/vim.js\"\u003e\u003c/script\u003e\n\u003c/html\u003e\n```\n\nYou need to link `vim.css` in `dist` directory and load `vim.js` with `\u003cscript\u003e` tag after loading your `index.js`.  And set path to `vim.js.mem` as property of `\u003cVim\u003e` component.\n`\u003cVim\u003e` has many other optional properties. (Document is TODO)\n\nBasically all files are put on memory so it is volatile after closing the page.  Only `.vimrc` is saved to local storage.\n\n### Edit Local File\n\nYou can load local file with file chooser easily with `\u003cFileUpload\u003e` component.\n\n```javascript\nimport Vim,{FileUpload} from 'react-vimjs'\n\nReact.render(\n  \u003cdiv\u003e\n    \u003cVim memPath=\"path/to/vim.js.mem\"\u003e Loading... \u003c/Vim\u003e\n    \u003cFileUpload onUpload={(dir, name) =\u003e alert(\"Loaded \" + dir + \"/\" + name)}\u003e\n      \u003cbutton type=\"button\"\u003e\n        Edit Local File\n      \u003c/button\u003e\n    \u003c/FileUpload\u003e\n  \u003c/div\u003e,\n  document.body\n);\n```\n\nChildren of `\u003cFileUpload\u003e` component gets clickable.  When clicked, `\u003cinput\u003e` file chooser is launched and you can select a file.  If `onUpload` property is set, it is called with the path to loaded file after loading the file is success.  When `blah.txt` is selected, `/root/blah.txt` is created in Emscripten filesystem and you can open it with `:edit blah.txt`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhysd%2Freact-vimjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhysd%2Freact-vimjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhysd%2Freact-vimjs/lists"}