action

package
v1.4.2-0...-d7b39fe Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const TermEmuSupported = true

Variables

View Source
var BufKeyActions = map[string]BufKeyAction{
	"CursorUp":               (*BufPane).CursorUp,
	"CursorDown":             (*BufPane).CursorDown,
	"CursorPageUp":           (*BufPane).CursorPageUp,
	"CursorPageDown":         (*BufPane).CursorPageDown,
	"CursorLeft":             (*BufPane).CursorLeft,
	"CursorRight":            (*BufPane).CursorRight,
	"CursorStart":            (*BufPane).CursorStart,
	"CursorEnd":              (*BufPane).CursorEnd,
	"SelectToStart":          (*BufPane).SelectToStart,
	"SelectToEnd":            (*BufPane).SelectToEnd,
	"SelectUp":               (*BufPane).SelectUp,
	"SelectDown":             (*BufPane).SelectDown,
	"SelectLeft":             (*BufPane).SelectLeft,
	"SelectRight":            (*BufPane).SelectRight,
	"WordRight":              (*BufPane).WordRight,
	"WordLeft":               (*BufPane).WordLeft,
	"SelectWordRight":        (*BufPane).SelectWordRight,
	"SelectWordLeft":         (*BufPane).SelectWordLeft,
	"DeleteWordRight":        (*BufPane).DeleteWordRight,
	"DeleteWordLeft":         (*BufPane).DeleteWordLeft,
	"SelectLine":             (*BufPane).SelectLine,
	"SelectToStartOfLine":    (*BufPane).SelectToStartOfLine,
	"SelectToEndOfLine":      (*BufPane).SelectToEndOfLine,
	"ParagraphPrevious":      (*BufPane).ParagraphPrevious,
	"ParagraphNext":          (*BufPane).ParagraphNext,
	"InsertNewline":          (*BufPane).InsertNewline,
	"Backspace":              (*BufPane).Backspace,
	"Delete":                 (*BufPane).Delete,
	"InsertTab":              (*BufPane).InsertTab,
	"Save":                   (*BufPane).Save,
	"SaveAll":                (*BufPane).SaveAll,
	"SaveAs":                 (*BufPane).SaveAs,
	"Find":                   (*BufPane).Find,
	"FindNext":               (*BufPane).FindNext,
	"FindPrevious":           (*BufPane).FindPrevious,
	"Center":                 (*BufPane).Center,
	"Undo":                   (*BufPane).Undo,
	"Redo":                   (*BufPane).Redo,
	"Copy":                   (*BufPane).Copy,
	"Cut":                    (*BufPane).Cut,
	"CutLine":                (*BufPane).CutLine,
	"DuplicateLine":          (*BufPane).DuplicateLine,
	"DeleteLine":             (*BufPane).DeleteLine,
	"MoveLinesUp":            (*BufPane).MoveLinesUp,
	"MoveLinesDown":          (*BufPane).MoveLinesDown,
	"IndentSelection":        (*BufPane).IndentSelection,
	"OutdentSelection":       (*BufPane).OutdentSelection,
	"Autocomplete":           (*BufPane).Autocomplete,
	"OutdentLine":            (*BufPane).OutdentLine,
	"Paste":                  (*BufPane).Paste,
	"PastePrimary":           (*BufPane).PastePrimary,
	"SelectAll":              (*BufPane).SelectAll,
	"OpenFile":               (*BufPane).OpenFile,
	"Start":                  (*BufPane).Start,
	"End":                    (*BufPane).End,
	"PageUp":                 (*BufPane).PageUp,
	"PageDown":               (*BufPane).PageDown,
	"SelectPageUp":           (*BufPane).SelectPageUp,
	"SelectPageDown":         (*BufPane).SelectPageDown,
	"HalfPageUp":             (*BufPane).HalfPageUp,
	"HalfPageDown":           (*BufPane).HalfPageDown,
	"StartOfLine":            (*BufPane).StartOfLine,
	"EndOfLine":              (*BufPane).EndOfLine,
	"ToggleHelp":             (*BufPane).ToggleHelp,
	"ToggleKeyMenu":          (*BufPane).ToggleKeyMenu,
	"ToggleRuler":            (*BufPane).ToggleRuler,
	"ClearStatus":            (*BufPane).ClearStatus,
	"ShellMode":              (*BufPane).ShellMode,
	"CommandMode":            (*BufPane).CommandMode,
	"ToggleOverwriteMode":    (*BufPane).ToggleOverwriteMode,
	"Escape":                 (*BufPane).Escape,
	"Quit":                   (*BufPane).Quit,
	"QuitAll":                (*BufPane).QuitAll,
	"AddTab":                 (*BufPane).AddTab,
	"PreviousTab":            (*BufPane).PreviousTab,
	"NextTab":                (*BufPane).NextTab,
	"NextSplit":              (*BufPane).NextSplit,
	"PreviousSplit":          (*BufPane).PreviousSplit,
	"Unsplit":                (*BufPane).Unsplit,
	"VSplit":                 (*BufPane).VSplitAction,
	"HSplit":                 (*BufPane).HSplitAction,
	"ToggleMacro":            (*BufPane).ToggleMacro,
	"PlayMacro":              (*BufPane).PlayMacro,
	"Suspend":                (*BufPane).Suspend,
	"ScrollUp":               (*BufPane).ScrollUpAction,
	"ScrollDown":             (*BufPane).ScrollDownAction,
	"SpawnMultiCursor":       (*BufPane).SpawnMultiCursor,
	"SpawnMultiCursorSelect": (*BufPane).SpawnMultiCursorSelect,
	"RemoveMultiCursor":      (*BufPane).RemoveMultiCursor,
	"RemoveAllMultiCursors":  (*BufPane).RemoveAllMultiCursors,
	"SkipMultiCursor":        (*BufPane).SkipMultiCursor,
	"JumpToMatchingBrace":    (*BufPane).JumpToMatchingBrace,
	"None":                   (*BufPane).None,

	"InsertEnter": (*BufPane).InsertNewline,
}

BufKeyActions contains the list of all possible key actions the bufhandler could execute

View Source
var BufKeyBindings map[Event]BufKeyAction
View Source
var BufKeyStrings map[Event]string
View Source
var BufMouseActions = map[string]BufMouseAction{
	"MousePress":       (*BufPane).MousePress,
	"MouseMultiCursor": (*BufPane).MouseMultiCursor,
}

BufMouseActions contains the list of all possible mouse actions the bufhandler could execute

View Source
var BufMouseBindings map[MouseEvent]BufMouseAction
View Source
var InfoNones = []string{
	"Save",
	"SaveAll",
	"SaveAs",
	"Find",
	"FindNext",
	"FindPrevious",
	"Center",
	"DuplicateLine",
	"MoveLinesUp",
	"MoveLinesDown",
	"OpenFile",
	"Start",
	"End",
	"PageUp",
	"PageDown",
	"SelectPageUp",
	"SelectPageDown",
	"HalfPageUp",
	"HalfPageDown",
	"ToggleHelp",
	"ToggleKeyMenu",
	"ToggleRuler",
	"JumpLine",
	"ClearStatus",
	"ShellMode",
	"CommandMode",
	"AddTab",
	"PreviousTab",
	"NextTab",
	"NextSplit",
	"PreviousSplit",
	"Unsplit",
	"VSplit",
	"HSplit",
	"ToggleMacro",
	"PlayMacro",
	"Suspend",
	"ScrollUp",
	"ScrollDown",
	"SpawnMultiCursor",
	"SpawnMultiCursorSelect",
	"RemoveMultiCursor",
	"RemoveAllMultiCursors",
	"SkipMultiCursor",
}

InfoNones is a list of actions that should have no effect when executed by an infohandler

View Source
var InfoOverrides = map[string]InfoKeyAction{
	"CursorUp":      (*InfoPane).CursorUp,
	"CursorDown":    (*InfoPane).CursorDown,
	"InsertNewline": (*InfoPane).InsertNewline,
	"Autocomplete":  (*InfoPane).Autocomplete,
	"OutdentLine":   (*InfoPane).CycleBack,
	"Escape":        (*InfoPane).Escape,
	"Quit":          (*InfoPane).Quit,
	"QuitAll":       (*InfoPane).QuitAll,
}

InfoOverrides is the list of actions which have been overridden by the infohandler

View Source
var MultiActions = map[string]bool{
	"CursorUp":            true,
	"CursorDown":          true,
	"CursorPageUp":        true,
	"CursorPageDown":      true,
	"CursorLeft":          true,
	"CursorRight":         true,
	"CursorStart":         true,
	"CursorEnd":           true,
	"SelectToStart":       true,
	"SelectToEnd":         true,
	"SelectUp":            true,
	"SelectDown":          true,
	"SelectLeft":          true,
	"SelectRight":         true,
	"WordRight":           true,
	"WordLeft":            true,
	"SelectWordRight":     true,
	"SelectWordLeft":      true,
	"DeleteWordRight":     true,
	"DeleteWordLeft":      true,
	"SelectLine":          true,
	"SelectToStartOfLine": true,
	"SelectToEndOfLine":   true,
	"ParagraphPrevious":   true,
	"ParagraphNext":       true,
	"InsertNewline":       true,
	"Backspace":           true,
	"Delete":              true,
	"InsertTab":           true,
	"FindNext":            true,
	"FindPrevious":        true,
	"Cut":                 true,
	"CutLine":             true,
	"DuplicateLine":       true,
	"DeleteLine":          true,
	"MoveLinesUp":         true,
	"MoveLinesDown":       true,
	"IndentSelection":     true,
	"OutdentSelection":    true,
	"OutdentLine":         true,
	"Paste":               true,
	"PastePrimary":        true,
	"SelectPageUp":        true,
	"SelectPageDown":      true,
	"StartOfLine":         true,
	"EndOfLine":           true,
	"JumpToMatchingBrace": true,
}

MultiActions is a list of actions that should be executed multiple times if there are multiple cursors (one per cursor) Generally actions that modify global editor state like quitting or saving should not be included in this list

View Source
var PluginCmds = []string{"list", "info", "version"}

Functions

func BindKey

func BindKey(k, v string)

func BufMapKey

func BufMapKey(k Event, action string)

BufMapKey maps a key event to an action

func BufMapMouse

func BufMapMouse(k MouseEvent, action string)

BufMapMouse maps a mouse event to an action

func CommandComplete

func CommandComplete(b *buffer.Buffer) ([]string, []string)

CommandComplete autocompletes commands

func DefaultBindings

func DefaultBindings() map[string]string

DefaultBindings returns a map containing micro's default keybindings

func HelpComplete

func HelpComplete(b *buffer.Buffer) ([]string, []string)

HelpComplete autocompletes help topics

func InitBindings

func InitBindings()

func InitCommands

func InitCommands()

func InitGlobals

func InitGlobals()

func InitTabs

func InitTabs(bufs []*buffer.Buffer)

func LuaAction

func LuaAction(fn string) func(*BufPane) bool

func LuaFunctionCommand

func LuaFunctionCommand(fn string) func(*BufPane, []string)

LuaFunctionCommand returns a normal function so that a command can be bound to a lua function

func LuaMakeCommand

func LuaMakeCommand(name, function string, completer buffer.Completer)

MakeCommand is a function to easily create new commands This can be called by plugins in Lua so that plugins can define their own commands

func OpenLogBuf

func OpenLogBuf(h *BufPane)

func OptionComplete

func OptionComplete(b *buffer.Buffer) ([]string, []string)

OptionComplete autocompletes options

func OptionValueComplete

func OptionValueComplete(b *buffer.Buffer) ([]string, []string)

OptionValueComplete completes values for various options

func PluginCmdComplete

func PluginCmdComplete(b *buffer.Buffer) ([]string, []string)

OptionComplete autocompletes options

func PluginComplete

func PluginComplete(b *buffer.Buffer) ([]string, []string)

PluginComplete completes values for the plugin command

func ReloadConfig

func ReloadConfig()

func RunTermEmulator

func RunTermEmulator(h *BufPane, input string, wait bool, getOutput bool, callback string, userargs []interface{}) error

func SetGlobalOption

func SetGlobalOption(option, value string) error

func SetGlobalOptionNative

func SetGlobalOptionNative(option string, nativeValue interface{}) error

func TryBindKey

func TryBindKey(k, v string, overwrite bool) (bool, error)

TryBindKey tries to bind a key by writing to config.ConfigDir/bindings.json Returns true if the keybinding already existed and a possible error

func UnbindKey

func UnbindKey(k string) error

UnbindKey removes the binding for a key from the bindings.json file

func WriteLog

func WriteLog(s string)

Types

type BufKeyAction

type BufKeyAction func(*BufPane) bool

func CommandAction

func CommandAction(cmd string) BufKeyAction

CommandAction returns a bindable function which executes the given command

func CommandEditAction

func CommandEditAction(prompt string) BufKeyAction

CommandEditAction returns a bindable function that opens a prompt with the given string and executes the command when the user presses enter

type BufMouseAction

type BufMouseAction func(*BufPane, *tcell.EventMouse) bool

type BufPane

type BufPane struct {
	display.BWindow

	Buf *buffer.Buffer

	Cursor *buffer.Cursor // the active cursor
	// contains filtered or unexported fields
}

The BufPane connects the buffer and the window It provides a cursor (or multiple) and defines a set of actions that can be taken on the buffer The ActionHandler can access the window for necessary info about visual positions for mouse clicks and scrolling

var LogBufPane *BufPane

func NewBufPane

func NewBufPane(buf *buffer.Buffer, win display.BWindow) *BufPane

func NewBufPaneFromBuf

func NewBufPaneFromBuf(buf *buffer.Buffer) *BufPane

func (*BufPane) AddTab

func (h *BufPane) AddTab() bool

AddTab adds a new tab with an empty buffer

func (*BufPane) Autocomplete

func (h *BufPane) Autocomplete() bool

Autocomplete cycles the suggestions and performs autocompletion if there are suggestions

func (*BufPane) Backspace

func (h *BufPane) Backspace() bool

Backspace deletes the previous character

func (*BufPane) BindCmd

func (h *BufPane) BindCmd(args []string)

BindCmd creates a new keybinding

func (*BufPane) CdCmd

func (h *BufPane) CdCmd(args []string)

CdCmd changes the current working directory

func (*BufPane) Center

func (h *BufPane) Center() bool

Center centers the view on the cursor

func (*BufPane) ClearStatus

func (h *BufPane) ClearStatus() bool

ClearStatus clears the messenger bar

func (*BufPane) Close

func (h *BufPane) Close()

func (*BufPane) CommandMode

func (h *BufPane) CommandMode() bool

CommandMode lets the user enter a command

func (*BufPane) Copy

func (h *BufPane) Copy() bool

Copy the selection to the system clipboard

func (*BufPane) CursorDown

func (h *BufPane) CursorDown() bool

CursorDown moves the cursor down

func (*BufPane) CursorEnd

func (h *BufPane) CursorEnd() bool

CursorEnd moves the cursor to the end of the buffer

func (*BufPane) CursorLeft

func (h *BufPane) CursorLeft() bool

CursorLeft moves the cursor left

func (*BufPane) CursorPageDown

func (h *BufPane) CursorPageDown() bool

CursorPageDown places the cursor a page up

func (*BufPane) CursorPageUp

func (h *BufPane) CursorPageUp() bool

CursorPageUp places the cursor a page up

func (*BufPane) CursorRight

func (h *BufPane) CursorRight() bool

CursorRight moves the cursor right

func (*BufPane) CursorStart

func (h *BufPane) CursorStart() bool

CursorStart moves the cursor to the start of the buffer

func (*BufPane) CursorUp

func (h *BufPane) CursorUp() bool

CursorUp moves the cursor up

func (*BufPane) Cut

func (h *BufPane) Cut() bool

Cut the selection to the system clipboard

func (*BufPane) CutLine

func (h *BufPane) CutLine() bool

CutLine cuts the current line to the clipboard

func (*BufPane) Delete

func (h *BufPane) Delete() bool

Delete deletes the next character

func (*BufPane) DeleteLine

func (h *BufPane) DeleteLine() bool

DeleteLine deletes the current line

func (*BufPane) DeleteWordLeft

func (h *BufPane) DeleteWordLeft() bool

DeleteWordLeft deletes the word to the left of the cursor

func (*BufPane) DeleteWordRight

func (h *BufPane) DeleteWordRight() bool

DeleteWordRight deletes the word to the right of the cursor

func (*BufPane) DoKeyEvent

func (h *BufPane) DoKeyEvent(e Event) bool

DoKeyEvent executes a key event by finding the action it is bound to and executing it (possibly multiple times for multiple cursors)

func (*BufPane) DoMouseEvent

func (h *BufPane) DoMouseEvent(e MouseEvent, te *tcell.EventMouse) bool

DoMouseEvent executes a mouse event by finding the action it is bound to and executing it

func (*BufPane) DoRuneInsert

func (h *BufPane) DoRuneInsert(r rune)

DoRuneInsert inserts a given rune into the current buffer (possibly multiple times for multiple cursors)

func (*BufPane) DuplicateLine

func (h *BufPane) DuplicateLine() bool

DuplicateLine duplicates the current line or selection

func (*BufPane) End

func (h *BufPane) End() bool

End moves the viewport to the end of the buffer

func (*BufPane) EndOfLine

func (h *BufPane) EndOfLine() bool

EndOfLine moves the cursor to the end of the line

func (*BufPane) Escape

func (h *BufPane) Escape() bool

Escape leaves current mode

func (*BufPane) EvalCmd

func (h *BufPane) EvalCmd(args []string)

EvalCmd evaluates a lua expression

func (*BufPane) Find

func (h *BufPane) Find() bool

Find opens a prompt and searches forward for the input

func (*BufPane) FindNext

func (h *BufPane) FindNext() bool

FindNext searches forwards for the last used search term

func (*BufPane) FindPrevious

func (h *BufPane) FindPrevious() bool

FindPrevious searches backwards for the last used search term

func (*BufPane) GotoCmd

func (h *BufPane) GotoCmd(args []string)

GotoCmd is a command that will send the cursor to a certain position in the buffer For example: `goto line`, or `goto line:col`

func (*BufPane) HSplitAction

func (h *BufPane) HSplitAction() bool

HSplitAction opens an empty horizontal split

func (*BufPane) HSplitBuf

func (h *BufPane) HSplitBuf(buf *buffer.Buffer) *BufPane

func (*BufPane) HSplitCmd

func (h *BufPane) HSplitCmd(args []string)

HSplitCmd opens a horizontal split with file given in the first argument If no file is given, it opens an empty buffer in a new split

func (*BufPane) HalfPageDown

func (h *BufPane) HalfPageDown() bool

HalfPageDown scrolls the view down half a page

func (*BufPane) HalfPageUp

func (h *BufPane) HalfPageUp() bool

HalfPageUp scrolls the view up half a page

func (*BufPane) HandleCommand

func (h *BufPane) HandleCommand(input string)

HandleCommand handles input from the user

func (*BufPane) HandleEvent

func (h *BufPane) HandleEvent(event tcell.Event)

HandleEvent executes the tcell event properly

func (*BufPane) HasKeyEvent

func (h *BufPane) HasKeyEvent(e Event) bool

func (*BufPane) HelpCmd

func (h *BufPane) HelpCmd(args []string)

HelpCmd tries to open the given help page in a horizontal split

func (*BufPane) ID

func (h *BufPane) ID() uint64

func (*BufPane) IndentSelection

func (h *BufPane) IndentSelection() bool

IndentSelection indents the current selection

func (*BufPane) InsertNewline

func (h *BufPane) InsertNewline() bool

InsertNewline inserts a newline plus possible some whitespace if autoindent is on

func (*BufPane) InsertTab

func (h *BufPane) InsertTab() bool

InsertTab inserts a tab or spaces

func (*BufPane) JumpToMatchingBrace

func (h *BufPane) JumpToMatchingBrace() bool

JumpToMatchingBrace moves the cursor to the matching brace if it is currently on a brace

func (*BufPane) MemUsageCmd

func (h *BufPane) MemUsageCmd(args []string)

MemUsageCmd prints micro's memory usage Alloc shows how many bytes are currently in use Sys shows how many bytes have been requested from the operating system NumGC shows how many times the GC has been run Note that Go commonly reserves more memory from the OS than is currently in-use/required Additionally, even if Go returns memory to the OS, the OS does not always claim it because there may be plenty of memory to spare

func (*BufPane) MouseMultiCursor

func (h *BufPane) MouseMultiCursor(e *tcell.EventMouse) bool

MouseMultiCursor is a mouse action which puts a new cursor at the mouse position

func (*BufPane) MousePress

func (h *BufPane) MousePress(e *tcell.EventMouse) bool

MousePress is the event that should happen when a normal click happens This is almost always bound to left click

func (*BufPane) MoveLinesDown

func (h *BufPane) MoveLinesDown() bool

MoveLinesDown moves down the current line or selected lines if any

func (*BufPane) MoveLinesUp

func (h *BufPane) MoveLinesUp() bool

MoveLinesUp moves up the current line or selected lines if any

func (*BufPane) Name

func (h *BufPane) Name() string

func (*BufPane) NewTabCmd

func (h *BufPane) NewTabCmd(args []string)

NewTabCmd opens the given file in a new tab

func (*BufPane) NextSplit

func (h *BufPane) NextSplit() bool

NextSplit changes the view to the next split

func (*BufPane) NextTab

func (h *BufPane) NextTab() bool

NextTab switches to the next tab in the tab list

func (*BufPane) None

func (h *BufPane) None() bool

None is an action that does nothing

func (*BufPane) OpenBuffer

func (h *BufPane) OpenBuffer(b *buffer.Buffer)

func (*BufPane) OpenCmd

func (h *BufPane) OpenCmd(args []string)

OpenCmd opens a new buffer with a given filename

func (*BufPane) OpenFile

func (h *BufPane) OpenFile() bool

OpenFile opens a new file in the buffer

func (*BufPane) OutdentLine

func (h *BufPane) OutdentLine() bool

OutdentLine moves the current line back one indentation

func (*BufPane) OutdentSelection

func (h *BufPane) OutdentSelection() bool

OutdentSelection takes the current selection and moves it back one indent level

func (*BufPane) PageDown

func (h *BufPane) PageDown() bool

PageDown scrolls the view down a page

func (*BufPane) PageUp

func (h *BufPane) PageUp() bool

PageUp scrolls the view up a page

func (*BufPane) ParagraphNext

func (h *BufPane) ParagraphNext() bool

ParagraphNext moves the cursor to the next empty line, or end of the buffer if there's none

func (*BufPane) ParagraphPrevious

func (h *BufPane) ParagraphPrevious() bool

ParagraphPrevious moves the cursor to the previous empty line, or beginning of the buffer if there's none

func (*BufPane) Paste

func (h *BufPane) Paste() bool

Paste whatever is in the system clipboard into the buffer Delete and paste if the user has a selection

func (*BufPane) PastePrimary

func (h *BufPane) PastePrimary() bool

PastePrimary pastes from the primary clipboard (only use on linux)

func (*BufPane) PlayMacro

func (h *BufPane) PlayMacro() bool

PlayMacro plays back the most recently recorded macro

func (*BufPane) PluginCB

func (h *BufPane) PluginCB(cb string) bool

PluginCB calls all plugin callbacks with a certain name and displays an error if there is one and returns the aggregrate boolean response

func (*BufPane) PluginCBRune

func (h *BufPane) PluginCBRune(cb string, r rune) bool

PluginCBRune is the same as PluginCB but also passes a rune to the plugins

func (*BufPane) PluginCmd

func (h *BufPane) PluginCmd(args []string)

PluginCmd installs, removes, updates, lists, or searches for given plugins

func (*BufPane) PreviousSplit

func (h *BufPane) PreviousSplit() bool

PreviousSplit changes the view to the previous split

func (*BufPane) PreviousTab

func (h *BufPane) PreviousTab() bool

PreviousTab switches to the previous tab in the tab list

func (*BufPane) PwdCmd

func (h *BufPane) PwdCmd(args []string)

PwdCmd prints the current working directory

func (*BufPane) Quit

func (h *BufPane) Quit() bool

Quit this will close the current tab or view that is open

func (*BufPane) QuitAll

func (h *BufPane) QuitAll() bool

QuitAll quits the whole editor; all splits and tabs

func (*BufPane) QuitCmd

func (h *BufPane) QuitCmd(args []string)

QuitCmd closes the main view

func (*BufPane) RawCmd

func (h *BufPane) RawCmd(args []string)

RawCmd opens a new raw view which displays the escape sequences micro is receiving in real-time

func (*BufPane) Redo

func (h *BufPane) Redo() bool

Redo redoes the last action

func (*BufPane) ReloadCmd

func (h *BufPane) ReloadCmd(args []string)

ReloadCmd reloads all files (syntax files, colorschemes...)

func (*BufPane) RemoveAllMultiCursors

func (h *BufPane) RemoveAllMultiCursors() bool

RemoveAllMultiCursors removes all cursors except the base cursor

func (*BufPane) RemoveMultiCursor

func (h *BufPane) RemoveMultiCursor() bool

RemoveMultiCursor removes the latest multiple cursor

func (*BufPane) ReopenCmd

func (h *BufPane) ReopenCmd(args []string)

ReopenCmd reopens the buffer (reload from disk)

func (*BufPane) ReplaceAllCmd

func (h *BufPane) ReplaceAllCmd(args []string)

ReplaceAllCmd replaces search term all at once

func (*BufPane) ReplaceCmd

func (h *BufPane) ReplaceCmd(args []string)

ReplaceCmd runs search and replace

func (*BufPane) ResetCmd

func (h *BufPane) ResetCmd(args []string)

ResetCmd resets a setting to its default value

func (*BufPane) Retab

func (h *BufPane) Retab() bool

Retab changes all tabs to spaces or all spaces to tabs depending on the user's settings

func (*BufPane) RetabCmd

func (h *BufPane) RetabCmd(args []string)

RetabCmd changes all spaces to tabs or all tabs to spaces depending on the user's settings

func (*BufPane) RunCmd

func (h *BufPane) RunCmd(args []string)

RunCmd runs a shell command in the background

func (*BufPane) Save

func (h *BufPane) Save() bool

Save the buffer to disk

func (*BufPane) SaveAll

func (h *BufPane) SaveAll() bool

SaveAll saves all open buffers

func (*BufPane) SaveAs

func (h *BufPane) SaveAs() bool

SaveAs saves the buffer to disk with the given name

func (*BufPane) SaveCmd

func (h *BufPane) SaveCmd(args []string)

SaveCmd saves the buffer optionally with an argument file name

func (*BufPane) ScrollDown

func (h *BufPane) ScrollDown(n int)

ScrollDown is not an action

func (*BufPane) ScrollDownAction

func (h *BufPane) ScrollDownAction() bool

ScrollDownAction scrolls the view up

func (*BufPane) ScrollUp

func (h *BufPane) ScrollUp(n int)

ScrollUp is not an action

func (*BufPane) ScrollUpAction

func (h *BufPane) ScrollUpAction() bool

ScrollUpAction scrolls the view up

func (*BufPane) SelectAll

func (h *BufPane) SelectAll() bool

SelectAll selects the entire buffer

func (*BufPane) SelectDown

func (h *BufPane) SelectDown() bool

SelectDown selects down one line

func (*BufPane) SelectLeft

func (h *BufPane) SelectLeft() bool

SelectLeft selects the character to the left of the cursor

func (*BufPane) SelectLine

func (h *BufPane) SelectLine() bool

SelectLine selects the entire current line

func (*BufPane) SelectPageDown

func (h *BufPane) SelectPageDown() bool

SelectPageDown selects down one page

func (*BufPane) SelectPageUp

func (h *BufPane) SelectPageUp() bool

SelectPageUp selects up one page

func (*BufPane) SelectRight

func (h *BufPane) SelectRight() bool

SelectRight selects the character to the right of the cursor

func (*BufPane) SelectToEnd

func (h *BufPane) SelectToEnd() bool

SelectToEnd selects the text from the cursor to the end of the buffer

func (*BufPane) SelectToEndOfLine

func (h *BufPane) SelectToEndOfLine() bool

SelectToEndOfLine selects to the end of the current line

func (*BufPane) SelectToStart

func (h *BufPane) SelectToStart() bool

SelectToStart selects the text from the cursor to the start of the buffer

func (*BufPane) SelectToStartOfLine

func (h *BufPane) SelectToStartOfLine() bool

SelectToStartOfLine selects to the start of the current line

func (*BufPane) SelectUp

func (h *BufPane) SelectUp() bool

SelectUp selects up one line

func (*BufPane) SelectWordLeft

func (h *BufPane) SelectWordLeft() bool

SelectWordLeft selects the word to the left of the cursor

func (*BufPane) SelectWordRight

func (h *BufPane) SelectWordRight() bool

SelectWordRight selects the word to the right of the cursor

func (*BufPane) SetActive

func (h *BufPane) SetActive(b bool)

func (*BufPane) SetCmd

func (h *BufPane) SetCmd(args []string)

SetCmd sets an option

func (*BufPane) SetID

func (h *BufPane) SetID(i uint64)

func (*BufPane) SetLocalCmd

func (h *BufPane) SetLocalCmd(args []string)

SetLocalCmd sets an option local to the buffer

func (*BufPane) ShellMode

func (h *BufPane) ShellMode() bool

ShellMode opens a terminal to run a shell command

func (*BufPane) ShowCmd

func (h *BufPane) ShowCmd(args []string)

ShowCmd shows the value of the given option

func (*BufPane) ShowKeyCmd

func (h *BufPane) ShowKeyCmd(args []string)

ShowKeyCmd displays the action that a key is bound to

func (*BufPane) SkipMultiCursor

func (h *BufPane) SkipMultiCursor() bool

SkipMultiCursor moves the current multiple cursor to the next available position

func (*BufPane) SpawnMultiCursor

func (h *BufPane) SpawnMultiCursor() bool

SpawnMultiCursor creates a new multiple cursor at the next occurrence of the current selection or current word

func (*BufPane) SpawnMultiCursorSelect

func (h *BufPane) SpawnMultiCursorSelect() bool

SpawnMultiCursorSelect adds a cursor at the beginning of each line of a selection

func (*BufPane) Start

func (h *BufPane) Start() bool

Start moves the viewport to the start of the buffer

func (*BufPane) StartOfLine

func (h *BufPane) StartOfLine() bool

StartOfLine moves the cursor to the start of the line

func (*BufPane) Suspend

func (*BufPane) Suspend() bool

Suspend sends micro to the background. This is the same as pressing CtrlZ in most unix programs. This only works on linux and has no default binding. This code was adapted from the suspend code in nsf/godit

func (*BufPane) TabSwitchCmd

func (h *BufPane) TabSwitchCmd(args []string)

TabSwitchCmd switches to a given tab either by name or by number

func (*BufPane) TermCmd

func (h *BufPane) TermCmd(args []string)

TermCmd opens a terminal in the current view

func (*BufPane) TextFilterCmd

func (h *BufPane) TextFilterCmd(args []string)

TextFilterCmd filters the selection through the command. Selection goes to the command input. On successful run command output replaces the current selection.

func (*BufPane) ToggleHelp

func (h *BufPane) ToggleHelp() bool

ToggleHelp toggles the help screen

func (*BufPane) ToggleKeyMenu

func (h *BufPane) ToggleKeyMenu() bool

ToggleKeyMenu toggles the keymenu option and resizes all tabs

func (*BufPane) ToggleLogCmd

func (h *BufPane) ToggleLogCmd(args []string)

ToggleLogCmd toggles the log view

func (*BufPane) ToggleMacro

func (h *BufPane) ToggleMacro() bool

ToggleMacro toggles recording of a macro

func (*BufPane) ToggleOverwriteMode

func (h *BufPane) ToggleOverwriteMode() bool

ToggleOverwriteMode lets the user toggle the text overwrite mode

func (*BufPane) ToggleRuler

func (h *BufPane) ToggleRuler() bool

ToggleRuler turns line numbers off and on

func (*BufPane) UnbindCmd

func (h *BufPane) UnbindCmd(args []string)

UnbindCmd binds a key to its default action

func (*BufPane) Undo

func (h *BufPane) Undo() bool

Undo undoes the last action

func (*BufPane) Unsplit

func (h *BufPane) Unsplit() bool

Unsplit closes all splits in the current tab except the active one

func (*BufPane) VSplitAction

func (h *BufPane) VSplitAction() bool

VSplitAction opens an empty vertical split

func (*BufPane) VSplitBuf

func (h *BufPane) VSplitBuf(buf *buffer.Buffer) *BufPane

func (*BufPane) VSplitCmd

func (h *BufPane) VSplitCmd(args []string)

VSplitCmd opens a vertical split with file given in the first argument If no file is given, it opens an empty buffer in a new split

func (*BufPane) WordLeft

func (h *BufPane) WordLeft() bool

WordLeft moves the cursor one word to the left

func (*BufPane) WordRight

func (h *BufPane) WordRight() bool

WordRight moves the cursor one word to the right

type Command

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

A Command contains information about how to execute a command It has the action for that command as well as a completer function

type Event

type Event interface{}

type Handler

type Handler interface {
	HandleEvent(tcell.Event)
	HandleCommand(string)
}

A Handler will take a tcell event and execute it appropriately

type InfoKeyAction

type InfoKeyAction func(*InfoPane)

type InfoPane

type InfoPane struct {
	*BufPane
	*info.InfoBuf
}
var InfoBar *InfoPane

func GetInfoBar

func GetInfoBar() *InfoPane

func NewInfoBar

func NewInfoBar() *InfoPane

func NewInfoPane

func NewInfoPane(ib *info.InfoBuf, w display.BWindow) *InfoPane

func (*InfoPane) Autocomplete

func (h *InfoPane) Autocomplete()

Autocomplete begins autocompletion

func (*InfoPane) Close

func (h *InfoPane) Close()

func (*InfoPane) CursorDown

func (h *InfoPane) CursorDown()

CursorDown cycles history down

func (*InfoPane) CursorUp

func (h *InfoPane) CursorUp()

CursorUp cycles history up

func (*InfoPane) CycleBack

func (h *InfoPane) CycleBack()

CycleBack cycles back in the autocomplete suggestion list

func (*InfoPane) DoKeyEvent

func (h *InfoPane) DoKeyEvent(e KeyEvent) bool

func (*InfoPane) Escape

func (h *InfoPane) Escape()

Escape cancels the prompt

func (*InfoPane) HandleEvent

func (h *InfoPane) HandleEvent(event tcell.Event)

func (*InfoPane) InsertNewline

func (h *InfoPane) InsertNewline()

InsertNewline completes the prompt

func (*InfoPane) Quit

func (h *InfoPane) Quit()

Quit cancels the prompt

func (*InfoPane) QuitAll

func (h *InfoPane) QuitAll()

QuitAll cancels the prompt

type KeyAction

type KeyAction func(Handler) bool

type KeyEvent

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

KeyEvent is a key event containing a key code, some possible modifiers (alt, ctrl, etc...) and a rune if it was simply a character press Note: to be compatible with tcell events, for ctrl keys r=code

type MouseAction

type MouseAction func(Handler, tcell.EventMouse) bool

type MouseEvent

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

MouseEvent is a mouse event with a mouse button and any possible key modifiers

type Pane

type Pane interface {
	Handler
	display.Window
	ID() uint64
	SetID(i uint64)
	Name() string
	Close()
}

type RawEvent

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

RawEvent is simply an escape code We allow users to directly bind escape codes to get around some of a limitations of terminals

type RawPane

type RawPane struct {
	*BufPane
}

func NewRawPane

func NewRawPane() *RawPane

func NewRawPaneFromWin

func NewRawPaneFromWin(b *buffer.Buffer, win display.BWindow) *RawPane

func (*RawPane) HandleEvent

func (h *RawPane) HandleEvent(event tcell.Event)

type Tab

type Tab struct {
	*views.Node
	*display.UIWindow
	Panes []Pane
	// contains filtered or unexported fields
}

A Tab represents a single tab It consists of a list of edit panes (the open buffers), a split tree (stored as just the root node), and a uiwindow to display the UI elements like the borders between splits

func MainTab

func MainTab() *Tab

func NewTabFromBuffer

func NewTabFromBuffer(x, y, width, height int, b *buffer.Buffer) *Tab

NewTabFromBuffer creates a new tab from the given buffer

func NewTabFromPane

func NewTabFromPane(x, y, width, height int, pane Pane) *Tab

func (*Tab) CurPane

func (t *Tab) CurPane() Pane

CurPane returns the currently active pane

func (*Tab) GetPane

func (t *Tab) GetPane(splitid uint64) int

GetPane returns the pane with the given split index

func (*Tab) HandleEvent

func (t *Tab) HandleEvent(event tcell.Event)

HandleEvent takes a tcell event and usually dispatches it to the current active pane. However if the event is a resize or a mouse event where the user is interacting with the UI (resizing splits) then the event is consumed here If the event is a mouse event in a pane, that pane will become active and get the event

func (*Tab) RemovePane

func (t *Tab) RemovePane(i int)

Remove pane removes the pane with the given index

func (*Tab) Resize

func (t *Tab) Resize()

Resize resizes all panes according to their corresponding split nodes

func (*Tab) SetActive

func (t *Tab) SetActive(i int)

SetActive changes the currently active pane to the specified index

type TabList

type TabList struct {
	*display.TabWindow
	List []*Tab
}

The TabList is a list of tabs and a window to display the tab bar at the top of the screen

var Tabs *TabList

Tabs is the global tab list

func NewTabList

func NewTabList(bufs []*buffer.Buffer) *TabList

NewTabList creates a TabList from a list of buffers by creating a Tab for each buffer

func (*TabList) AddTab

func (t *TabList) AddTab(p *Tab)

AddTab adds a new tab to this TabList

func (*TabList) Display

func (t *TabList) Display()

Display updates the names and then displays the tab bar

func (*TabList) HandleEvent

func (t *TabList) HandleEvent(event tcell.Event)

HandleEvent checks for a resize event or a mouse event on the tab bar otherwise it will forward the event to the currently active tab

func (*TabList) RemoveTab

func (t *TabList) RemoveTab(id uint64)

RemoveTab removes a tab with the given id from the TabList

func (*TabList) Resize

func (t *TabList) Resize()

Resize resizes all elements within the tab list One thing to note is that when there is only 1 tab the tab bar should not be drawn so resizing must take that into account

func (*TabList) UpdateNames

func (t *TabList) UpdateNames()

UpdateNames makes sure that the list of names the tab window has access to is correct

type TermPane

type TermPane struct {
	*shell.Terminal
	display.Window
	// contains filtered or unexported fields
}

func NewTermPane

func NewTermPane(x, y, w, h int, t *shell.Terminal, id uint64) *TermPane

func (*TermPane) Close

func (t *TermPane) Close()

func (*TermPane) HandleCommand

func (t *TermPane) HandleCommand(input string)

func (*TermPane) HandleEvent

func (t *TermPane) HandleEvent(event tcell.Event)

HandleEvent handles a tcell event by forwarding it to the terminal emulator If the event is a mouse event and the program running in the emulator does not have mouse support, the emulator will support selections and copy-paste

func (*TermPane) ID

func (t *TermPane) ID() uint64

func (*TermPane) Quit

func (t *TermPane) Quit()

func (*TermPane) SetID

func (t *TermPane) SetID(i uint64)

func (*TermPane) Unsplit

func (t *TermPane) Unsplit()

Jump to

Keyboard shortcuts

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