Skip to content

Commit cca1631

Browse files
authored
fix: actions.preview accepts options (#497)
* fix: pass opts to actions.preview * add opts type to action.preview * run generate.py script
1 parent 28aca0c commit cca1631

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

doc/oil.txt

+6
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,12 @@ preview *actions.previe
527527
Open the entry under the cursor in a preview window, or close the preview
528528
window if already open
529529

530+
Parameters:
531+
{horizontal} `boolean` Open the buffer in a horizontal split
532+
{split} `"aboveleft"|"belowright"|"topleft"|"botright"` Split
533+
modifier
534+
{vertical} `boolean` Open the buffer in a vertical split
535+
530536
preview_scroll_down *actions.preview_scroll_down*
531537
Scroll down in the preview window
532538

lua/oil/actions.lua

+16-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,21 @@ M.select_tab = {
6969

7070
M.preview = {
7171
desc = "Open the entry under the cursor in a preview window, or close the preview window if already open",
72-
callback = function()
72+
parameters = {
73+
vertical = {
74+
type = "boolean",
75+
desc = "Open the buffer in a vertical split",
76+
},
77+
horizontal = {
78+
type = "boolean",
79+
desc = "Open the buffer in a horizontal split",
80+
},
81+
split = {
82+
type = '"aboveleft"|"belowright"|"topleft"|"botright"',
83+
desc = "Split modifier",
84+
},
85+
},
86+
callback = function(opts)
7387
local entry = oil.get_cursor_entry()
7488
if not entry then
7589
vim.notify("Could not find entry under cursor", vim.log.levels.ERROR)
@@ -88,7 +102,7 @@ M.preview = {
88102
return
89103
end
90104
end
91-
oil.open_preview()
105+
oil.open_preview(opts)
92106
end,
93107
}
94108

0 commit comments

Comments
 (0)