Skip to content

Commit

Permalink
fix: oil.select respects splitbelow and splitright (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Dec 1, 2023
1 parent e89a8f8 commit 636989b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lua/oil/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 636989b

Please sign in to comment.