editor

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 8 Imported by: 51 modules, 13 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package editor provides functionality for opening files in external editors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmd

func Cmd(app, path string, options ...Option) (*exec.Cmd, error)

Cmd returns a *exec.Cmd editing the given path with $EDITOR or nano if no $EDITOR is set. Deprecated: use Command or CommandContext instead.

func Command added in v0.2.0

func Command(app, path string, options ...Option) (*exec.Cmd, error)

Command returns a *exec.Cmd editing the given path with $EDITOR or nano if no $EDITOR is set.

func CommandContext added in v0.2.0

func CommandContext(ctx context.Context, app, path string, options ...Option) (*exec.Cmd, error)

CommandContext returns a *exec.Cmd editing the given path with $EDITOR or nano if no $EDITOR is set.

Types

type Option

type Option func(editor, filename string) (args []string, pathInArgs bool)

Option defines an editor option.

An Option may act differently in some editors, or not be supported in some of them.

func AtPosition added in v0.2.0

func AtPosition(line, column int) Option

AtPosition opens the file at the given line and column in supported editors. If line or column is less than 1, they will be set to 1. If the editor only supports line numbers, the column will be ignored.

func EndOfLine

func EndOfLine() Option

EndOfLine opens the file at the end of the line in supported editors.

func LineNumber

func LineNumber(number int) Option

LineNumber opens the file at the given line number in supported editors. If [number] is less than line 1, the file will be opened at line 1.

func OpenAtLine deprecated

func OpenAtLine(n int) Option

OpenAtLine opens the file at the given line number in supported editors.

Deprecated: use LineNumber instead.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL