Merge branch 'master' into bug/support-fish-shell
This commit is contained in:
@@ -33,7 +33,8 @@ The following are configuration options and their defaults.
|
|||||||
let g:lazygit_floating_window_winblend = 0 " transparency of floating window
|
let g:lazygit_floating_window_winblend = 0 " transparency of floating window
|
||||||
let g:lazygit_floating_window_scaling_factor = 0.9 " scaling factor for floating window
|
let g:lazygit_floating_window_scaling_factor = 0.9 " scaling factor for floating window
|
||||||
let g:lazygit_floating_window_corner_chars = ['╭', '╮', '╰', '╯'] " customize lazygit popup window corner characters
|
let g:lazygit_floating_window_corner_chars = ['╭', '╮', '╰', '╯'] " customize lazygit popup window corner characters
|
||||||
let g:lazygit_use_neovim_remote = 1 " for neovim-remote support
|
let g:lazygit_floating_window_use_plenary = 0 " use plenary.nvim to manage floating window if available
|
||||||
|
let g:lazygit_use_neovim_remote = 1 " fallback to 0 if neovim-remote is not installed
|
||||||
```
|
```
|
||||||
|
|
||||||
Call `:LazyGit` to start a floating window with `lazygit`.
|
Call `:LazyGit` to start a floating window with `lazygit`.
|
||||||
|
|||||||
@@ -18,10 +18,17 @@ end
|
|||||||
|
|
||||||
--- Get project_root_dir for git repository
|
--- Get project_root_dir for git repository
|
||||||
local function project_root_dir()
|
local function project_root_dir()
|
||||||
|
|
||||||
-- always use bash
|
-- always use bash
|
||||||
local oldshell = vim.o.shell
|
local oldshell = vim.o.shell
|
||||||
vim.o.shell = 'bash'
|
vim.o.shell = 'bash'
|
||||||
|
|
||||||
|
-- try submodule first
|
||||||
|
local gitdir = fn.system('cd "' .. fn.expand('%:p:h') .. '" && git rev-parse --show-superproject-working-tree')
|
||||||
|
if gitdir ~= "" then
|
||||||
|
return trim(gitdir)
|
||||||
|
end
|
||||||
|
|
||||||
-- try file location first
|
-- try file location first
|
||||||
local gitdir = fn.system('cd "' .. fn.expand('%:p:h') .. '" && git rev-parse --show-toplevel')
|
local gitdir = fn.system('cd "' .. fn.expand('%:p:h') .. '" && git rev-parse --show-toplevel')
|
||||||
local isgitdir = fn.matchstr(gitdir, '^fatal:.*') == ""
|
local isgitdir = fn.matchstr(gitdir, '^fatal:.*') == ""
|
||||||
@@ -74,6 +81,12 @@ local function open_floating_window()
|
|||||||
floating_window_scaling_factor = floating_window_scaling_factor[false]
|
floating_window_scaling_factor = floating_window_scaling_factor[false]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local status, plenary = pcall(require, 'plenary.window.float')
|
||||||
|
if status and vim.g.lazygit_floating_window_use_plenary and vim.g.lazygit_floating_window_use_plenary ~= 0 then
|
||||||
|
plenary.percentage_range_window(floating_window_scaling_factor, floating_window_scaling_factor)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local height = math.ceil(vim.o.lines * floating_window_scaling_factor) - 1
|
local height = math.ceil(vim.o.lines * floating_window_scaling_factor) - 1
|
||||||
local width = math.ceil(vim.o.columns * floating_window_scaling_factor)
|
local width = math.ceil(vim.o.columns * floating_window_scaling_factor)
|
||||||
|
|
||||||
@@ -154,7 +167,13 @@ local function lazygit(path)
|
|||||||
path = project_root_dir()
|
path = project_root_dir()
|
||||||
end
|
end
|
||||||
open_floating_window()
|
open_floating_window()
|
||||||
local cmd = "lazygit " .. "-p " .. path
|
local cmd = "lazygit"
|
||||||
|
if not vim.env.GIT_DIR then
|
||||||
|
cmd = cmd .. " -g \"" .. path .. "/.git/\""
|
||||||
|
end
|
||||||
|
if not vim.env.GIT_WORK_TREE then
|
||||||
|
cmd = cmd .. " -w \"" .. path .. "\""
|
||||||
|
end
|
||||||
exec_lazygit_command(cmd)
|
exec_lazygit_command(cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ if !exists('g:lazygit_floating_window_scaling_factor')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists('g:lazygit_use_neovim_remote')
|
if !exists('g:lazygit_use_neovim_remote')
|
||||||
let g:lazygit_use_neovim_remote = 1
|
let g:lazygit_use_neovim_remote = executable('nvr') ? 1 : 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists('g:lazygit_floating_window_corner_chars')
|
if !exists('g:lazygit_floating_window_corner_chars')
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ endif
|
|||||||
|
|
||||||
call plug#begin('~/.local/share/nvim/plugged')
|
call plug#begin('~/.local/share/nvim/plugged')
|
||||||
|
|
||||||
Plug '~/gitrepos/lazygit.vim'
|
Plug '~/gitrepos/lazygit.nvim'
|
||||||
|
|
||||||
" Initialize plugin system
|
" Initialize plugin system
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|||||||
Reference in New Issue
Block a user