doc: improve type annotations for oil.open_preview
This commit is contained in:
parent
eb5497f0ac
commit
2f5d4353ee
4 changed files with 25 additions and 19 deletions
|
|
@ -360,7 +360,7 @@ Note that at the moment the ssh adapter does not support Windows machines, and i
|
||||||
- [toggle_float(dir)](doc/api.md#toggle_floatdir)
|
- [toggle_float(dir)](doc/api.md#toggle_floatdir)
|
||||||
- [open(dir)](doc/api.md#opendir)
|
- [open(dir)](doc/api.md#opendir)
|
||||||
- [close()](doc/api.md#close)
|
- [close()](doc/api.md#close)
|
||||||
- [open_preview(opts)](doc/api.md#open_previewopts)
|
- [open_preview(opts, callback)](doc/api.md#open_previewopts-callback)
|
||||||
- [select(opts, callback)](doc/api.md#selectopts-callback)
|
- [select(opts, callback)](doc/api.md#selectopts-callback)
|
||||||
- [save(opts, cb)](doc/api.md#saveopts-cb)
|
- [save(opts, cb)](doc/api.md#saveopts-cb)
|
||||||
- [setup(opts)](doc/api.md#setupopts)
|
- [setup(opts)](doc/api.md#setupopts)
|
||||||
|
|
|
||||||
17
doc/api.md
17
doc/api.md
|
|
@ -14,7 +14,7 @@
|
||||||
- [toggle_float(dir)](#toggle_floatdir)
|
- [toggle_float(dir)](#toggle_floatdir)
|
||||||
- [open(dir)](#opendir)
|
- [open(dir)](#opendir)
|
||||||
- [close()](#close)
|
- [close()](#close)
|
||||||
- [open_preview(opts)](#open_previewopts)
|
- [open_preview(opts, callback)](#open_previewopts-callback)
|
||||||
- [select(opts, callback)](#selectopts-callback)
|
- [select(opts, callback)](#selectopts-callback)
|
||||||
- [save(opts, cb)](#saveopts-cb)
|
- [save(opts, cb)](#saveopts-cb)
|
||||||
- [setup(opts)](#setupopts)
|
- [setup(opts)](#setupopts)
|
||||||
|
|
@ -125,17 +125,18 @@ Open oil browser for a directory
|
||||||
Restore the buffer that was present when oil was opened
|
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
|
Preview the entry under the cursor in a split
|
||||||
|
|
||||||
| Param | Type | Desc | |
|
| Param | Type | Desc | |
|
||||||
| ----- | ------------ | -------------------------------------------------- | ------------------------------------- |
|
| -------- | ---------------------------- | ------------------------------------------------------- | ------------------------------------- |
|
||||||
| opts | `nil\|table` | | |
|
| opts | `nil\|oil.OpenPreviewOpts` | | |
|
||||||
| | vertical | `boolean` | Open the buffer in a vertical split |
|
| | vertical | `nil\|boolean` | Open the buffer in a vertical split |
|
||||||
| | horizontal | `boolean` | Open the buffer in a horizontal split |
|
| | horizontal | `nil\|boolean` | Open the buffer in a horizontal split |
|
||||||
| | split | `"aboveleft"\|"belowright"\|"topleft"\|"botright"` | Split modifier |
|
| | 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)
|
## select(opts, callback)
|
||||||
|
|
||||||
|
|
|
||||||
12
doc/oil.txt
12
doc/oil.txt
|
|
@ -315,15 +315,17 @@ close() *oil.clos
|
||||||
Restore the buffer that was present when oil was opened
|
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
|
Preview the entry under the cursor in a split
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
{opts} `nil|table`
|
{opts} `nil|oil.OpenPreviewOpts`
|
||||||
{vertical} `boolean` Open the buffer in a vertical split
|
{vertical} `nil|boolean` Open the buffer in a vertical split
|
||||||
{horizontal} `boolean` Open the buffer in a horizontal split
|
{horizontal} `nil|boolean` Open the buffer in a horizontal split
|
||||||
{split} `"aboveleft"|"belowright"|"topleft"|"botright"` Split
|
{split} `nil|"aboveleft"|"belowright"|"topleft"|"botright"` Split
|
||||||
modifier
|
modifier
|
||||||
|
{callback} `nil|fun(err: nil|string)` Called once the preview window has
|
||||||
|
been opened
|
||||||
|
|
||||||
select({opts}, {callback}) *oil.select*
|
select({opts}, {callback}) *oil.select*
|
||||||
Select the entry under the cursor
|
Select the entry under the cursor
|
||||||
|
|
|
||||||
|
|
@ -410,11 +410,14 @@ M.close = function()
|
||||||
vim.api.nvim_buf_delete(oilbuf, { force = true })
|
vim.api.nvim_buf_delete(oilbuf, { force = true })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@class oil.OpenPreviewOpts
|
||||||
|
---@field vertical? boolean Open the buffer in a vertical split
|
||||||
|
---@field horizontal? boolean Open the buffer in a horizontal split
|
||||||
|
---@field split? "aboveleft"|"belowright"|"topleft"|"botright" Split modifier
|
||||||
|
|
||||||
---Preview the entry under the cursor in a split
|
---Preview the entry under the cursor in a split
|
||||||
---@param opts nil|table
|
---@param opts? oil.OpenPreviewOpts
|
||||||
--- vertical boolean Open the buffer in a vertical split
|
---@param callback? fun(err: nil|string) Called once the preview window has been opened
|
||||||
--- horizontal boolean Open the buffer in a horizontal split
|
|
||||||
--- split "aboveleft"|"belowright"|"topleft"|"botright" Split modifier
|
|
||||||
M.open_preview = function(opts, callback)
|
M.open_preview = function(opts, callback)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
local config = require("oil.config")
|
local config = require("oil.config")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue