Add more docs for plugins and keybindings

This commit is contained in:
Zachary Yedidia
2016-08-17 11:56:56 -04:00
parent 70c3d42f9c
commit 41065f0222
2 changed files with 226 additions and 1 deletions

View File

@@ -101,3 +101,211 @@ and quit you can bind it like so:
"Alt-s": "Save,Quit"
}
```
# Bindable actions and bindable keys
The list of default keybindings contains most of the possible actions and keys
which you can use, but not all of them. Here is a full list of both.
Full list of possible actions:
```
CursorUp
CursorDown
CursorPageUp
CursorPageDown
CursorLeft
CursorRight
CursorStart
CursorEnd
SelectToStart
SelectToEnd
SelectUp
SelectDown
SelectLeft
SelectRight
WordRight
WordLeft
SelectWordRight
SelectWordLeft
DeleteWordRight
DeleteWordLeft
SelectToStartOfLine
SelectToEndOfLine
InsertNewline
InsertSpace
Backspace
Delete
InsertTab
Save
Find
FindNext
FindPrevious
Undo
Redo
Copy
Cut
CutLine
DuplicateLine
DeleteLine
IndentSelection
OutdentSelection
Paste
SelectAll
OpenFile
Start
End
PageUp
PageDown
HalfPageUp
HalfPageDown
StartOfLine
EndOfLine
ToggleHelp
ToggleRuler
JumpLine
ClearStatus
ShellMode
CommandMode
Quit
AddTab
PreviousTab
NextTab
NextSplit
PreviousSplit
```
Here is the list of all possible keys you can bind:
```
Up
Down
Right
Left
UpLeft
UpRight
DownLeft
DownRight
Center
PageUp
PageDown
Home
End
Insert
Delete
Help
Exit
Clear
Cancel
Print
Pause
Backtab
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
F13
F14
F15
F16
F17
F18
F19
F20
F21
F22
F23
F24
F25
F26
F27
F28
F29
F30
F31
F32
F33
F34
F35
F36
F37
F38
F39
F40
F41
F42
F43
F44
F45
F46
F47
F48
F49
F50
F51
F52
F53
F54
F55
F56
F57
F58
F59
F60
F61
F62
F63
F64
CtrlSpace
CtrlA
CtrlB
CtrlC
CtrlD
CtrlE
CtrlF
CtrlG
CtrlH
CtrlI
CtrlJ
CtrlK
CtrlL
CtrlM
CtrlN
CtrlO
CtrlP
CtrlQ
CtrlR
CtrlS
CtrlT
CtrlU
CtrlV
CtrlW
CtrlX
CtrlY
CtrlZ
CtrlLeftSq
CtrlBackslash
CtrlRightSq
CtrlCarat
CtrlUnderscore
Backspace
Tab
Esc
Escape
Enter
Backspace2
```
Additionally, alt keys can be bound by using `Alt-key`. For example `Alt-a`
or `Alt-Up`. Micro supports an optional `-` between modifiers like `Alt` and `Ctrl`
so `Alt-a` could be rewritten as `Alta` (case matters for alt bindings). This is
why in the default keybindings you can see `AltShiftLeft` instead of `Alt-ShiftLeft`
(they are equivalent).

View File

@@ -58,7 +58,6 @@ call `function` when executed.
* HandleShellCommand(shellCmd string, interactive bool): runs the given shell
command
// Used for asynchronous jobs
* JobStart(cmd string, onStdout, onStderr, onExit string, userargs ...string):
Starts running the given shell command in the background. `onStdout` `onStderr` and `onExit`
are callbacks to lua functions which will be called when the given actions happen
@@ -72,3 +71,21 @@ to the background process.
This may seem like a small list of available functions but some of the objects
returned by the functions have many methods. `CurView()` returns a view object
which has all the actions which you can call. For example `CurView():Save()`.
You can see the full list of possible actions in the keybindings help topic.
Using the view object, you can also access the buffer associated with that view
by using `CurView().Buf`, which lets you access the `FileType`, `Path`, `Name`...
The possible methods which you can call using the `messenger` variable are:
* `messenger.Message(msg ...interface{})`
* `messenger.Error(msg ...interface{})`
* `messenger.YesNoPrompt(prompt string) (bool, bool)`
* `messenger.Prompt(prompt, historyType string, completionType Completion) (string, bool)`
If you want a standard prompt, just use `messenger.Prompt(prompt, "", 0)`
# 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).