docs: mark #360 not actionable, add pick-window recipe
This commit is contained in:
parent
499bae1975
commit
9ce933e31b
2 changed files with 28 additions and 5 deletions
23
doc/oil.txt
23
doc/oil.txt
|
|
@ -1468,6 +1468,29 @@ buffers on |BufRead|: >lua
|
|||
})
|
||||
<
|
||||
|
||||
Open file in a picked window ~
|
||||
*oil-recipe-pick-window*
|
||||
|
||||
Open the entry under the cursor in a window chosen via
|
||||
https://github.com/s1n7ax/nvim-window-picker. Add to `after/ftplugin/oil.lua`: >lua
|
||||
vim.keymap.set("n", "<C-w>", function()
|
||||
local oil = require("oil")
|
||||
local entry = oil.get_cursor_entry()
|
||||
if not entry or entry.type ~= "file" then
|
||||
return
|
||||
end
|
||||
local dir = oil.get_current_dir()
|
||||
oil.close({ exit_if_last_buf = false })
|
||||
local win = require("window-picker").pick_window({
|
||||
filter_rules = { autoselect_one = true, include_current_win = true },
|
||||
})
|
||||
if win then
|
||||
vim.api.nvim_set_current_win(win)
|
||||
vim.cmd.edit(vim.fs.joinpath(dir, entry.name))
|
||||
end
|
||||
end, { buffer = true, desc = "Open file in picked window" })
|
||||
<
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
EVENTS *oil-events*
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue