feat: API to automatically open preview window after opening oil (#339)
This commit is contained in:
parent
52f1683c76
commit
57528bf9c5
6 changed files with 135 additions and 31 deletions
36
doc/api.md
36
doc/api.md
|
|
@ -10,9 +10,9 @@
|
|||
- [set_is_hidden_file(is_hidden_file)](#set_is_hidden_fileis_hidden_file)
|
||||
- [toggle_hidden()](#toggle_hidden)
|
||||
- [get_current_dir(bufnr)](#get_current_dirbufnr)
|
||||
- [open_float(dir)](#open_floatdir)
|
||||
- [open_float(dir, opts, cb)](#open_floatdir-opts-cb)
|
||||
- [toggle_float(dir)](#toggle_floatdir)
|
||||
- [open(dir)](#opendir)
|
||||
- [open(dir, opts, cb)](#opendir-opts-cb)
|
||||
- [close(opts)](#closeopts)
|
||||
- [open_preview(opts, callback)](#open_previewopts-callback)
|
||||
- [select(opts, callback)](#selectopts-callback)
|
||||
|
|
@ -92,14 +92,20 @@ Get the current directory
|
|||
| ----- | -------------- | ---- |
|
||||
| bufnr | `nil\|integer` | |
|
||||
|
||||
## open_float(dir)
|
||||
## open_float(dir, opts, cb)
|
||||
|
||||
`open_float(dir)` \
|
||||
`open_float(dir, opts, cb)` \
|
||||
Open oil browser in a floating window
|
||||
|
||||
| Param | Type | Desc |
|
||||
| ----- | ------------- | ------------------------------------------------------------------------------------------- |
|
||||
| dir | `nil\|string` | When nil, open the parent of the current buffer, or the cwd if current buffer is not a file |
|
||||
| Param | Type | Desc |
|
||||
| ------------ | ------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
||||
| dir | `nil\|string` | When nil, open the parent of the current buffer, or the cwd if current buffer is not a file |
|
||||
| opts | `nil\|oil.OpenOpts` | |
|
||||
| >preview | `nil\|oil.OpenPreviewOpts` | When present, open the preview window after opening oil |
|
||||
| >>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 |
|
||||
| cb | `nil\|fun()` | Called after the oil buffer is ready |
|
||||
|
||||
## toggle_float(dir)
|
||||
|
||||
|
|
@ -110,14 +116,20 @@ Open oil browser in a floating window, or close it if open
|
|||
| ----- | ------------- | ------------------------------------------------------------------------------------------- |
|
||||
| dir | `nil\|string` | When nil, open the parent of the current buffer, or the cwd if current buffer is not a file |
|
||||
|
||||
## open(dir)
|
||||
## open(dir, opts, cb)
|
||||
|
||||
`open(dir)` \
|
||||
`open(dir, opts, cb)` \
|
||||
Open oil browser for a directory
|
||||
|
||||
| Param | Type | Desc |
|
||||
| ----- | ------------- | ------------------------------------------------------------------------------------------- |
|
||||
| dir | `nil\|string` | When nil, open the parent of the current buffer, or the cwd if current buffer is not a file |
|
||||
| Param | Type | Desc |
|
||||
| ------------ | ------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
||||
| dir | `nil\|string` | When nil, open the parent of the current buffer, or the cwd if current buffer is not a file |
|
||||
| opts | `nil\|oil.OpenOpts` | |
|
||||
| >preview | `nil\|oil.OpenPreviewOpts` | When present, open the preview window after opening oil |
|
||||
| >>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 |
|
||||
| cb | `nil\|fun()` | Called after the oil buffer is ready |
|
||||
|
||||
## close(opts)
|
||||
|
||||
|
|
|
|||
28
doc/oil.txt
28
doc/oil.txt
|
|
@ -304,12 +304,20 @@ get_current_dir({bufnr}): nil|string *oil.get_current_di
|
|||
Parameters:
|
||||
{bufnr} `nil|integer`
|
||||
|
||||
open_float({dir}) *oil.open_float*
|
||||
open_float({dir}, {opts}, {cb}) *oil.open_float*
|
||||
Open oil browser in a floating window
|
||||
|
||||
Parameters:
|
||||
{dir} `nil|string` When nil, open the parent of the current buffer, or the
|
||||
cwd if current buffer is not a file
|
||||
{dir} `nil|string` When nil, open the parent of the current buffer, or
|
||||
the cwd if current buffer is not a file
|
||||
{opts} `nil|oil.OpenOpts`
|
||||
{preview} `nil|oil.OpenPreviewOpts` When present, open the preview
|
||||
window after opening oil
|
||||
{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"` S
|
||||
plit modifier
|
||||
{cb} `nil|fun()` Called after the oil buffer is ready
|
||||
|
||||
toggle_float({dir}) *oil.toggle_float*
|
||||
Open oil browser in a floating window, or close it if open
|
||||
|
|
@ -318,12 +326,20 @@ toggle_float({dir}) *oil.toggle_floa
|
|||
{dir} `nil|string` When nil, open the parent of the current buffer, or the
|
||||
cwd if current buffer is not a file
|
||||
|
||||
open({dir}) *oil.open*
|
||||
open({dir}, {opts}, {cb}) *oil.open*
|
||||
Open oil browser for a directory
|
||||
|
||||
Parameters:
|
||||
{dir} `nil|string` When nil, open the parent of the current buffer, or the
|
||||
cwd if current buffer is not a file
|
||||
{dir} `nil|string` When nil, open the parent of the current buffer, or
|
||||
the cwd if current buffer is not a file
|
||||
{opts} `nil|oil.OpenOpts`
|
||||
{preview} `nil|oil.OpenPreviewOpts` When present, open the preview
|
||||
window after opening oil
|
||||
{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"` S
|
||||
plit modifier
|
||||
{cb} `nil|fun()` Called after the oil buffer is ready
|
||||
|
||||
close({opts}) *oil.close*
|
||||
Restore the buffer that was present when oil was opened
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue