editor

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2017 License: MIT Imports: 6 Imported by: 2 modules, 3 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

Index

Constants

This section is empty.

Variables

View Source
var ErrFileUnsaved = errors.New("file was not saved")

ErrFileUnsaved is returned if the user exited a vi-like editor without saving the file.

Functions

This section is empty.

Types

type Basic

type Basic struct {
	// contains filtered or unexported fields
}

Basic is an editor without special abilities. We can't detect whether the user saved the file or not.

func NewBasic

func NewBasic(name string) (*Basic, error)

NewBasic builds a new basic editor.

func (*Basic) EditString

func (e *Basic) EditString(s string) (string, error)

EditString asks the user to edit the given string inside the editor.

func (*Basic) Name

func (e *Basic) Name() string

Name returns the name of the editor.

type Editor

type Editor interface {
	EditString(string) (string, error)
}

Editor allows editing strings.

func Pick

func Pick(name string) (Editor, error)

Pick an editor based on the given name.

type ViLike

type ViLike struct {
	// contains filtered or unexported fields
}

ViLike is an editor backed by vi/vim/neovim/etc.

If the user exits the editor without saving the file, no changes are recorded.

func NewViLike

func NewViLike(name string) (*ViLike, error)

NewViLike builds a new vi-like editor.

func (*ViLike) EditString

func (vi *ViLike) EditString(in string) (string, error)

EditString asks the user to edit the given string inside a vi-like editor. ErrFileUnsaved is returned if the user exits the editor without saving the file.

func (*ViLike) Name

func (vi *ViLike) Name() string

Name of the editor.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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