feat: support preview from floating window (#403)

* implement floating window

* reset width on closing window

* use gap from new config parameter

* use minimal style for preview in floating

* lower z-index

* add configuration of preview position in floating window

* fix in verions earlier than nvim 0.10

* close preview on opening floating window

Close the any existing preview because otherwise strange errors happen when the preview is open and the floating window is opened at the same time.

* reset formatting changes

* remove empty line

* change z-index of preview window to floating window z-index

* add configurations to oil.txt

* formatting

* add auto configuration

* update oil doc

* refactor: move logic into layout.lua and eliminate flicker

* fix: floating preview window title is file name

* doc: clarify default_file_explorer

* refactor: don't need a preview_gap option

* refactor: only find preview win in current tabpage

---------

Co-authored-by: Steven Arcangeli <stevearc@stevearc.com>
This commit is contained in:
Philipp Oeschger 2024-06-20 03:23:30 +02:00 committed by GitHub
parent 0883b109a7
commit 59b3dab6f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 162 additions and 47 deletions

View file

@ -2,7 +2,7 @@
local default_config = {
-- Oil will take over directory buffers (e.g. `vim .` or `:e src/`)
-- Set to false if you still want to use netrw.
-- Set to false if you want some other plugin (e.g. netrw) to open when you edit directories.
default_file_explorer = true,
-- Id is automatically added at the beginning, and name at the end
-- See :help oil-columns
@ -123,6 +123,8 @@ local default_config = {
win_options = {
winblend = 0,
},
-- preview_split: Split direction: "auto", "left", "right", "above", "below".
preview_split = "auto",
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
override = function(conf)