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: 3

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