editor

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action added in v0.4.2

type Action struct {
	Func func()
	Name string
}

Action defines a keyboard action.

type Bookmark added in v0.7.0

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

type Bookmarks added in v0.7.0

type Bookmarks struct {
	Max int
	// contains filtered or unexported fields
}

func NewBookmarks added in v0.7.0

func NewBookmarks() *Bookmarks

func (*Bookmarks) Add added in v0.7.0

func (b *Bookmarks) Add(name, filename string, line int)

func (*Bookmarks) Get added in v0.7.0

func (b *Bookmarks) Get(name string) (string, int)

func (*Bookmarks) Names added in v0.7.0

func (b *Bookmarks) Names() []string

type Editor

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

Editor is the main editor object. It orchestrates the terminal, the buffer, etc.

func NewEditor

func NewEditor() *Editor

NewEditor creates a new Editor object.

func (*Editor) AllLineBa added in v0.6.0

func (editor *Editor) AllLineBa()

AllLineBa searches the current line from cursor to the start, and makes multiple cursors (one for each match).

func (*Editor) AllLineFo added in v0.6.0

func (editor *Editor) AllLineFo()

AllLineFo searches the current line from cursor to the start, and makes multiple cursors (one for each match).

func (*Editor) AutoComplete added in v0.7.0

func (editor *Editor) AutoComplete(prefix string) []string

func (*Editor) Bookmark added in v0.7.0

func (editor *Editor) Bookmark()

func (*Editor) BookmarkMenu added in v0.7.0

func (editor *Editor) BookmarkMenu()

func (*Editor) CloseFile

func (editor *Editor) CloseFile() bool

CloseFile closes the current file.

func (*Editor) CmdMenu added in v0.4.2

func (editor *Editor) CmdMenu()

CmdMenu offers a menu of available commands.

func (*Editor) Cut

func (editor *Editor) Cut()

Cut cuts the current line and sticks it in the copy buffer.

func (*Editor) ExtraMode added in v0.4.2

func (editor *Editor) ExtraMode()

ExtraMode allows for additional keypresses.

func (*Editor) Flush

func (editor *Editor) Flush()

Flush writes the current buffer to the screen.

func (*Editor) GoToBookmark added in v0.7.0

func (editor *Editor) GoToBookmark(name string) error

func (*Editor) GoToLine added in v0.7.0

func (editor *Editor) GoToLine()

func (*Editor) HighlightCursors

func (editor *Editor) HighlightCursors()

HighlightCursors highlights all the multi-cursors.

func (*Editor) KeepFlushed

func (editor *Editor) KeepFlushed()

KeepFlushed waits for flush requests, and then flushes to the screen.

func (*Editor) LastFile

func (editor *Editor) LastFile()

LastFile toggles between the two most recent files.

func (*Editor) Listen

func (editor *Editor) Listen()

Listen is the main editor loop.

func (*Editor) MakeExtraKeyMap added in v0.4.2

func (editor *Editor) MakeExtraKeyMap() KeyMap

MakeExtraKeyMap initializes the "extra" keys map.

func (*Editor) MakeKeyMap added in v0.4.2

func (editor *Editor) MakeKeyMap() KeyMap

MakeKeyMap initializes the KeyMap.

func (*Editor) MarkedSearch added in v0.3.2

func (editor *Editor) MarkedSearch(searchTerm string) (int, int, error)

MarkedSearch searches between the cursors.

func (*Editor) MarkedSearchAndReplace added in v0.3.2

func (editor *Editor) MarkedSearchAndReplace(searchTerm, replaceTerm string, replaceAll bool)

MarkedSearchAndReplace does search-and-replace between cursors.

func (*Editor) MultiFileSearch

func (editor *Editor) MultiFileSearch(searchTerm string, multiFile bool) (int, int, error)

MultiFileSearch searches all the file buffers.

func (*Editor) MultiFileSearchAndReplace

func (editor *Editor) MultiFileSearchAndReplace(searchTerm, replaceTerm string, multiFile, replaceAll bool)

MultiFileSearchAndReplace is just like SearchAndReplace but for all the file buffers.

func (*Editor) NextFile

func (editor *Editor) NextFile()

NextFile cycles to the next open file.

func (*Editor) OpenFile

func (editor *Editor) OpenFile(name string)

OpenFile opens a specified file.

func (*Editor) OpenFiles

func (editor *Editor) OpenFiles(fileNames []string)

OpenFiles opens a set of specified files.

func (*Editor) OpenNewFile

func (editor *Editor) OpenNewFile()

OpenNewFile offers a file selection menu to choose a new file to open.

func (*Editor) Paste

func (editor *Editor) Paste()

Paste pastes the current copy buffer into the main buffer.

func (*Editor) PasteFromMenu

func (editor *Editor) PasteFromMenu()

PasteFromMenu allows the user to select from the paste history.

func (*Editor) PrevFile

func (editor *Editor) PrevFile()

PrevFile cycles to the previous open file.

func (*Editor) Quit

func (editor *Editor) Quit()

Quit closes all the files and exits the editor.

func (*Editor) ReloadAll added in v0.5.0

func (editor *Editor) ReloadAll()

ReloadAll re-reads all open buffers.

func (*Editor) RequestFlush

func (editor *Editor) RequestFlush()

RequestFlush requests a flush event (async).

func (*Editor) Save

func (editor *Editor) Save()

Save saves the buffer to the file.

func (*Editor) SaveAll added in v0.5.0

func (editor *Editor) SaveAll()

SaveAll saves all the open buffers.

func (*Editor) SaveAs added in v0.5.0

func (editor *Editor) SaveAs()

SaveAs prompts for a file to save to.

func (*Editor) Search

func (editor *Editor) Search(multiFile bool)

Search searches the entire buffer (or set of buffers if multiFile is true).

func (*Editor) SearchAndReplace

func (editor *Editor) SearchAndReplace(multiFile bool)

SearchAndReplace searches and replaces.

func (*Editor) SearchLineBa added in v0.4.2

func (editor *Editor) SearchLineBa()

SearchLineBa searches the current line from cursor to the start.

func (*Editor) SearchLineFo added in v0.4.2

func (editor *Editor) SearchLineFo()

SearchLineFo searches the current line from cursor to the end.

func (*Editor) SelectFile

func (editor *Editor) SelectFile()

SelectFile offers a menu to select from open files.

func (*Editor) SetCharMode added in v0.4.1

func (editor *Editor) SetCharMode()

SetCharMode offers a menu for selecting the character display mode.

func (*Editor) Suspend

func (editor *Editor) Suspend()

Suspend suspends the editor. Not available on windows.

func (*Editor) SwitchFile

func (editor *Editor) SwitchFile(n int)

SwitchFile changes to a new file buffer.

func (*Editor) SwitchFileByName added in v0.7.0

func (editor *Editor) SwitchFileByName(name string) error

SwitchFileByName changes to the first file with a matching name.

func (*Editor) UpdateStatus

func (editor *Editor) UpdateStatus()

UpdateStatus updates the status line.

type KeyMap added in v0.4.2

type KeyMap map[string]Action

KeyMap is a list of named actions.

func (KeyMap) Add added in v0.4.2

func (km KeyMap) Add(key string, f func(), name string)

Add inserts a new action into the keymap.

func (KeyMap) DisplayNames added in v0.4.2

func (km KeyMap) DisplayNames(keys []string, prefix string) []string

DisplayNames returns pretty-formatted keymap action names.

func (KeyMap) Keys added in v0.4.2

func (km KeyMap) Keys() []string

Keys shows a list of available actions.

func (KeyMap) Run added in v0.4.2

func (km KeyMap) Run(key string) string

Run runs the specified action.

Jump to

Keyboard shortcuts

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