Use global window
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
local api = vim.api
|
||||
local fn = vim.fn
|
||||
|
||||
local window
|
||||
|
||||
local OPTIONS = {
|
||||
lazygit_floating_window_scaling_factor = 0.9,
|
||||
lazygit_floating_window_winblend = 0,
|
||||
@@ -15,7 +17,6 @@ local function is_lazygit_available()
|
||||
end
|
||||
|
||||
function open_floating_window()
|
||||
|
||||
-- create a unlisted scratch buffer
|
||||
local buffer = api.nvim_create_buf(false, true)
|
||||
-- create a unlisted scratch buffer for the border
|
||||
@@ -62,13 +63,12 @@ function open_floating_window()
|
||||
|
||||
local border_window = api.nvim_open_win(border_buffer, true, border_opts)
|
||||
api.nvim_command('set winhl=Normal:Floating')
|
||||
local window = api.nvim_open_win(buffer, true, opts)
|
||||
window = api.nvim_open_win(buffer, true, opts)
|
||||
|
||||
api.nvim_command('set winblend=' .. OPTIONS.lazygit_floating_window_winblend)
|
||||
|
||||
-- use autocommand to ensure that the border_buffer closes at the same time as the main buffer
|
||||
api.nvim_command('au BufWipeout <buffer> execute "silent bwipeout!"' .. border_buffer)
|
||||
return window
|
||||
end
|
||||
|
||||
local function project_root_dir()
|
||||
@@ -104,7 +104,7 @@ function lazygit()
|
||||
print("Please install lazygit. Check documentation for more information")
|
||||
return
|
||||
end
|
||||
local window = open_floating_window()
|
||||
open_floating_window()
|
||||
exec_lazygit_command()
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user