doc: improve type annotations for oil.open_preview

This commit is contained in:
Steven Arcangeli 2024-11-10 16:06:43 -08:00
parent eb5497f0ac
commit 2f5d4353ee
4 changed files with 25 additions and 19 deletions

View file

@ -14,7 +14,7 @@
- [toggle_float(dir)](#toggle_floatdir)
- [open(dir)](#opendir)
- [close()](#close)
- [open_preview(opts)](#open_previewopts)
- [open_preview(opts, callback)](#open_previewopts-callback)
- [select(opts, callback)](#selectopts-callback)
- [save(opts, cb)](#saveopts-cb)
- [setup(opts)](#setupopts)
@ -125,17 +125,18 @@ Open oil browser for a directory
Restore the buffer that was present when oil was opened
## open_preview(opts)
## open_preview(opts, callback)
`open_preview(opts)` \
`open_preview(opts, callback)` \
Preview the entry under the cursor in a split
| Param | Type | Desc | |
| ----- | ------------ | -------------------------------------------------- | ------------------------------------- |
| opts | `nil\|table` | | |
| | vertical | `boolean` | Open the buffer in a vertical split |
| | horizontal | `boolean` | Open the buffer in a horizontal split |
| | split | `"aboveleft"\|"belowright"\|"topleft"\|"botright"` | Split modifier |
| Param | Type | Desc | |
| -------- | ---------------------------- | ------------------------------------------------------- | ------------------------------------- |
| opts | `nil\|oil.OpenPreviewOpts` | | |
| | vertical | `nil\|boolean` | Open the buffer in a vertical split |
| | horizontal | `nil\|boolean` | Open the buffer in a horizontal split |
| | split | `nil\|"aboveleft"\|"belowright"\|"topleft"\|"botright"` | Split modifier |
| callback | `nil\|fun(err: nil\|string)` | Called once the preview window has been opened | |
## select(opts, callback)

View file

@ -315,15 +315,17 @@ close() *oil.clos
Restore the buffer that was present when oil was opened
open_preview({opts}) *oil.open_preview*
open_preview({opts}, {callback}) *oil.open_preview*
Preview the entry under the cursor in a split
Parameters:
{opts} `nil|table`
{vertical} `boolean` Open the buffer in a vertical split
{horizontal} `boolean` Open the buffer in a horizontal split
{split} `"aboveleft"|"belowright"|"topleft"|"botright"` Split
{opts} `nil|oil.OpenPreviewOpts`
{vertical} `nil|boolean` Open the buffer in a vertical split
{horizontal} `nil|boolean` Open the buffer in a horizontal split
{split} `nil|"aboveleft"|"belowright"|"topleft"|"botright"` Split
modifier
{callback} `nil|fun(err: nil|string)` Called once the preview window has
been opened
select({opts}, {callback}) *oil.select*
Select the entry under the cursor