From cca1631d5ea450c09ba72f3951a9e28105a3632c Mon Sep 17 00:00:00 2001 From: Yu Guo Date: Sat, 26 Oct 2024 01:08:39 +0900 Subject: [PATCH] fix: actions.preview accepts options (#497) * fix: pass opts to actions.preview * add opts type to action.preview * run generate.py script --- doc/oil.txt | 6 ++++++ lua/oil/actions.lua | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/oil.txt b/doc/oil.txt index 8e96cf4..70c589d 100644 --- a/doc/oil.txt +++ b/doc/oil.txt @@ -527,6 +527,12 @@ preview *actions.previe Open the entry under the cursor in a preview window, or close the preview window if already open + Parameters: + {horizontal} `boolean` Open the buffer in a horizontal split + {split} `"aboveleft"|"belowright"|"topleft"|"botright"` Split + modifier + {vertical} `boolean` Open the buffer in a vertical split + preview_scroll_down *actions.preview_scroll_down* Scroll down in the preview window diff --git a/lua/oil/actions.lua b/lua/oil/actions.lua index 6a2a5ff..b097e68 100644 --- a/lua/oil/actions.lua +++ b/lua/oil/actions.lua @@ -69,7 +69,21 @@ M.select_tab = { M.preview = { desc = "Open the entry under the cursor in a preview window, or close the preview window if already open", - callback = function() + parameters = { + vertical = { + type = "boolean", + desc = "Open the buffer in a vertical split", + }, + horizontal = { + type = "boolean", + desc = "Open the buffer in a horizontal split", + }, + split = { + type = '"aboveleft"|"belowright"|"topleft"|"botright"', + desc = "Split modifier", + }, + }, + callback = function(opts) local entry = oil.get_cursor_entry() if not entry then vim.notify("Could not find entry under cursor", vim.log.levels.ERROR) @@ -88,7 +102,7 @@ M.preview = { return end end - oil.open_preview() + oil.open_preview(opts) end, }