fix!: selecting multiple files only opens buffers, not windows (#111)

In an oil buffer you can select multiple entries by highlighting them in
visual mode and then calling `oil.select()` (or using a keymap that does
so, like `<CR>` or `<C-s>`. Previously we would automatically assume
that you wanted to open multiple entries as splits. Now, we treat a
default call to `select()` (which is what `<CR>` does) as if you simply
wanted to open the buffers and keep the same window. This plays nicer
with bufferlines. If you want the old behavior, you can explicitly pass
in `oil.select({vertical = true})` or use the `<C-s>` keymap when you
have multiple entries selected.
This commit is contained in:
Steven Arcangeli 2023-06-21 08:53:11 -07:00
parent a465123659
commit 393f0dcf82
2 changed files with 1 additions and 6 deletions

View file

@ -194,7 +194,7 @@ M.open_cmdline = {
}
M.copy_entry_path = {
desc = "Copy the filepath of the entry under the cursor to the + register",
desc = "Yank the filepath of the entry under the cursor to a register",
callback = function()
local entry = oil.get_cursor_entry()
local dir = oil.get_current_dir()

View file

@ -548,11 +548,6 @@ M.select = function(opts)
vim.w.oil_entry_id = entry.id
vim.api.nvim_set_current_win(prev_win)
end
-- Set opts.split so that for every entry after the first, we do a split
opts.split = opts.split or "belowright"
if not opts.horizontal and opts.vertical == nil then
opts.vertical = true
end
end
if