}
if h.Buf.Type != buffer.BTLog {
- OpenLogBuf(h)
+ h.OpenLogBuf()
}
config.PluginCommand(buffer.LogBuf, args[0], args[1:])
// ToggleLogCmd toggles the log view
func (h *BufPane) ToggleLogCmd(args []string) {
if h.Buf.Type != buffer.BTLog {
- OpenLogBuf(h)
+ h.OpenLogBuf()
} else {
h.Quit()
}
var InfoBar *InfoPane
var LogBufPane *BufPane
+// InitGlobals initializes the log buffer and the info bar
func InitGlobals() {
InfoBar = NewInfoBar()
buffer.LogBuf = buffer.NewBufferFromString("", "Log", buffer.BTLog)
}
+// GetInfoBar returns the infobar pane
func GetInfoBar() *InfoPane {
return InfoBar
}
+// WriteLog writes a string to the log buffer
func WriteLog(s string) {
buffer.WriteLog(s)
if LogBufPane != nil {
}
}
-func OpenLogBuf(h *BufPane) {
+// 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 (h *BufPane) OpenLogBuf() {
LogBufPane = h.HSplitBuf(buffer.LogBuf)
LogBufPane.CursorEnd()
All available actions are listed in the keybindings section of the help.
-For callbacks to mouse actions, you are also given the event info:
-
-```lua
-function onMousePress(view, event)
- local x, y = event:Position()
-
- return false
-end
-```
-
These functions should also return a boolean specifying whether the bufpane
should be relocated to the cursor or not after the action is complete.
`-debug` flag, or binary built with `build-dbg`).
- `SetStatusInfoFn(fn string)`: register the given lua function as
- accessible from the statusline formatting options
+ accessible from the statusline formatting options.
+
+ - `CurPane() *BufPane`: returns the current BufPane, or nil if the
+ current pane is not a BufPane.
+
+ - `CurTab() *Tab`: returns the current tab.
* `micro/config`
- `MakeCommand(name string, action func(bp *BufPane, args[]string),
completer buffer.Completer)`: