X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=runtime%2Fhelp%2Fplugins.md;h=1818b96bddd4d11f677f4b4439c6556f2d214830;hb=54c23cae72d7237bc898a59f79aad0acffdf0ffe;hp=b94adcd1b632e2107fb5d659923330b1ff495268;hpb=0d4f85304bdfd8cfbd378f88abcc844fbcd4c8da;p=micro.git diff --git a/runtime/help/plugins.md b/runtime/help/plugins.md index b94adcd1..1818b96b 100644 --- a/runtime/help/plugins.md +++ b/runtime/help/plugins.md @@ -43,6 +43,12 @@ are called when certain events happen. Here is the list of callbacks which micro defines: * `init()`: this function should be used for your plugin initialization. + This function is called after buffers have been initialized. + +* `preinit()`: initialization function called before buffers have been + initialized. + +* `postinit()`: initialization function called after `init()`. * `onBufferOpen(buf)`: runs when a buffer is opened. The input contains the buffer object. @@ -279,6 +285,7 @@ The packages and functions are listed below (in Go type signatures): string is a word character. - `String(b []byte) string`: converts a byte array to a string. - `RuneStr(r rune) string`: converts a rune to a string. + - `Unzip(src, dest string) error`: unzips a file to given folder. This may seem like a small list of available functions but some of the objects returned by the functions have many methods. The Lua plugin may access any @@ -352,6 +359,8 @@ strings regexp errors time +archive/zip +net/http ``` For documentation for each of these functions, see the Go standard @@ -359,6 +368,12 @@ library documentation at https://golang.org/pkg/ (for the packages exposed to micro plugins). The Lua standard library is also available to plugins though it is rather small. +The following functions are also available from the go-humanize package: + +The `humanize` package exposes: +* `Bytes` +* `Ordinal` + ## Adding help files, syntax files, or colorschemes in your plugin You can use the `AddRuntimeFile(name string, type config.RTFiletype, @@ -391,6 +406,9 @@ There are 6 default plugins that come pre-installed with micro. These are programming tool. * `status`: provides some extensions to the status line (integration with Git and more). +* `diff`: integrates the `diffgutter` option with Git. If you are in a Git + directory, the diff gutter will show changes with respect to the most + recent Git commit rather than the diff since opening the file. See `> help linter`, `> help comment`, and `> help status` for additional documentation specific to those plugins. @@ -403,7 +421,7 @@ your own plugins. Micro also has a built in plugin manager which you can invoke with the `> plugin ...` command, or in the shell with `micro -plugin ...`. -For the valid commands you can use, see the `command` help topic. +For the valid commands you can use, see the `commands` help topic. The manager fetches plugins from the channels (which is simply a list of plugin metadata) which it knows about. By default, micro only knows about the official