Documentation ¶
Index ¶
- Constants
- Variables
- func BindKey(k, v string, bind func(e Event, a string))
- func BufMapEvent(k Event, action string)
- func BufUnmap(k Event)
- func CommandComplete(b *buffer.Buffer) ([]string, []string)
- func DefaultBindings(pane string) map[string]string
- func HelpComplete(b *buffer.Buffer) ([]string, []string)
- func InfoMapEvent(k Event, action string)
- func InitBindings()
- func InitCommands()
- func InitGlobals()
- func InitTabs(bufs []*buffer.Buffer)
- func LuaAction(fn string) func(*BufPane) bool
- func MakeCommand(name string, action func(bp *BufPane, args []string), ...)
- func OptionComplete(b *buffer.Buffer) ([]string, []string)
- func OptionValueComplete(b *buffer.Buffer) ([]string, []string)
- func PluginCmdComplete(b *buffer.Buffer) ([]string, []string)
- func PluginComplete(b *buffer.Buffer) ([]string, []string)
- func ReloadConfig()
- func RunTermEmulator(h *BufPane, input string, wait bool, getOutput bool, ...) error
- func SetGlobalOption(option, value string) error
- func SetGlobalOptionNative(option string, nativeValue interface{}) error
- func TermMapEvent(k Event, action string)
- func TryBindKey(k, v string, overwrite bool) (bool, error)
- func UnbindKey(k string) error
- func WriteLog(s string)
- type BufKeyAction
- type BufMouseAction
- type BufPane
- func (h *BufPane) AddTab() bool
- func (h *BufPane) Autocomplete() bool
- func (h *BufPane) Backspace() bool
- func (h *BufPane) BindCmd(args []string)
- func (h *BufPane) Bindings() *KeyTree
- func (h *BufPane) CdCmd(args []string)
- func (h *BufPane) Center() bool
- func (h *BufPane) ClearInfo() bool
- func (h *BufPane) ClearStatus() bool
- func (h *BufPane) Close()
- func (h *BufPane) CommandMode() bool
- func (h *BufPane) Copy() bool
- func (h *BufPane) CopyLine() bool
- func (h *BufPane) CursorDown() bool
- func (h *BufPane) CursorEnd() bool
- func (h *BufPane) CursorLeft() bool
- func (h *BufPane) CursorPageDown() bool
- func (h *BufPane) CursorPageUp() bool
- func (h *BufPane) CursorRight() bool
- func (h *BufPane) CursorStart() bool
- func (h *BufPane) CursorUp() bool
- func (h *BufPane) Cut() bool
- func (h *BufPane) CutLine() bool
- func (h *BufPane) CycleAutocompleteBack() bool
- func (h *BufPane) Delete() bool
- func (h *BufPane) DeleteLine() bool
- func (h *BufPane) DeleteWordLeft() bool
- func (h *BufPane) DeleteWordRight() bool
- func (h *BufPane) Deselect() bool
- func (h *BufPane) DiffNext() bool
- func (h *BufPane) DiffPrevious() bool
- func (h *BufPane) DoKeyEvent(e Event) bool
- func (h *BufPane) DoMouseEvent(e MouseEvent, te *tcell.EventMouse) bool
- func (h *BufPane) DoRuneInsert(r rune)
- func (h *BufPane) DuplicateLine() bool
- func (h *BufPane) End() bool
- func (h *BufPane) EndOfLine() bool
- func (h *BufPane) Escape() bool
- func (h *BufPane) EvalCmd(args []string)
- func (h *BufPane) Find() bool
- func (h *BufPane) FindLiteral() bool
- func (h *BufPane) FindNext() bool
- func (h *BufPane) FindPrevious() bool
- func (h *BufPane) ForceQuit() bool
- func (h *BufPane) GotoCmd(args []string)
- func (h *BufPane) GotoLoc(loc buffer.Loc)
- func (h *BufPane) HSplitAction() bool
- func (h *BufPane) HSplitBuf(buf *buffer.Buffer) *BufPane
- func (h *BufPane) HSplitCmd(args []string)
- func (h *BufPane) HSplitIndex(buf *buffer.Buffer, bottom bool) *BufPane
- func (h *BufPane) HalfPageDown() bool
- func (h *BufPane) HalfPageUp() bool
- func (h *BufPane) HandleCommand(input string)
- func (h *BufPane) HandleEvent(event tcell.Event)
- func (h *BufPane) HasKeyEvent(e Event) bool
- func (h *BufPane) HelpCmd(args []string)
- func (h *BufPane) ID() uint64
- func (h *BufPane) IndentLine() bool
- func (h *BufPane) IndentSelection() bool
- func (h *BufPane) InsertNewline() bool
- func (h *BufPane) InsertTab() bool
- func (h *BufPane) JumpLine() bool
- func (h *BufPane) JumpToMatchingBrace() bool
- func (h *BufPane) MemUsageCmd(args []string)
- func (h *BufPane) MouseMultiCursor(e *tcell.EventMouse) bool
- func (h *BufPane) MousePress(e *tcell.EventMouse) bool
- func (h *BufPane) MoveCursorDown(n int)
- func (h *BufPane) MoveCursorUp(n int)
- func (h *BufPane) MoveLinesDown() bool
- func (h *BufPane) MoveLinesUp() bool
- func (h *BufPane) Name() string
- func (h *BufPane) NewTabCmd(args []string)
- func (h *BufPane) NextSplit() bool
- func (h *BufPane) NextTab() bool
- func (h *BufPane) None() bool
- func (h *BufPane) OpenBuffer(b *buffer.Buffer)
- func (h *BufPane) OpenCmd(args []string)
- func (h *BufPane) OpenFile() bool
- func (h *BufPane) OpenLogBuf()
- func (h *BufPane) OutdentLine() bool
- func (h *BufPane) OutdentSelection() bool
- func (h *BufPane) PageDown() bool
- func (h *BufPane) PageUp() bool
- func (h *BufPane) ParagraphNext() bool
- func (h *BufPane) ParagraphPrevious() bool
- func (h *BufPane) Paste() bool
- func (h *BufPane) PastePrimary() bool
- func (h *BufPane) PlayMacro() bool
- func (h *BufPane) PluginCB(cb string) bool
- func (h *BufPane) PluginCBRune(cb string, r rune) bool
- func (h *BufPane) PluginCmd(args []string)
- func (h *BufPane) PreviousSplit() bool
- func (h *BufPane) PreviousTab() bool
- func (h *BufPane) PwdCmd(args []string)
- func (h *BufPane) Quit() bool
- func (h *BufPane) QuitAll() bool
- func (h *BufPane) QuitCmd(args []string)
- func (h *BufPane) RawCmd(args []string)
- func (h *BufPane) Redo() bool
- func (h *BufPane) ReloadCmd(args []string)
- func (h *BufPane) RemoveAllMultiCursors() bool
- func (h *BufPane) RemoveMultiCursor() bool
- func (h *BufPane) ReopenCmd(args []string)
- func (h *BufPane) ReplaceAllCmd(args []string)
- func (h *BufPane) ReplaceCmd(args []string)
- func (h *BufPane) ResetCmd(args []string)
- func (h *BufPane) Resize(width, height int)
- func (h *BufPane) ResizePane(size int)
- func (h *BufPane) Retab() bool
- func (h *BufPane) RetabCmd(args []string)
- func (h *BufPane) RunCmd(args []string)
- func (h *BufPane) Save() bool
- func (h *BufPane) SaveAll() bool
- func (h *BufPane) SaveAs() bool
- func (h *BufPane) SaveAsCB(action string, callback func()) bool
- func (h *BufPane) SaveCB(action string, callback func()) bool
- func (h *BufPane) SaveCmd(args []string)
- func (h *BufPane) ScrollAdjust()
- func (h *BufPane) ScrollDown(n int)
- func (h *BufPane) ScrollDownAction() bool
- func (h *BufPane) ScrollUp(n int)
- func (h *BufPane) ScrollUpAction() bool
- func (h *BufPane) Search(str string, useRegex bool, searchDown bool) error
- func (h *BufPane) SelectAll() bool
- func (h *BufPane) SelectDown() bool
- func (h *BufPane) SelectLeft() bool
- func (h *BufPane) SelectLine() bool
- func (h *BufPane) SelectPageDown() bool
- func (h *BufPane) SelectPageUp() bool
- func (h *BufPane) SelectRight() bool
- func (h *BufPane) SelectToEnd() bool
- func (h *BufPane) SelectToEndOfLine() bool
- func (h *BufPane) SelectToStart() bool
- func (h *BufPane) SelectToStartOfLine() bool
- func (h *BufPane) SelectToStartOfText() bool
- func (h *BufPane) SelectToStartOfTextToggle() bool
- func (h *BufPane) SelectUp() bool
- func (h *BufPane) SelectWordLeft() bool
- func (h *BufPane) SelectWordRight() bool
- func (h *BufPane) SetActive(b bool)
- func (h *BufPane) SetCmd(args []string)
- func (h *BufPane) SetID(i uint64)
- func (h *BufPane) SetLocalCmd(args []string)
- func (h *BufPane) SetTab(t *Tab)
- func (h *BufPane) ShellMode() bool
- func (h *BufPane) ShowCmd(args []string)
- func (h *BufPane) ShowKeyCmd(args []string)
- func (h *BufPane) SkipMultiCursor() bool
- func (h *BufPane) SpawnMultiCursor() bool
- func (h *BufPane) SpawnMultiCursorDown() bool
- func (h *BufPane) SpawnMultiCursorSelect() bool
- func (h *BufPane) SpawnMultiCursorUp() bool
- func (h *BufPane) Start() bool
- func (h *BufPane) StartOfLine() bool
- func (h *BufPane) StartOfText() bool
- func (h *BufPane) StartOfTextToggle() bool
- func (*BufPane) Suspend() bool
- func (h *BufPane) Tab() *Tab
- func (h *BufPane) TabMoveCmd(args []string)
- func (h *BufPane) TabSwitchCmd(args []string)
- func (h *BufPane) TermCmd(args []string)
- func (h *BufPane) TextFilterCmd(args []string)
- func (h *BufPane) ToggleDiffGutter() bool
- func (h *BufPane) ToggleHelp() bool
- func (h *BufPane) ToggleHighlightSearch() bool
- func (h *BufPane) ToggleKeyMenu() bool
- func (h *BufPane) ToggleLogCmd(args []string)
- func (h *BufPane) ToggleMacro() bool
- func (h *BufPane) ToggleOverwriteMode() bool
- func (h *BufPane) ToggleRuler() bool
- func (h *BufPane) UnbindCmd(args []string)
- func (h *BufPane) Undo() bool
- func (h *BufPane) UnhighlightSearch() bool
- func (h *BufPane) Unsplit() bool
- func (h *BufPane) VSplitAction() bool
- func (h *BufPane) VSplitBuf(buf *buffer.Buffer) *BufPane
- func (h *BufPane) VSplitCmd(args []string)
- func (h *BufPane) VSplitIndex(buf *buffer.Buffer, right bool) *BufPane
- func (h *BufPane) WordLeft() bool
- func (h *BufPane) WordRight() bool
- type Command
- type Event
- type Handler
- type InfoKeyAction
- type InfoPane
- func (h *InfoPane) AbortCommand()
- func (h *InfoPane) Close()
- func (h *InfoPane) CommandComplete()
- func (h *InfoPane) DoKeyEvent(e KeyEvent) bool
- func (h *InfoPane) ExecuteCommand()
- func (h *InfoPane) HandleEvent(event tcell.Event)
- func (h *InfoPane) HistoryDown()
- func (h *InfoPane) HistorySearchDown()
- func (h *InfoPane) HistorySearchUp()
- func (h *InfoPane) HistoryUp()
- type KeyEvent
- type KeySequenceEvent
- type KeyTree
- func (k *KeyTree) DeleteAllBindings(e Event)
- func (k *KeyTree) DeleteBinding(e Event)
- func (k *KeyTree) HasMode(mode string) bool
- func (k *KeyTree) NextEvent(e Event, mouse *tcell.EventMouse) (PaneKeyAction, bool)
- func (k *KeyTree) RecordedEventsStr() string
- func (k *KeyTree) RegisterKeyAnyBinding(e Event, a PaneKeyAnyAction)
- func (k *KeyTree) RegisterKeyBinding(e Event, a PaneKeyAction)
- func (k *KeyTree) RegisterMouseBinding(e Event, a PaneMouseAction)
- func (k *KeyTree) ResetEvents()
- func (k *KeyTree) SetMode(mode string, en bool)
- type KeyTreeCursor
- type KeyTreeNode
- type ModeConstraint
- type MouseEvent
- type Pane
- type PaneKeyAction
- type PaneKeyAnyAction
- type PaneMouseAction
- type RawEvent
- type RawPane
- type Tab
- type TabList
- type TermKeyAction
- type TermPane
- func (t *TermPane) Close()
- func (t *TermPane) CommandMode()
- func (t *TermPane) Exit()
- func (t *TermPane) HandleCommand(input string)
- func (t *TermPane) HandleEvent(event tcell.Event)
- func (t *TermPane) ID() uint64
- func (t *TermPane) NextSplit()
- func (t *TermPane) Quit()
- func (t *TermPane) SetID(i uint64)
- func (t *TermPane) SetTab(tab *Tab)
- func (t *TermPane) Tab() *Tab
- func (t *TermPane) Unsplit()
- type TreeAction
Constants ¶
const TermEmuSupported = true
TermEmuSupported is a constant that marks if the terminal emulator is supported
Variables ¶
var Binder = map[string]func(e Event, action string){ "command": InfoMapEvent, "buffer": BufMapEvent, "terminal": TermMapEvent, }
var BufKeyActions = map[string]BufKeyAction{}/* 113 elements not displayed */
BufKeyActions contains the list of all possible key actions the bufhandler could execute
var BufMouseActions = map[string]BufMouseAction{ "MousePress": (*BufPane).MousePress, "MouseMultiCursor": (*BufPane).MouseMultiCursor, }
BufMouseActions contains the list of all possible mouse actions the bufhandler could execute
var InfoKeyActions = map[string]InfoKeyAction{ "HistoryUp": (*InfoPane).HistoryUp, "HistoryDown": (*InfoPane).HistoryDown, "HistorySearchUp": (*InfoPane).HistorySearchUp, "HistorySearchDown": (*InfoPane).HistorySearchDown, "CommandComplete": (*InfoPane).CommandComplete, "ExecuteCommand": (*InfoPane).ExecuteCommand, "AbortCommand": (*InfoPane).AbortCommand, }
InfoKeyActions contains the list of all possible key actions the infopane could execute
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, "SelectToStartOfText": true, "SelectToStartOfTextToggle": true, "SelectToEndOfLine": true, "ParagraphPrevious": true, "ParagraphNext": true, "InsertNewline": true, "Backspace": true, "Delete": true, "InsertTab": true, "FindNext": true, "FindPrevious": true, "CopyLine": true, "Copy": true, "Cut": true, "CutLine": true, "DuplicateLine": true, "DeleteLine": true, "MoveLinesUp": true, "MoveLinesDown": true, "IndentSelection": true, "OutdentSelection": true, "OutdentLine": true, "IndentLine": true, "Paste": true, "PastePrimary": true, "SelectPageUp": true, "SelectPageDown": true, "StartOfLine": true, "StartOfText": true, "StartOfTextToggle": 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
var PluginCmds = []string{"install", "remove", "update", "available", "list", "search"}
var TermKeyActions = map[string]TermKeyAction{ "Exit": (*TermPane).Exit, "CommandMode": (*TermPane).CommandMode, "NextSplit": (*TermPane).NextSplit, }
TermKeyActions contains the list of all possible key actions the termpane could execute
Functions ¶
func CommandComplete ¶
CommandComplete autocompletes commands
func DefaultBindings ¶
DefaultBindings returns a map containing micro's default keybindings
func HelpComplete ¶
HelpComplete autocompletes help topics
func InfoMapEvent ¶
func InitBindings ¶
func InitBindings()
InitBindings intializes the bindings map by reading from bindings.json
func InitCommands ¶
func InitCommands()
func MakeCommand ¶
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 OptionComplete ¶
OptionComplete autocompletes options
func OptionValueComplete ¶
OptionValueComplete completes values for various options
func PluginCmdComplete ¶
PluginCmdComplete autocompletes the plugin command
func PluginComplete ¶
PluginComplete completes values for the plugin command
func ReloadConfig ¶
func ReloadConfig()
func RunTermEmulator ¶
func RunTermEmulator(h *BufPane, input string, wait bool, getOutput bool, callback func(out string, userargs []interface{}), userargs []interface{}) error
RunTermEmulator starts a terminal emulator from a bufpane with the given input (command) if wait is true it will wait for the user to exit by pressing enter once the executable has terminated if getOutput is true it will redirect the stdout of the process to a pipe which will be passed to the callback which is a function that takes a string and a list of optional user arguments
func SetGlobalOption ¶
func SetGlobalOptionNative ¶
func TermMapEvent ¶
func TryBindKey ¶
TryBindKey tries to bind a key by writing to config.ConfigDir/bindings.json Returns true if the keybinding already existed and a possible error
Types ¶
type BufKeyAction ¶
BufKeyAction represents an action bound to a key.
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 ¶
BufMouseAction is an action that must be bound to a mouse event.
type BufPane ¶
type BufPane struct { display.BWindow // Buf is the buffer this BufPane views Buf *buffer.Buffer // Cursor is the currently active buffer cursor Cursor *buffer.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
LogBufPane is a global log buffer.
func NewBufPane ¶
NewBufPane creates a new buffer pane with the given window.
func NewBufPaneFromBuf ¶
NewBufPaneFromBuf constructs a new pane from the given buffer and automatically creates a buf window.
func (*BufPane) Autocomplete ¶
Autocomplete cycles the suggestions and performs autocompletion if there are suggestions
func (*BufPane) ClearStatus ¶
ClearStatus clears the messenger bar
func (*BufPane) CommandMode ¶
CommandMode lets the user enter a command
func (*BufPane) CursorPageDown ¶
CursorPageDown places the cursor a page up
func (*BufPane) CursorPageUp ¶
CursorPageUp places the cursor a page up
func (*BufPane) CursorRight ¶
CursorRight moves the cursor right
func (*BufPane) CursorStart ¶
CursorStart moves the cursor to the start of the buffer
func (*BufPane) CycleAutocompleteBack ¶
CycleAutocompleteBack cycles back in the autocomplete suggestion list
func (*BufPane) DeleteLine ¶
DeleteLine deletes the current line
func (*BufPane) DeleteWordLeft ¶
DeleteWordLeft deletes the word to the left of the cursor
func (*BufPane) DeleteWordRight ¶
DeleteWordRight deletes the word to the right of the cursor
func (*BufPane) DiffPrevious ¶
DiffPrevious searches forward until the end of the previous block of diffs
func (*BufPane) DoKeyEvent ¶
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 ¶
DoRuneInsert inserts a given rune into the current buffer (possibly multiple times for multiple cursors)
func (*BufPane) DuplicateLine ¶
DuplicateLine duplicates the current line or selection
func (*BufPane) FindLiteral ¶
FindLiteral is the same as Find() but does not support regular expressions
func (*BufPane) FindPrevious ¶
FindPrevious searches backwards for the last used search term
func (*BufPane) ForceQuit ¶
ForceQuit closes the current tab or view even if there are unsaved changes (no prompt)
func (*BufPane) GotoCmd ¶
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) GotoLoc ¶
GotoLoc moves the cursor to a new location and adjusts the view accordingly. Use GotoLoc when the new location may be far away from the current location.
func (*BufPane) HSplitAction ¶
HSplitAction opens an empty horizontal split
func (*BufPane) HSplitCmd ¶
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) HSplitIndex ¶
HSplitIndex opens the given buffer in a horizontal split on the given side.
func (*BufPane) HalfPageDown ¶
HalfPageDown scrolls the view down half a page
func (*BufPane) HalfPageUp ¶
HalfPageUp scrolls the view up half a page
func (*BufPane) HandleCommand ¶
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 (*BufPane) IndentLine ¶
IndentLine moves the current line forward one indentation
func (*BufPane) IndentSelection ¶
IndentSelection indents the current selection
func (*BufPane) InsertNewline ¶
InsertNewline inserts a newline plus possible some whitespace if autoindent is on
func (*BufPane) JumpToMatchingBrace ¶
JumpToMatchingBrace moves the cursor to the matching brace if it is currently on a brace
func (*BufPane) MemUsageCmd ¶
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 ¶
MouseMultiCursor is a mouse action which puts a new cursor at the mouse position
func (*BufPane) MousePress ¶
MousePress is the event that should happen when a normal click happens This is almost always bound to left click
func (*BufPane) MoveCursorDown ¶
MoveCursorDown is not an action
func (*BufPane) MoveLinesDown ¶
MoveLinesDown moves down the current line or selected lines if any
func (*BufPane) MoveLinesUp ¶
MoveLinesUp moves up the current line or selected lines if any
func (*BufPane) OpenBuffer ¶
OpenBuffer opens the given buffer in this pane.
func (*BufPane) OpenLogBuf ¶
func (h *BufPane) OpenLogBuf()
OpenLogBuf opens the log buffer from the current bufpane If the current bufpane is a log buffer nothing happens, otherwise the log buffer is opened in a horizontal split
func (*BufPane) OutdentLine ¶
OutdentLine moves the current line back one indentation
func (*BufPane) OutdentSelection ¶
OutdentSelection takes the current selection and moves it back one indent level
func (*BufPane) ParagraphNext ¶
ParagraphNext moves the cursor to the next empty line, or end of the buffer if there's none
func (*BufPane) ParagraphPrevious ¶
ParagraphPrevious moves the cursor to the previous empty line, or beginning of the buffer if there's none
func (*BufPane) Paste ¶
Paste whatever is in the system clipboard into the buffer Delete and paste if the user has a selection
func (*BufPane) PastePrimary ¶
PastePrimary pastes from the primary clipboard (only use on linux)
func (*BufPane) PluginCB ¶
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 ¶
PluginCBRune is the same as PluginCB but also passes a rune to the plugins
func (*BufPane) PluginCmd ¶
PluginCmd installs, removes, updates, lists, or searches for given plugins
func (*BufPane) PreviousSplit ¶
PreviousSplit changes the view to the previous split
func (*BufPane) PreviousTab ¶
PreviousTab switches to the previous tab in the tab list
func (*BufPane) RawCmd ¶
RawCmd opens a new raw view which displays the escape sequences micro is receiving in real-time
func (*BufPane) RemoveAllMultiCursors ¶
RemoveAllMultiCursors removes all cursors except the base cursor
func (*BufPane) RemoveMultiCursor ¶
RemoveMultiCursor removes the latest multiple cursor
func (*BufPane) ReplaceAllCmd ¶
ReplaceAllCmd replaces search term all at once
func (*BufPane) ReplaceCmd ¶
ReplaceCmd runs search and replace
func (*BufPane) ResizePane ¶
func (*BufPane) Retab ¶
Retab changes all tabs to spaces or all spaces to tabs depending on the user's settings
func (*BufPane) RetabCmd ¶
RetabCmd changes all spaces to tabs or all tabs to spaces depending on the user's settings
func (*BufPane) SaveAsCB ¶
SaveAsCB performs a save as and does a callback at the very end (after all prompts have been resolved) The callback is only called if the save was successful
func (*BufPane) SaveCB ¶
SaveCB performs a save and does a callback at the very end (after all prompts have been resolved)
func (*BufPane) ScrollAdjust ¶
func (h *BufPane) ScrollAdjust()
ScrollAdjust can be used to shift the view so that the last line is at the bottom if the user has scrolled past the last line.
func (*BufPane) ScrollDownAction ¶
ScrollDownAction scrolls the view up
func (*BufPane) ScrollUpAction ¶
ScrollUpAction scrolls the view up
func (*BufPane) Search ¶
Search searches for a given string/regex in the buffer and selects the next match if a match is found This function behaves the same way as Find and FindLiteral actions: it affects the buffer's LastSearch and LastSearchRegex (saved searches) for use with FindNext and FindPrevious, and turns HighlightSearch on or off according to hlsearch setting
func (*BufPane) SelectLeft ¶
SelectLeft selects the character to the left of the cursor
func (*BufPane) SelectLine ¶
SelectLine selects the entire current line
func (*BufPane) SelectPageDown ¶
SelectPageDown selects down one page
func (*BufPane) SelectPageUp ¶
SelectPageUp selects up one page
func (*BufPane) SelectRight ¶
SelectRight selects the character to the right of the cursor
func (*BufPane) SelectToEnd ¶
SelectToEnd selects the text from the cursor to the end of the buffer
func (*BufPane) SelectToEndOfLine ¶
SelectToEndOfLine selects to the end of the current line
func (*BufPane) SelectToStart ¶
SelectToStart selects the text from the cursor to the start of the buffer
func (*BufPane) SelectToStartOfLine ¶
SelectToStartOfLine selects to the start of the current line
func (*BufPane) SelectToStartOfText ¶
SelectToStartOfText selects to the start of the text on the current line
func (*BufPane) SelectToStartOfTextToggle ¶
SelectToStartOfTextToggle toggles the selection between the start of the text on the current line and the start of the line
func (*BufPane) SelectWordLeft ¶
SelectWordLeft selects the word to the left of the cursor
func (*BufPane) SelectWordRight ¶
SelectWordRight selects the word to the right of the cursor
func (*BufPane) SetLocalCmd ¶
SetLocalCmd sets an option local to the buffer
func (*BufPane) ShowKeyCmd ¶
ShowKeyCmd displays the action that a key is bound to
func (*BufPane) SkipMultiCursor ¶
SkipMultiCursor moves the current multiple cursor to the next available position
func (*BufPane) SpawnMultiCursor ¶
SpawnMultiCursor creates a new multiple cursor at the next occurrence of the current selection or current word
func (*BufPane) SpawnMultiCursorDown ¶
SpawnMultiCursorDown creates additional cursor, at the same X (if possible), one Y more.
func (*BufPane) SpawnMultiCursorSelect ¶
SpawnMultiCursorSelect adds a cursor at the beginning of each line of a selection
func (*BufPane) SpawnMultiCursorUp ¶
SpawnMultiCursorUp creates additional cursor, at the same X (if possible), one Y less.
func (*BufPane) StartOfLine ¶
StartOfLine moves the cursor to the start of the line
func (*BufPane) StartOfText ¶
StartOfText moves the cursor to the start of the text of the line
func (*BufPane) StartOfTextToggle ¶
StartOfTextToggle toggles the cursor between the start of the text of the line and the start of the line
func (*BufPane) Suspend ¶
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) TabMoveCmd ¶
TabMoveCmd moves the current tab to a given index (starts at 1). The displaced tabs are moved up.
func (*BufPane) TabSwitchCmd ¶
TabSwitchCmd switches to a given tab either by name or by number
func (*BufPane) TextFilterCmd ¶
TextFilterCmd filters the selection through the command. Selection goes to the command input. On successful run command output replaces the current selection.
func (*BufPane) ToggleDiffGutter ¶
ToggleDiffGutter turns the diff gutter off and on
func (*BufPane) ToggleHighlightSearch ¶
ToggleHighlightSearch toggles highlighting all instances of the last used search term
func (*BufPane) ToggleKeyMenu ¶
ToggleKeyMenu toggles the keymenu option and resizes all tabs
func (*BufPane) ToggleLogCmd ¶
ToggleLogCmd toggles the log view
func (*BufPane) ToggleMacro ¶
ToggleMacro toggles recording of a macro
func (*BufPane) ToggleOverwriteMode ¶
ToggleOverwriteMode lets the user toggle the text overwrite mode
func (*BufPane) ToggleRuler ¶
ToggleRuler turns line numbers off and on
func (*BufPane) UnhighlightSearch ¶
UnhighlightSearch unhighlights all instances of the last used search term
func (*BufPane) VSplitAction ¶
VSplitAction opens an empty vertical split
func (*BufPane) VSplitCmd ¶
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) VSplitIndex ¶
VSplitIndex opens the given buffer in a vertical split on the given side.
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 {
Name() string
}
func ConstructEvent ¶
ConstructEvent takes a tcell event and returns a micro event. Note that tcell events can't express certain micro events such as key sequences. This function is mostly used for debugging/raw panes or constructing intermediate micro events while parsing a sequence.
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 ¶
var InfoBar *InfoPane
InfoBar is the global info bar.
func NewInfoBar ¶
func NewInfoBar() *InfoPane
func (*InfoPane) CommandComplete ¶
func (h *InfoPane) CommandComplete()
Autocomplete begins autocompletion
func (*InfoPane) DoKeyEvent ¶
DoKeyEvent executes a key event for the command bar, doing any overridden actions
func (*InfoPane) ExecuteCommand ¶
func (h *InfoPane) ExecuteCommand()
ExecuteCommand completes the prompt
func (*InfoPane) HandleEvent ¶
func (h *InfoPane) HandleEvent(event tcell.Event)
func (*InfoPane) HistorySearchDown ¶
func (h *InfoPane) HistorySearchDown()
HistorySearchDown fetches the next history item beginning with the text in the infobuffer before cursor
func (*InfoPane) HistorySearchUp ¶
func (h *InfoPane) HistorySearchUp()
HistorySearchUp fetches the previous history item beginning with the text in the infobuffer before cursor
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 KeySequenceEvent ¶
type KeySequenceEvent struct {
// contains filtered or unexported fields
}
A KeySequence defines a list of consecutive events. All events in the sequence must be KeyEvents or MouseEvents.
func (KeySequenceEvent) Name ¶
func (k KeySequenceEvent) Name() string
type KeyTree ¶
type KeyTree struct {
// contains filtered or unexported fields
}
A KeyTree is a data structure for storing keybindings. It maps key events to actions, and maintains a set of currently enabled modes, which affects the action that is returned for a key event. The tree acts like a Trie for Events to handle sequence events.
var BufBindings *KeyTree
BufBindings stores the bindings for the buffer pane type.
var InfoBindings *KeyTree
var InfoBufBindings *KeyTree
var TermBindings *KeyTree
func (*KeyTree) DeleteAllBindings ¶
DeleteAllBindings removes all actions associated with the given event, regardless of whether they are active or not.
func (*KeyTree) DeleteBinding ¶
DeleteBinding removes any currently active actions associated with the given event.
func (*KeyTree) NextEvent ¶
func (k *KeyTree) NextEvent(e Event, mouse *tcell.EventMouse) (PaneKeyAction, bool)
NextEvent returns the action for the current sequence where e is the next event. Even if the action was registered as a PaneKeyAnyAction or PaneMouseAction, it will be returned as a PaneKeyAction closure where the appropriate arguments have been provided. If no action is associated with the given Event, or mode constraints are not met for that action, nil is returned. A boolean is returned to indicate if there is a conflict with this action. A conflict occurs when there is an active action for this event but there are bindings associated with further sequences starting with this event. The calling function can decide what to do about the conflict (e.g. use a timeout).
func (*KeyTree) RecordedEventsStr ¶
RecordedEventsStr returns the list of recorded events as a string
func (*KeyTree) RegisterKeyAnyBinding ¶
func (k *KeyTree) RegisterKeyAnyBinding(e Event, a PaneKeyAnyAction)
RegisterKeyAnyBinding registers a PaneKeyAnyAction with an Event. The event should contain an "any" event.
func (*KeyTree) RegisterKeyBinding ¶
func (k *KeyTree) RegisterKeyBinding(e Event, a PaneKeyAction)
RegisterKeyBinding registers a PaneKeyAction with an Event.
func (*KeyTree) RegisterMouseBinding ¶
func (k *KeyTree) RegisterMouseBinding(e Event, a PaneMouseAction)
RegisterMouseBinding registers a PaneMouseAction with an Event. The event should contain a mouse event.
func (*KeyTree) ResetEvents ¶
func (k *KeyTree) ResetEvents()
ResetEvents sets the current sequence back to the initial value.
type KeyTreeCursor ¶
type KeyTreeCursor struct {
// contains filtered or unexported fields
}
A KeyTreeCursor keeps track of the current location within the tree, and stores any information from previous events that may be needed to execute the action (values of wildcard events or mouse events)
func (*KeyTreeCursor) MakeClosure ¶
func (k *KeyTreeCursor) MakeClosure(a TreeAction) PaneKeyAction
MakeClosure uses the information stored in a key tree cursor to construct a PaneKeyAction from a TreeAction (which may have a PaneKeyAction, PaneMouseAction, or AnyAction)
type KeyTreeNode ¶
type KeyTreeNode struct {
// contains filtered or unexported fields
}
A KeyTreeNode stores a single node in the KeyTree (trie). The children are stored as a map, and any node may store a list of actions (the list will be nil if no actions correspond to a certain node)
func NewKeyTreeNode ¶
func NewKeyTreeNode() *KeyTreeNode
type ModeConstraint ¶
type ModeConstraint struct {
// contains filtered or unexported fields
}
A ModeConstraint specifies that an action can only be executed while a certain mode is enabled or disabled.
type MouseEvent ¶
type MouseEvent struct {
// contains filtered or unexported fields
}
MouseEvent is a mouse event with a mouse button and any possible key modifiers
func (MouseEvent) Name ¶
func (m MouseEvent) Name() string
type Pane ¶
type Pane interface { Handler display.Window ID() uint64 SetID(i uint64) Name() string Close() SetTab(t *Tab) Tab() *Tab }
A Pane is a general interface for a window in the editor.
type PaneKeyAction ¶
func BufKeyActionGeneral ¶
func BufKeyActionGeneral(a BufKeyAction) PaneKeyAction
BufKeyActionGeneral makes a general pane action from a BufKeyAction.
func InfoKeyActionGeneral ¶
func InfoKeyActionGeneral(a InfoKeyAction) PaneKeyAction
func TermKeyActionGeneral ¶
func TermKeyActionGeneral(a TermKeyAction) PaneKeyAction
type PaneKeyAnyAction ¶
type PaneMouseAction ¶
func BufMouseActionGeneral ¶
func BufMouseActionGeneral(a BufMouseAction) PaneMouseAction
BufMouseActionGeneral makes a general pane mouse action from a BufKeyAction.
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 NewRawPaneFromWin ¶
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 NewTabFromBuffer ¶
NewTabFromBuffer creates a new tab from the given buffer
func NewTabFromPane ¶
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 ¶
Remove pane removes the pane with the given index
type TabList ¶
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 ¶
NewTabList creates a TabList from a list of buffers by creating a Tab for each buffer
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) 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 TermKeyAction ¶
type TermKeyAction func(*TermPane)
type TermPane ¶
func NewTermPane ¶
func (*TermPane) CommandMode ¶
func (t *TermPane) CommandMode()
CommandMode opens the termpane's command mode
func (*TermPane) HandleCommand ¶
HandleCommand handles a command for the term pane
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
type TreeAction ¶
type TreeAction struct {
// contains filtered or unexported fields
}
A TreeAction stores an action, and a set of mode constraints for the action to be active.