{"_id":"open-in-editor","_rev":"1516783","name":"open-in-editor","description":"Open file in editor","dist-tags":{"latest":"2.2.0"},"maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"time":{"modified":"2021-11-10T06:23:38.000Z","created":"2015-09-24T18:14:30.517Z","2.2.0":"2017-03-22T23:53:39.333Z","2.1.0":"2017-03-21T09:45:45.237Z","2.0.0":"2017-03-15T13:14:57.139Z","1.2.1":"2016-11-14T12:53:20.667Z","1.2.0":"2015-11-12T18:26:19.016Z","1.1.0":"2015-11-08T16:11:50.348Z","1.0.1":"2015-09-24T18:26:37.625Z","1.0.0":"2015-09-24T18:14:30.517Z"},"users":{"lahmatiy":true,"belirafon":true,"mvaden":true},"author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/lahmatiy/open-in-editor.git"},"versions":{"2.2.0":{"name":"open-in-editor","description":"Open file in editor","version":"2.2.0","author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lahmatiy/open-in-editor.git"},"keywords":["open","file","editor","atom","code","vscode","idea","phpstorm","webstorm","sublime","visual studio","vim","emacs"],"main":"./lib/index.js","engines":{"node":">=0.12.0"},"bin":{"oe":"./bin/oe"},"dependencies":{"clap":"^1.1.3","os-homedir":"~1.0.2"},"devDependencies":{},"scripts":{},"gitHead":"64cddf8d5ae765061169c8267fa15d0dcc9f557d","bugs":{"url":"https://github.com/lahmatiy/open-in-editor/issues"},"homepage":"https://github.com/lahmatiy/open-in-editor#readme","_id":"open-in-editor@2.2.0","_shasum":"c5b21aa76f6acd4cbbd3c3b2e77dccb4b75a2020","_from":".","_npmVersion":"4.4.1","_nodeVersion":"6.8.1","_npmUser":{"name":"lahmatiy","email":"rdvornov@gmail.com"},"maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"dist":{"shasum":"c5b21aa76f6acd4cbbd3c3b2e77dccb4b75a2020","size":10158,"noattachment":false,"key":"/open-in-editor/-/open-in-editor-2.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/open-in-editor/download/open-in-editor-2.2.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/open-in-editor-2.2.0.tgz_1490226817363_0.5642598161939532"},"directories":{},"publish_time":1490226819333,"_cnpm_publish_time":1490226819333,"_hasShrinkwrap":false},"2.1.0":{"name":"open-in-editor","description":"Open file in editor","version":"2.1.0","author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/lahmatiy/open-in-editor"},"keywords":["open","file","editor","atom","code","vscode","idea","phpstorm","webstorm","sublime","visual studio","vim","emacs"],"main":"./lib/index.js","engines":{"node":">=0.12.0"},"bin":{"oe":"./bin/oe"},"dependencies":{"clap":"^1.1.3","os-homedir":"~1.0.2"},"devDependencies":{},"scripts":{},"gitHead":"fdfdd3549a6a11c1eb230e9e8006a42b68e195a2","bugs":{"url":"https://github.com/lahmatiy/open-in-editor/issues"},"homepage":"https://github.com/lahmatiy/open-in-editor","_id":"open-in-editor@2.1.0","_shasum":"1309a2484acba2fbd6339dafb8c17e808177012b","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"lahmatiy","email":"rdvornov@gmail.com"},"maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"dist":{"shasum":"1309a2484acba2fbd6339dafb8c17e808177012b","size":9709,"noattachment":false,"key":"/open-in-editor/-/open-in-editor-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/open-in-editor/download/open-in-editor-2.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/open-in-editor-2.1.0.tgz_1490089544662_0.9077466041781008"},"directories":{},"publish_time":1490089545237,"_cnpm_publish_time":1490089545237,"_hasShrinkwrap":false},"2.0.0":{"name":"open-in-editor","description":"Open file in editor","version":"2.0.0","author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/lahmatiy/open-in-editor"},"keywords":["open","file","editor","atom","code","idea","phpstorm","webstorm","sublime"],"main":"./lib/index.js","engines":{"node":">=0.12.0"},"bin":{"oe":"./bin/oe"},"dependencies":{"clap":"^1.0.8","os-homedir":"1.0.1"},"devDependencies":{},"scripts":{},"gitHead":"865bb9a09fb04565bc1736ccd3e1692fb736a947","bugs":{"url":"https://github.com/lahmatiy/open-in-editor/issues"},"homepage":"https://github.com/lahmatiy/open-in-editor","_id":"open-in-editor@2.0.0","_shasum":"0215b6db7f216ef0d0c047914c81c5ad58cf1f12","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"lahmatiy","email":"rdvornov@gmail.com"},"maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"dist":{"shasum":"0215b6db7f216ef0d0c047914c81c5ad58cf1f12","size":9444,"noattachment":false,"key":"/open-in-editor/-/open-in-editor-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/open-in-editor/download/open-in-editor-2.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/open-in-editor-2.0.0.tgz_1489583696495_0.11399315483868122"},"directories":{},"publish_time":1489583697139,"_cnpm_publish_time":1489583697139,"_hasShrinkwrap":false},"1.2.1":{"name":"open-in-editor","description":"Open file in editor","version":"1.2.1","author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/lahmatiy/open-in-editor"},"keywords":["open","file","editor","atom","code","idea","phpstorm","webstorm","sublime"],"main":"./lib/index.js","bin":{"oe":"./bin/oe"},"dependencies":{"clap":"^1.0.8","es6-promise-polyfill":"^1.0.2","os-homedir":"1.0.1"},"devDependencies":{},"scripts":{},"gitHead":"b6f08843901c15fed5adc74cdda05bf1e9ae8b79","bugs":{"url":"https://github.com/lahmatiy/open-in-editor/issues"},"homepage":"https://github.com/lahmatiy/open-in-editor","_id":"open-in-editor@1.2.1","_shasum":"31e418fd37e509f88b805194629394dfb2ac30b2","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"lahmatiy","email":"rdvornov@gmail.com"},"maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"dist":{"shasum":"31e418fd37e509f88b805194629394dfb2ac30b2","size":7638,"noattachment":false,"key":"/open-in-editor/-/open-in-editor-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/open-in-editor/download/open-in-editor-1.2.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/open-in-editor-1.2.1.tgz_1479127998575_0.6218061656691134"},"directories":{},"publish_time":1479128000667,"_cnpm_publish_time":1479128000667,"_hasShrinkwrap":false},"1.2.0":{"name":"open-in-editor","description":"Open file in editor","version":"1.2.0","author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lahmatiy/open-in-editor.git"},"keywords":["open","file","editor","atom","code","idea","phpstorm","webstorm","sublime"],"main":"./lib/index.js","bin":{"oe":"./bin/oe"},"dependencies":{"clap":"^1.0.8","es6-promise-polyfill":"^1.0.2","os-homedir":"1.0.1"},"devDependencies":{},"scripts":{},"gitHead":"e26c203bbef2f9bce67d4ad62e1d3753bc4daf50","bugs":{"url":"https://github.com/lahmatiy/open-in-editor/issues"},"homepage":"https://github.com/lahmatiy/open-in-editor#readme","_id":"open-in-editor@1.2.0","_shasum":"f39ac26974972f88d7c3aed87bdea0bde1073615","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"lahmatiy","email":"rdvornov@gmail.com"},"maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"dist":{"shasum":"f39ac26974972f88d7c3aed87bdea0bde1073615","size":7473,"noattachment":false,"key":"/open-in-editor/-/open-in-editor-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/open-in-editor/download/open-in-editor-1.2.0.tgz"},"directories":{},"publish_time":1447352779016,"_cnpm_publish_time":1447352779016,"_hasShrinkwrap":false},"1.1.0":{"name":"open-in-editor","description":"Open file in editor","version":"1.1.0","author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lahmatiy/open-in-editor.git"},"keywords":["open","file","editor","atom","code","idea","phpstorm","webstorm","sublime"],"main":"./lib/index.js","bin":{"oe":"./bin/oe"},"dependencies":{"clap":"^1.0.8","es6-promise-polyfill":"^1.0.2","os-homedir":"1.0.1"},"devDependencies":{},"scripts":{},"gitHead":"7cfcbe1cca890362f0926882cb798be0da3ff3fe","bugs":{"url":"https://github.com/lahmatiy/open-in-editor/issues"},"homepage":"https://github.com/lahmatiy/open-in-editor#readme","_id":"open-in-editor@1.1.0","_shasum":"e0976949f3e6146c99d11b4f70393df730a3d856","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"lahmatiy","email":"rdvornov@gmail.com"},"maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"dist":{"shasum":"e0976949f3e6146c99d11b4f70393df730a3d856","size":7155,"noattachment":false,"key":"/open-in-editor/-/open-in-editor-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/open-in-editor/download/open-in-editor-1.1.0.tgz"},"directories":{},"publish_time":1446999110348,"_cnpm_publish_time":1446999110348,"_hasShrinkwrap":false},"1.0.1":{"name":"open-in-editor","description":"Open file in editor","version":"1.0.1","author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lahmatiy/open-in-editor.git"},"keywords":["open","file","editor"],"main":"./lib/index.js","preferGlobal":true,"bin":{"oe":"./bin/oe"},"dependencies":{"clap":"^1.0.8","es6-promise-polyfill":"^1.0.2","os-homedir":"1.0.1"},"devDependencies":{},"scripts":{},"gitHead":"539707e6de03b6faddf54e9e27f910263d177e2b","bugs":{"url":"https://github.com/lahmatiy/open-in-editor/issues"},"homepage":"https://github.com/lahmatiy/open-in-editor#readme","_id":"open-in-editor@1.0.1","_shasum":"93e74a08ea0b2f5b42cb40946676f8e500a46fc6","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"lahmatiy","email":"rdvornov@gmail.com"},"maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"dist":{"shasum":"93e74a08ea0b2f5b42cb40946676f8e500a46fc6","size":6545,"noattachment":false,"key":"/open-in-editor/-/open-in-editor-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/open-in-editor/download/open-in-editor-1.0.1.tgz"},"directories":{},"publish_time":1443119197625,"_cnpm_publish_time":1443119197625,"_hasShrinkwrap":false},"1.0.0":{"name":"open-in-editor","description":"Open file in editor","version":"1.0.0","author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lahmatiy/open-in-editor.git"},"keywords":["open","file","editor"],"main":"./lib/index.js","preferGlobal":true,"bin":{"oe":"./bin/oe"},"dependencies":{"clap":"^1.0.8","es6-promise-polyfill":"^1.0.2","os-homedir":"1.0.1"},"devDependencies":{},"scripts":{},"gitHead":"b4e2ab42561ad13b6f65e6a5cdc0f43982a2faa5","bugs":{"url":"https://github.com/lahmatiy/open-in-editor/issues"},"homepage":"https://github.com/lahmatiy/open-in-editor#readme","_id":"open-in-editor@1.0.0","_shasum":"465e573e3b78c2beb0b90f5c96162ae9ad366277","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"lahmatiy","email":"rdvornov@gmail.com"},"maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"dist":{"shasum":"465e573e3b78c2beb0b90f5c96162ae9ad366277","size":6471,"noattachment":false,"key":"/open-in-editor/-/open-in-editor-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/open-in-editor/download/open-in-editor-1.0.0.tgz"},"directories":{},"publish_time":1443118470517,"_cnpm_publish_time":1443118470517,"_hasShrinkwrap":false}},"readme":"[![NPM version](https://img.shields.io/npm/v/open-in-editor.svg)](https://www.npmjs.com/package/open-in-editor)\n\nNPM package to open a file in editor.\n\nSupported editors:\n\n- [Sublime Text](http://www.sublimetext.com/)\n- [Atom Editor](https://atom.io/)\n- [Visual Studio Code](https://code.visualstudio.com/)\n- [WebStorm](https://www.jetbrains.com/webstorm/)\n- [PhpStorm](https://www.jetbrains.com/phpstorm/)\n- [IDEA 14 Community Edition](https://www.jetbrains.com/idea/download/)\n- [Vim](http://www.vim.org/)\n- [Emacs](https://www.gnu.org/software/emacs/)\n- [Visual Studio](https://www.visualstudio.com/)\n\nYou also can use any other editor that is able to open files from command line.\n\n## Installation\n\n```\nnpm install open-in-editor\n```\n\n## Usage\n\nFirst of all you should create an interface with your settings.\n\n```js\nvar openInEditor = require('open-in-editor');\nvar editor = openInEditor.configure({\n  // options\n}, function(err) {\n  console.error('Something went wrong: ' + err);\n});\n```\n\nResulting object has a single method `open`. This method runs terminal command that opens an editor. Result of this method is a promise:\n\n```js\neditor.open('path/to/file.js:3:10')\n  .then(function() {\n    console.log('Success!');\n  }, function(err) {\n    console.error('Something went wrong: ' + err);\n  });\n```\n\n## API\n\n```\nopenInEditor.configure([options][, failCallback]);\n```\n\nArguments:\n\n- `options` – *optional* is used to set up a command to launch an editor. If no options set it will try to get the command from [environment](#environment)\n- `failCallback` – *optional* function that is called when something's wrong with editor setup.\n\nIf editor setup was successful `configure` method returns an interface with single method `open`. The method accepts file reference with the following format: `filename[:line[:column]]`, where `line` and `column` tell the editor where to place cursor when file is opened.\n\n### Options\n\n#### editor\n\nType: `String` or `null`  \nValues: `'sublime'`, `'atom'`, `'code'`, `'webstorm'`, `'phpstorm'`, `'idea14ce'`, `'vim'`, `'emacs'`, `'visualstudio'`  \nDefault: `null`\n\nEditor to open a file. Once value is set, we try to detect a command to launch an editor.\n\nSupported editors:\n\n- `sublime` – Sublime Text\n- `atom` – Atom Editor\n- `code` – Visual Studio Code\n- `webstorm` – WebStorm\n- `phpstorm` - PhpStorm\n- `idea14ce` – IDEA 14 CE\n- `vim` – Vim (via Terminal, Mac OS only)\n- `emacs` – Emacs (via Terminal, Mac OS only)\n- `visualstudio` – Visual Studio\n\n#### cmd\n\nType: `String` or `null`  \nDefault: `null`\n\nCommand to launch an editor.\n\n```js\nvar openInEditor = require('open-in-editor');\nvar editor = openInEditor.configure({\n  cmd: '/path/to/editor/app'\n});\n```\n\nIf `editor` option is also set, an editor settings are using as default settings.\n\n```js\nvar openInEditor = require('open-in-editor');\nvar editor = openInEditor.configure({\n  editor: 'code',\n  cmd: '/path/to/editor/app' // will be called as '/path/to/editor/app -r -g {filename}:{line}:{column}'\n});\n```\n\n#### pattern\n\nType: `String` or `null`  \nDefault: `null`\n\nOption to specify arguments for a command. Pattern can contain placeholders to be replaced by actual values. Supported placeholders: `filename`, `line` and `column`.\n\n```js\nvar openInEditor = require('open-in-editor');\nvar editor = openInEditor.configure({\n  cmd: 'code',\n  pattern: '-r -g {filename}:{line}:{column}'\n});\n```\n\nIf there's no `{filename}` placeholder in the command then `{filename}:{line}:{column}` is appended. That way previous example can be simplified:\n\n```js\nvar openInEditor = require('open-in-editor');\nvar editor = openInEditor.configure({\n  cmd: 'code',\n  pattern: '-r -g' // the same as '-r -g {filename}:{line}:{column}'\n});\n```\n\n#### line\n\nType: `Number`  \nDefault: `1`\n\nDefines the number of the first line in the editor. Usually it's `1`, but you can set it to `0`.\n\n#### column\n\nType: `Number`  \nDefault: `1`\n\nDefines the number of the first column in the editor. Usually it's `1`, but you can set it to `0`.\n\n\n## Environment\n\nIf no `editor` or `cmd` option is specified, we try to get the command to launch an editor using environment settings. Following values can be used (in descending priority):\n\n- `process.env.OPEN_FILE`\n- `process.env.VISUAL`\n- `process.env.EDITOR`\n\nFirst value found is used. If it's `process.env.VISUAL` or `process.env.EDITOR`, it's used directly as `cmd` option. But `process.env.OPEN_FILE` is different: if value is a valid for `editor` option, it's used for it, otherwise it's used as a value for `cmd` option.\n\nYou can set env settings per command:\n\n```\nOPEN_FILE=atom oe path/to/file.js:4:15\nOPEN_FILE=\"code -r -g\" node script.js\n```\n\n## CLI\n\nPackage could be installed globally.\n\n```\nnpm install open-in-editor -g\n```\n\nIn this case `oe` command will be available in terminal.\n\n```\nUsage:\n\n  oe [filename] [options]\n\nOptions:\n\n      --cmd <command>      Command to open file\n      --debug              Debug errors\n  -e, --editor <editor>    Editor: atom, code, sublime, webstorm, phpstorm, idea14ce, vim, visualstudio, emacs\n  -f, --file <filename>    File to open\n  -h, --help               Output usage information\n  -p, --pattern <pattern>  Filename pattern and args, i.e. something going after cmd\n  -v, --version            Output the version\n```\n\n## Related projects\n\n- [express-open-in-editor](https://github.com/lahmatiy/express-open-in-editor) – `Express` extension to open files from browser.\n- [babel-plugin-source-wrapper](https://github.com/restrry/babel-plugin-source-wrapper) – `Babel` plugin that instruments source code to associate objects with location they defined in code base.\n- [Component Inspector](https://github.com/lahmatiy/component-inspector) – developer tool to inspect components that can open component creation source location in editor. Has integrations for `React`, `Backbone` and can be adopted for other frameworks.\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/lahmatiy/open-in-editor#readme","bugs":{"url":"https://github.com/lahmatiy/open-in-editor/issues"},"license":"MIT"}