Remove setup function

This commit is contained in:
Dheepak Krishnamurthy
2020-04-10 14:35:37 -06:00
parent 9b80b417cb
commit de00c93429
2 changed files with 3 additions and 17 deletions

View File

@@ -3,11 +3,6 @@ local fn = vim.fn
local file_buffer = nil
local OPTIONS = {
lazygit_floating_window_scaling_factor = 0.9,
lazygit_floating_window_winblend = 0,
}
local function execute(cmd, ...)
cmd = cmd:format(...)
vim.cmd(cmd)
@@ -32,8 +27,8 @@ end
local function open_floating_window()
local height = math.ceil(vim.o.lines * OPTIONS.lazygit_floating_window_scaling_factor) - 1
local width = math.ceil(vim.o.columns * OPTIONS.lazygit_floating_window_scaling_factor)
local height = math.ceil(vim.o.lines * vim.g.lazygit_floating_window_scaling_factor[false]) - 1
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 col = math.ceil(vim.o.columns - width) / 2
@@ -81,7 +76,7 @@ local function open_floating_window()
vim.bo[file_buffer].filetype = 'lazygit'
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
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)
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 os = fn.substitute(fn.system('uname'), '\n', '', '')
local config_file = ""

View File

@@ -15,8 +15,6 @@ if !exists('g:lazygit_floating_window_scaling_factor')
let g:lazygit_floating_window_scaling_factor = 0.9
endif
lua require 'lazygit'.setup()
command! LazyGit lua require'lazygit'.lazygit()
command! LazyGitConfig lua require'lazygit'.lazygitconfig()