Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cmd/micro/micro.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ func checkBackup(name string) error {
}

func exit(rc int) {
err := config.RunPluginFn("deinit")
if err != nil {
screen.TermMessage(err)
}

for _, b := range buffer.OpenBuffers {
if !b.Modified() {
b.Fini()
Expand Down Expand Up @@ -387,9 +392,6 @@ func main() {

defer func() {
if err := recover(); err != nil {
if screen.Screen != nil {
screen.Screen.Fini()
}
if e, ok := err.(*lua.ApiError); ok {
fmt.Println("Lua API error:", e)
} else {
Expand Down
3 changes: 2 additions & 1 deletion runtime/help/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ that micro defines:
* `postinit()`: initialization function called after the `init()` function of
all plugins has been called.

* `deinit()`: cleanup function called when your plugin is unloaded or reloaded.
* `deinit()`: cleanup function called when your plugin is unloaded, reloaded or
micro exited.

* `onBufferOpen(buf)`: runs when a buffer is opened. The input contains
the buffer object.
Expand Down