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