feat(view): Floating nvim tree window #1377 (#1462)

* Simple mock-up of floating nvim-tree window

* Passing whole table to nvim_open_win()

* Run update-help.sh

* Use vim.api alias

* Add comment to float options

* Added `anchor` to float options

* Enabling float window enforces `actions.open_file.quit_on_open`

* Added documentation

* add view.float.open_win_config, skipping validation

* Made nvim-tree window closes when float is enabled

* Close nvim-tree window when out of focus

* Update help

Co-authored-by: Krzysztof Cieśla <krzysztof.marcin.ciesla@cern.ch>
Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
Krzysztof Cieśla
2022-08-06 07:40:07 +02:00
committed by GitHub
parent 1685484738
commit 7323c81bd6
4 changed files with 78 additions and 21 deletions

View File

@@ -134,8 +134,12 @@ local function set_window_options_and_buffer()
end
local function open_window()
a.nvim_command "vsp"
M.reposition_window()
if M.View.float.enable then
a.nvim_open_win(0, true, M.View.float.open_win_config)
else
a.nvim_command "vsp"
M.reposition_window()
end
setup_tabpage(a.nvim_get_current_tabpage())
set_window_options_and_buffer()
end
@@ -431,6 +435,7 @@ function M.setup(opts)
M.View.winopts.number = options.number
M.View.winopts.relativenumber = options.relativenumber
M.View.winopts.signcolumn = options.signcolumn
M.View.float = options.float
M.on_attach = opts.on_attach
end