]> git.lizzy.rs Git - micro.git/blobdiff - runtime/help/plugins.md
Merge branch 'python-highlight-zero' of https://github.com/a11ce/micro into a11ce...
[micro.git] / runtime / help / plugins.md
index 8c8b3a5090296cd610f1af7a39db3a95a106c341..1818b96bddd4d11f677f4b4439c6556f2d214830 100644 (file)
@@ -11,7 +11,7 @@ from the go plugin, which has the following file structure:
 ```
 ~/.config/micro/plug/go-plugin/
     go.lua
 ```
 ~/.config/micro/plug/go-plugin/
     go.lua
-    info.json
+    repo.json
     help/
         go-plugin.md
 ```
     help/
         go-plugin.md
 ```
@@ -35,34 +35,6 @@ is unlikely for a plugin to need to add plugin files at runtime or
 syntax header files. No directory structure is enforced but keeping
 runtime files in their own directories is good practice.
 
 syntax header files. No directory structure is enforced but keeping
 runtime files in their own directories is good practice.
 
-# Info file
-
-The `info.json` for the Go plugin is the following:
-
-```
-{
-    "name": "go",
-    "description": "Go formatting and tool support",
-    "website": "https://github.com/micro-editor/go-plugin",
-       "install": "https://github.com/micro-editor/go-plugin",
-    "version": "1.0.0",
-    "require": [
-        "micro >= 2.0.0"
-    ]
-}
-```
-
-All fields are simply interpreted as strings, so the version does not
-need to be a semantic version, and the dependencies are also only
-meant to be parsed by humans. The name should be an identifier, and
-the website should point to a valid website. The install field should
-provide info about installing the plugin, or point to a website that
-provides information.
-
-Note that the name of the plugin is defined by the name field in
-the `info.json` and not by the installation path. Some functions micro
-exposes to plugins require passing the name of the plugin.
-
 ## Lua callbacks
 
 Plugins use Lua but also have access to many functions both from micro
 ## Lua callbacks
 
 Plugins use Lua but also have access to many functions both from micro
@@ -71,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.
 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.
 
 * `onBufferOpen(buf)`: runs when a buffer is opened. The input contains
    the buffer object.
@@ -102,16 +80,6 @@ within.  This is almost always the current bufpane.
 
 All available actions are listed in the keybindings section of the help.
 
 
 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.
 
 These functions should also return a boolean specifying whether the bufpane
 should be relocated to the cursor or not after the action is complete.
 
@@ -141,7 +109,12 @@ The packages and functions are listed below (in Go type signatures):
        `-debug` flag, or binary built with `build-dbg`).
 
     - `SetStatusInfoFn(fn string)`: register the given lua function as
        `-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)`:
 * `micro/config`
        - `MakeCommand(name string, action func(bp *BufPane, args[]string),
                    completer buffer.Completer)`:
@@ -312,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.
        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
 
 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
@@ -385,6 +359,8 @@ strings
 regexp
 errors
 time
 regexp
 errors
 time
+archive/zip
+net/http
 ```
 
 For documentation for each of these functions, see the Go standard
 ```
 
 For documentation for each of these functions, see the Go standard
@@ -392,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.
 
 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,
 ## Adding help files, syntax files, or colorschemes in your plugin
 
 You can use the `AddRuntimeFile(name string, type config.RTFiletype,
@@ -424,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).
    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.
 
 See `> help linter`, `> help comment`, and `> help status` for additional
 documentation specific to those plugins.
@@ -436,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 ...`.
 
 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
 
 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