Skip to content

Commit

Permalink
added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias314 committed Dec 23, 2024
1 parent ca0ff7a commit 72e178c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/help/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ The following plugins come pre-installed with micro:
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 autoclose`, `> help linter`, `> help comment`, and `> help status`
for additional documentation specific to those plugins.

These are good examples for many use-cases if you are looking to write
your own plugins.
Expand Down
1 change: 1 addition & 0 deletions runtime/plugins/autoclose/autoclose.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local utf8 = import("utf8")

config.RegisterCommonOption("autoclose", "pairs", {"\"\"", "''", "``", "()", "{}", "[]"})
config.RegisterCommonOption("autoclose", "newlinePairs", {"()", "{}", "[]"})
config.AddRuntimeFile("autoclose", config.RTHelp, "help/autoclose.md")

function charAt(str, i)
-- lua indexing is one off from go
Expand Down
13 changes: 13 additions & 0 deletions runtime/plugins/autoclose/help/autoclose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Autoclose

The autoclose plugin automatically closes brackets, quotes and the like,
and it can add indentation between such symbols. The plugin can be configured
on a per-buffer basis via the following options:

- `autoclose.pairs`: When the first rune in a pair is entered, autoclose will
add the second automatically. Moreover, when the first rune is deleted while
the cursor is on the second, then this second rune is also deleted.
The default value is ```{"\"\"", "''", "``", "()", "{}", "[]"}```.
- `autoclose.newlinePairs`: When `Enter` is pressed between such a pair,
autoclose will put the closing rune on a separate line and add indentation.
The default value is `{"()", "{}", "[]"}`.

0 comments on commit 72e178c

Please sign in to comment.