New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

open-editor2

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

open-editor2

Open files in your editor at a specific line and column

latest
Source
npmnpm
Version
1.0.0-alpha.1
Version published
Maintainers
1
Created
Source

open-editor2

This is a fork of open-editor Add support for cjs+esm Add support for Cursor, Trae, Windsurf

Open files in your editor at a specific line and column

Supports any editor, but only the following editors will open at a specific line and column:

  • Sublime Text
  • Atom
  • Zed
  • Visual Studio Code
  • VSCodium
  • Cursor
  • Trae
  • Windsurf
  • WebStorm*
  • TextMate
  • Vim
  • NeoVim
  • IntelliJ IDEA*

*Doesn't support column.

Install

npm install open-editor

Usage

ESM:

import openEditor from 'open-editor';

openEditor(['unicorn.js:5:3']);

CommonJS:

const openEditor = require('open-editor');

openEditor(['unicorn.js:5:3']);

API

openEditor(files, options?)

Open the given files in the user's editor at specific line and column if supported by the editor. It does not wait for the editor to start or quit unless you specify wait: true in the options.

files

Type: string[]

Items should be in the format foo.js:1:5.

options

Type: object

interface Options {
	/**
	The editor to use.
	*/
	readonly editor?: string;

	/**
	Wait for the editor to close.

	@default false
	*/
	readonly wait?: boolean;
}

getEditorInfo(files, options?)

Same as openEditor(), but returns an object with the binary name, arguments, and a flag indicating whether the editor runs in the terminal.

Example: {binary: 'subl', arguments: ['foo.js:1:5'], isTerminalEditor: false}

Can be useful if you want to handle opening the files yourself.

import {getEditorInfo} from 'open-editor';

getEditorInfo([
	{
		file: 'foo.js',
		line: 1,
		column: 5,
	}
]);
//=> {binary: 'subl', arguments: ['foo.js:1:5'], isTerminalEditor: false}

Keywords

open

FAQs

Package last updated on 17 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts