{"action":"created","issue":{"url":"https://api.github.com/repos/coolwanglu/vim.js/issues/11","labels_url":"https://api.github.com/repos/coolwanglu/vim.js/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/coolwanglu/vim.js/issues/11/comments","events_url":"https://api.github.com/repos/coolwanglu/vim.js/issues/11/events","html_url":"https://github.com/coolwanglu/vim.js/issues/11","id":24306511,"number":11,"title":"Extensions Design","user":{"login":"coolwanglu","id":734614,"avatar_url":"https://avatars.githubusercontent.com/u/734614?v=3","gravatar_id":"","url":"https://api.github.com/users/coolwanglu","html_url":"https://github.com/coolwanglu","followers_url":"https://api.github.com/users/coolwanglu/followers","following_url":"https://api.github.com/users/coolwanglu/following{/other_user}","gists_url":"https://api.github.com/users/coolwanglu/gists{/gist_id}","starred_url":"https://api.github.com/users/coolwanglu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coolwanglu/subscriptions","organizations_url":"https://api.github.com/users/coolwanglu/orgs","repos_url":"https://api.github.com/users/coolwanglu/repos","events_url":"https://api.github.com/users/coolwanglu/events{/privacy}","received_events_url":"https://api.github.com/users/coolwanglu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2013-12-15T06:17:56Z","updated_at":"2015-03-31T17:50:45Z","closed_at":null,"body":"This is only a draft,  any ideas are welcome.\r\n\r\n\r\n### Motivation\r\n\r\nSeems that lots of people are expecting web integrations in vim.js, indeed it might be a good combination for lots of different services, but they might not be necessary for all the users.\r\n\r\nA better solution might be to expose enough interface such that people can write and enable only the extensions they need. somewhat like vundle.\r\n\r\n\r\n\r\n### Run JavaScript inside Vim.js\r\n\r\nVim script is powerful and widely used, but may be it's too large/slow on vim.js. But sometimes Vim script does not make sense as we have a native JS engine behind it, and javascript is more powerful.\r\n\r\nThe easiest way of implementation is to hijack `:!`, it makes sense, easy to use and implement. It's my preferred way, but maybe it will be conflict with existing plugins (suppose that vim script is supported in the future) due to the semantic meaning. But anyway there's no shell (so far) in emscripten and `:!` won't work anyway...\r\n\r\nOtherwise we need to define a new command other than `:!`, which requires further modification to the original Vim, and I'm kind of against it.\r\n\r\nCommon functions can be defined inside the vimjs JS Object.\r\n\r\n\r\n### Load external JavaScript \r\n\r\n`:!vimjs.load_js(url)` looks like a good choice\r\n\r\n\r\n\r\n### Interaction with Vim.js through JS\r\n\r\nTo actually access the buffer and other internal structures.\r\n\r\nNeed lots of work to do, or maybe to enable Vim script instead ... Not sure right now.\r\n\r\n\r\n\r\n### File System Extensions\r\n\r\nSeems to be popularly demanded, which are fortunately not hard to implement. As long as js can be executed inside vim.js, people can mount different FS using emscripten FS API\r\n\r\nRelative libraries:\r\n- BrowserFS\r\n- dropbox-js\r\n\r\n\r\n\r\n### Async Function Calls\r\n\r\nSometimes only async functions are available (e.g. `setTimeout`), such that you cannot block the current execution until some condition is met.\r\n\r\nFortunately Vim.js allows you suspend and resume it, such that you can simulate a blocking operation, which actually blocks Vim.js but does not freeze your browser. An extra callback will be provided to resume Vim.js.\r\n\r\nNeed to work out a new syntax other than `:!`, as `:!` should be reserved as a handy to for sync calls."},"comment":{"url":"https://api.github.com/repos/coolwanglu/vim.js/issues/comments/88186832","html_url":"https://github.com/coolwanglu/vim.js/issues/11#issuecomment-88186832","issue_url":"https://api.github.com/repos/coolwanglu/vim.js/issues/11","id":88186832,"user":{"login":"jordwalke","id":977348,"avatar_url":"https://avatars.githubusercontent.com/u/977348?v=3","gravatar_id":"","url":"https://api.github.com/users/jordwalke","html_url":"https://github.com/jordwalke","followers_url":"https://api.github.com/users/jordwalke/followers","following_url":"https://api.github.com/users/jordwalke/following{/other_user}","gists_url":"https://api.github.com/users/jordwalke/gists{/gist_id}","starred_url":"https://api.github.com/users/jordwalke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordwalke/subscriptions","organizations_url":"https://api.github.com/users/jordwalke/orgs","repos_url":"https://api.github.com/users/jordwalke/repos","events_url":"https://api.github.com/users/jordwalke/events{/privacy}","received_events_url":"https://api.github.com/users/jordwalke/received_events","type":"User","site_admin":false},"created_at":"2015-03-31T17:50:45Z","updated_at":"2015-03-31T17:50:45Z","body":"Making an async API ensures that plugin authors must write nonblocking plugins. Then, these plugins could even be compiled *into* python code (https://github.com/PiotrDabkowski/Js2Py) or used directly via `pyv8` and ran in the standard Vim with python enabled. `<mind-blown />`"}}