From 636989b603fb95032efa9d3e1b3323c8bb533e91 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Thu, 30 Nov 2023 23:54:51 -0800 Subject: [PATCH] fix: oil.select respects splitbelow and splitright (#233) --- lua/oil/init.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lua/oil/init.lua b/lua/oil/init.lua index 72e87fc..e13729b 100644 --- a/lua/oil/init.lua +++ b/lua/oil/init.lua @@ -431,12 +431,16 @@ M.select = function(opts, callback) callback(err) end end - if opts.horizontal or opts.vertical or opts.preview then - opts.split = opts.split or "belowright" - end if opts.preview and not opts.horizontal and opts.vertical == nil then opts.vertical = true end + if not opts.split and (opts.horizontal or opts.vertical or opts.preview) then + if opts.horizontal then + opts.split = vim.o.splitbelow and "belowright" or "aboveleft" + else + opts.split = vim.o.splitright and "belowright" or "aboveleft" + end + end if opts.tab and (opts.preview or opts.split) then return finish("Cannot set preview or split when tab = true") end