Add option to set winblend
This commit is contained in:
@@ -27,7 +27,10 @@ Plugin 'kdheepak/lazygit.vim'
|
||||
### Usage
|
||||
|
||||
```vim
|
||||
" lazygit
|
||||
|
||||
let g:lazygit_floating_window_winblend = 5 " transparency of floating window
|
||||
|
||||
" setup mapping to call :LazyGit
|
||||
nnoremap <silent> <leader>lg :LazyGit<CR>
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
local api = vim.api
|
||||
local fn = vim.fn
|
||||
|
||||
local OPTIONS = {}
|
||||
|
||||
local function echom(message)
|
||||
api.nvim_command('echom "' .. tostring(message) .. '"')
|
||||
end
|
||||
@@ -16,7 +18,7 @@ function open_floating_window()
|
||||
-- create a unlisted scratch buffer for the border
|
||||
local border_buffer = api.nvim_create_buf(false, true)
|
||||
|
||||
api.nvim_buf_set_option(buffer, 'bufhidden', 'hide')
|
||||
api.nvim_buf_set_option(buffer, 'bufhidden', 'wipe')
|
||||
api.nvim_buf_set_option(buffer, 'filetype', 'lazygit')
|
||||
|
||||
local columns = api.nvim_get_option("columns")
|
||||
@@ -58,10 +60,11 @@ 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)
|
||||
api.nvim_command('set winhl=Normal:Floating')
|
||||
|
||||
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)
|
||||
api.nvim_command('au BufLeave <buffer> hide')
|
||||
return window
|
||||
end
|
||||
|
||||
@@ -102,6 +105,11 @@ function lazygit()
|
||||
exec_lazygit_command()
|
||||
end
|
||||
|
||||
function setup()
|
||||
OPTIONS.lazygit_floating_window_winblend = api.nvim_get_var("lazygit_floating_window_winblend")
|
||||
end
|
||||
|
||||
return {
|
||||
setup = setup,
|
||||
lazygit = lazygit,
|
||||
}
|
||||
|
||||
@@ -7,6 +7,12 @@ set cpoptions&vim
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
if !exists('g:lazygit_floating_window_winblend')
|
||||
let g:lazygit_floating_window_winblend = 5
|
||||
endif
|
||||
|
||||
lua require 'lazygit'.setup()
|
||||
|
||||
let s:lazygit_lua_loc = expand('<sfile>:h:r') . '/../lua/'
|
||||
|
||||
exe "lua package.path = package.path .. ';". s:lazygit_lua_loc."?/init.lua'"
|
||||
|
||||
Reference in New Issue
Block a user