Remove setup function
This commit is contained in:
@@ -3,11 +3,6 @@ local fn = vim.fn
|
|||||||
|
|
||||||
local file_buffer = nil
|
local file_buffer = nil
|
||||||
|
|
||||||
local OPTIONS = {
|
|
||||||
lazygit_floating_window_scaling_factor = 0.9,
|
|
||||||
lazygit_floating_window_winblend = 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
local function execute(cmd, ...)
|
local function execute(cmd, ...)
|
||||||
cmd = cmd:format(...)
|
cmd = cmd:format(...)
|
||||||
vim.cmd(cmd)
|
vim.cmd(cmd)
|
||||||
@@ -32,8 +27,8 @@ end
|
|||||||
|
|
||||||
local function open_floating_window()
|
local function open_floating_window()
|
||||||
|
|
||||||
local height = math.ceil(vim.o.lines * OPTIONS.lazygit_floating_window_scaling_factor) - 1
|
local height = math.ceil(vim.o.lines * vim.g.lazygit_floating_window_scaling_factor[false]) - 1
|
||||||
local width = math.ceil(vim.o.columns * OPTIONS.lazygit_floating_window_scaling_factor)
|
local width = math.ceil(vim.o.columns * vim.g.lazygit_floating_window_scaling_factor[false])
|
||||||
|
|
||||||
local row = math.ceil(vim.o.lines - height) / 2
|
local row = math.ceil(vim.o.lines - height) / 2
|
||||||
local col = math.ceil(vim.o.columns - width) / 2
|
local col = math.ceil(vim.o.columns - width) / 2
|
||||||
@@ -81,7 +76,7 @@ local function open_floating_window()
|
|||||||
vim.bo[file_buffer].filetype = 'lazygit'
|
vim.bo[file_buffer].filetype = 'lazygit'
|
||||||
|
|
||||||
vim.cmd('setlocal nocursorcolumn')
|
vim.cmd('setlocal nocursorcolumn')
|
||||||
vim.cmd('set winblend=' .. OPTIONS.lazygit_floating_window_winblend)
|
vim.cmd('set winblend=' .. vim.g.lazygit_floating_window_winblend)
|
||||||
|
|
||||||
-- use autocommand to ensure that the border_buffer closes at the same time as the main buffer
|
-- use autocommand to ensure that the border_buffer closes at the same time as the main buffer
|
||||||
vim.cmd('autocmd WinLeave <buffer> silent! execute "silent bdelete! "' .. file_buffer .. ' ' .. border_buffer)
|
vim.cmd('autocmd WinLeave <buffer> silent! execute "silent bdelete! "' .. file_buffer .. ' ' .. border_buffer)
|
||||||
@@ -106,13 +101,6 @@ local function lazygit()
|
|||||||
exec_lazygit_command(root_dir)
|
exec_lazygit_command(root_dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function setup()
|
|
||||||
OPTIONS.lazygit_floating_window_winblend = api.nvim_get_var("lazygit_floating_window_winblend")
|
|
||||||
-- api.nvim_get_var("lazygit_floating_window_scaling_factor") returns a table, with keys true and false.
|
|
||||||
-- the value in corresponding to the false key appears to be what we want.
|
|
||||||
OPTIONS.lazygit_floating_window_scaling_factor = api.nvim_get_var("lazygit_floating_window_scaling_factor")[false]
|
|
||||||
end
|
|
||||||
|
|
||||||
local function lazygitconfig()
|
local function lazygitconfig()
|
||||||
local os = fn.substitute(fn.system('uname'), '\n', '', '')
|
local os = fn.substitute(fn.system('uname'), '\n', '', '')
|
||||||
local config_file = ""
|
local config_file = ""
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ if !exists('g:lazygit_floating_window_scaling_factor')
|
|||||||
let g:lazygit_floating_window_scaling_factor = 0.9
|
let g:lazygit_floating_window_scaling_factor = 0.9
|
||||||
endif
|
endif
|
||||||
|
|
||||||
lua require 'lazygit'.setup()
|
|
||||||
|
|
||||||
command! LazyGit lua require'lazygit'.lazygit()
|
command! LazyGit lua require'lazygit'.lazygit()
|
||||||
|
|
||||||
command! LazyGitConfig lua require'lazygit'.lazygitconfig()
|
command! LazyGitConfig lua require'lazygit'.lazygitconfig()
|
||||||
|
|||||||
Reference in New Issue
Block a user