]> git.lizzy.rs Git - micro.git/blobdiff - runtime/help/plugins.md
Merge pull request #384 from boombuler/logview
[micro.git] / runtime / help / plugins.md
index 68fed73a5e0f849251a4fed27e6bec477deaa94e..555ef1803ae05c242f39ca3a246b3cf006ff83e4 100644 (file)
@@ -43,38 +43,48 @@ for functions are given using Go's type system):
 * `OS`: variable which gives the OS micro is currently running on (this is the same
 as Go's GOOS variable, so `darwin`, `windows`, `linux`, `freebsd`...)
 
+* `configDir`: contains the path to the micro configuration files
+
 * `tabs`: a list of all the tabs currently in use
 
 * `curTab`: the index of the current tabs in the tabs list
 
 * `messenger`: lets you send messages to the user or create prompts
 
+* `RuneStr(r rune) string`: returns a string containing the given rune
+
+* `Loc(x, y int) Loc`: returns a new `Loc` struct
+
+* `JoinPaths(dir... string) string` combines multiple directories to a full path
+
 * `GetOption(name string)`: returns the value of the requested option
 
 * `AddOption(name string, value interface{})`: sets the given option with the given
-   value (`interface{}` means any type in Go).
+   value (`interface{}` means any type in Go)
 
 * `SetOption(option, value string)`: sets the given option to the value. This will
    set the option globally, unless it is a local only option.
 
 * `SetLocalOption(option, value string, buffer *Buffer)`: sets the given option to
-   the value locally in the given buffer.
+   the value locally in the given buffer
 
-* `BindKey(key, action string)`: binds `key` to `action`.
+* `BindKey(key, action string)`: binds `key` to `action`
 
 * `MakeCommand(name, function string, completions ...Completion)`: 
    creates a command with `name` which will call `function` when executed.
    Use 0 for completions to get NoCompletion.
 
 * `MakeCompletion(function string)`:
-   creates a `Completion` to use with `MakeCommand`.
+   creates a `Completion` to use with `MakeCommand`
 
 * `CurView()`: returns the current view
 
 * `HandleCommand(cmd string)`: runs the given command
 
-* `HandleShellCommand(shellCmd string, interactive bool)`: runs the given shell
-   command
+* `HandleShellCommand(shellCmd string, interactive bool, waitToClose bool)`: runs the given shell
+   command. The `interactive` bool specifies whether the command should run in the background. The
+   `waitToClose` bool only applies if `interactive` is true and means that it should wait before
+   returning to the editor.
 
 * `JobStart(cmd string, onStdout, onStderr, onExit string, userargs ...string)`:
    Starts running the given shell command in the background. `onStdout` `onStderr` and `onExit`
@@ -107,6 +117,19 @@ The possible methods which you can call using the `messenger` variable are:
 
 If you want a standard prompt, just use `messenger.Prompt(prompt, "", 0)`
 
+# Adding help files, syntax files, or colorschemes in your plugin
+
+You can use the `AddRuntimeFile(name, type, path string)` function to add various kinds of
+files to your plugin. For example, if you'd like to add a help topic and to your plugin
+called `test`, you would create the `test.md` file for example, and runt the function:
+
+```lua
+AddRuntimeFile("test", "help", "test.md")
+```
+
+Use `AddRuntimeFilesFromDirectory(name, type, dir, pattern)` to add a number of files
+to the runtime.
+
 # Autocomplete command arguments
 
 See this example to learn how to use `MakeCompletion` and `MakeCommand`
@@ -140,4 +163,4 @@ MakeCommand("foo", "example.foo", MakeCompletion("example.complete"))
 # Default plugins
 
 For examples of plugins, see the default plugins `linter`, `go`, and `autoclose`.
-They are stored in Micro's github repository [here](https://github.com/zyedidia/micro/tree/master/runtime/plugins).
+They are stored in Micro's GitHub repository [here](https://github.com/zyedidia/micro/tree/master/runtime/plugins).