All Projects → lahmatiy → Open In Editor

lahmatiy / Open In Editor

Licence: mit
NPM package to open a file in editor

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Open In Editor

sveltejs-idea-plugin
Idea plugin for sveltejs components
Stars: ✭ 14 (-92.51%)
Mutual labels:  idea, phpstorm, webstorm
Jetbrains Helper
Jetbrains helper
Stars: ✭ 33 (-82.35%)
Mutual labels:  phpstorm, idea, webstorm
Laravel Whoops Editor
Laravel Whoops Editor helps to open your code editor from exception stack trace.
Stars: ✭ 83 (-55.61%)
Mutual labels:  phpstorm, idea, sublime-text
JetBrains-scheme
JetBrains主题,更完美的高亮。支持 IntelliJ IDEA、phpstorm、goland、webstorm
Stars: ✭ 25 (-86.63%)
Mutual labels:  idea, phpstorm, webstorm
Translatorx
JetBrains 系列软件汉化包 关键字: Android Studio 3.5 汉化包 CLion 2019.3 汉化包 DataGrip 2019.3 汉化包 GoLand 2019.3 汉化包 IntelliJ IDEA 2019.3 汉化包 PhpStorm 2019.3 汉化包 PyCharm 2019.3 汉化包 Rider 2019.3 汉化包 RubyMine 2019.3 汉化包 WebStorm 2019.3 汉化包
Stars: ✭ 4,856 (+2496.79%)
Mutual labels:  phpstorm, webstorm
Ts Monorepo
Template for setting up a TypeScript monorepo
Stars: ✭ 459 (+145.45%)
Mutual labels:  vscode, webstorm
Public
Repository for wallaby.js questions and issues
Stars: ✭ 662 (+254.01%)
Mutual labels:  vscode, atom-editor
Vscode Material Theme
Port of the sublime text Material theme for Visual Studio Code in light and dark.
Stars: ✭ 21 (-88.77%)
Mutual labels:  vscode, sublime-text
Svelte Intellij
Svelte components in WebStorm and friends
Stars: ✭ 345 (+84.49%)
Mutual labels:  phpstorm, webstorm
Runconfigurationasaction
Provides a way to use IntelliJ run configurations as buttons
Stars: ✭ 17 (-90.91%)
Mutual labels:  phpstorm, webstorm
Dotfiles
What tools and plugins I use for web development?
Stars: ✭ 73 (-60.96%)
Mutual labels:  vscode, sublime-text
Intellij Plugin Save Actions
Supports configurable, Eclipse like, save actions, including "organize imports", "reformat code" and "rearrange code".
Stars: ✭ 440 (+135.29%)
Mutual labels:  phpstorm, webstorm
Themer
themer is inspired by trevordmiller/nova and chriskempson/base16.
Stars: ✭ 4,483 (+2297.33%)
Mutual labels:  vscode, sublime-text
Intellij Jvm Options Explained
Common JVM options used with Intellij and what they do
Stars: ✭ 636 (+240.11%)
Mutual labels:  phpstorm, webstorm
Jetbrains In Chinese
JetBrains 系列软件汉化包 关键字: Android Studio 3.5 汉化包 CLion 2019.3 汉化包 DataGrip 2019.3 汉化包 GoLand 2019.3 汉化包 IntelliJ IDEA 2019.3 汉化包 PhpStorm 2019.3 汉化包 PyCharm 2019.3 汉化包 Rider 2019.3 汉化包 RubyMine 2019.3 汉化包 WebStorm 2019.3 汉化包
Stars: ✭ 3,912 (+1991.98%)
Mutual labels:  phpstorm, webstorm
Webstorm License Key
Instruction how use license key for WebStorm & all JetBrains products
Stars: ✭ 85 (-54.55%)
Mutual labels:  phpstorm, webstorm
Mypy boto3 builder
Type annotations builder for boto3 compatible with VSCode, PyCharm, Emacs, Sublime Text, pyright and mypy.
Stars: ✭ 123 (-34.22%)
Mutual labels:  vscode, sublime-text
Tabnine Intellij
Jetbrains IDEs client for TabNine. Compatible with all IntelliJ-based IDEs. https://plugins.jetbrains.com/plugin/12798-tabnine
Stars: ✭ 140 (-25.13%)
Mutual labels:  phpstorm, webstorm
Jetbrains Alfred Workflow
Open a project with one of JetBrains' product.
Stars: ✭ 335 (+79.14%)
Mutual labels:  phpstorm, webstorm
Themer Gui
A graphical UI for themer. Replaced by Progressive Web App at https://themer.dev.
Stars: ✭ 337 (+80.21%)
Mutual labels:  vscode, sublime-text

NPM version

NPM package to open a file in editor.

Supported editors:

You also can use any other editor that is able to open files from command line.

Installation

npm install open-in-editor

Usage

First of all you should create an interface with your settings.

var openInEditor = require('open-in-editor');
var editor = openInEditor.configure({
  // options
}, function(err) {
  console.error('Something went wrong: ' + err);
});

Resulting object has a single method open. This method runs terminal command that opens an editor. Result of this method is a promise:

editor.open('path/to/file.js:3:10')
  .then(function() {
    console.log('Success!');
  }, function(err) {
    console.error('Something went wrong: ' + err);
  });

API

openInEditor.configure([options][, failCallback]);

Arguments:

  • optionsoptional is used to set up a command to launch an editor. If no options set it will try to get the command from environment
  • failCallbackoptional function that is called when something's wrong with editor setup.

If 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.

Options

editor

Type: String or null
Values: 'sublime', 'atom', 'code', 'webstorm', 'phpstorm', 'idea14ce', 'vim', 'emacs', 'visualstudio'
Default: null

Editor to open a file. Once value is set, we try to detect a command to launch an editor.

Supported editors:

  • sublime – Sublime Text
  • atom – Atom Editor
  • code – Visual Studio Code
  • webstorm – WebStorm
  • phpstorm - PhpStorm
  • idea14ce – IDEA 14 CE
  • vim – Vim (via Terminal, Mac OS only)
  • emacs – Emacs (via Terminal, Mac OS only)
  • visualstudio – Visual Studio

cmd

Type: String or null
Default: null

Command to launch an editor.

var openInEditor = require('open-in-editor');
var editor = openInEditor.configure({
  cmd: '/path/to/editor/app'
});

If editor option is also set, an editor settings are using as default settings.

var openInEditor = require('open-in-editor');
var editor = openInEditor.configure({
  editor: 'code',
  cmd: '/path/to/editor/app' // will be called as '/path/to/editor/app -r -g {filename}:{line}:{column}'
});

pattern

Type: String or null
Default: null

Option to specify arguments for a command. Pattern can contain placeholders to be replaced by actual values. Supported placeholders: filename, line and column.

var openInEditor = require('open-in-editor');
var editor = openInEditor.configure({
  cmd: 'code',
  pattern: '-r -g {filename}:{line}:{column}'
});

If there's no {filename} placeholder in the command then {filename}:{line}:{column} is appended. That way previous example can be simplified:

var openInEditor = require('open-in-editor');
var editor = openInEditor.configure({
  cmd: 'code',
  pattern: '-r -g' // the same as '-r -g {filename}:{line}:{column}'
});

line

Type: Number
Default: 1

Defines the number of the first line in the editor. Usually it's 1, but you can set it to 0.

column

Type: Number
Default: 1

Defines the number of the first column in the editor. Usually it's 1, but you can set it to 0.

Environment

If 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):

  • process.env.OPEN_FILE
  • process.env.VISUAL
  • process.env.EDITOR

First 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.

You can set env settings per command:

OPEN_FILE=atom oe path/to/file.js:4:15
OPEN_FILE="code -r -g" node script.js

CLI

Package could be installed globally.

npm install open-in-editor -g

In this case oe command will be available in terminal.

Usage:

  oe [filename] [options]

Options:

      --cmd <command>      Command to open file
      --debug              Debug errors
  -e, --editor <editor>    Editor: atom, code, sublime, webstorm, phpstorm, idea14ce, vim, visualstudio, emacs
  -f, --file <filename>    File to open
  -h, --help               Output usage information
  -p, --pattern <pattern>  Filename pattern and args, i.e. something going after cmd
  -v, --version            Output the version

Related projects

  • express-open-in-editorExpress extension to open files from browser.
  • babel-plugin-source-wrapperBabel plugin that instruments source code to associate objects with location they defined in code base.
  • 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.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].