fix: oil.select respects splitbelow and splitright (#233)

This commit is contained in:
Steven Arcangeli 2023-11-30 23:54:51 -08:00
parent e89a8f8ade
commit 636989b603

View file

@ -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