Fixes#116https://github.com/kdheepak/lazygit.nvim/assets/167217/729c203a-c873-45c8-8346-cd7266d9eb2f
The `defer` is a bit of a hack, but otherwise the new size doesn't get
enough time to be properly registered. It still sometimes messes up and
positions itself slightly off sometimes if I try to do it several times
fast, so maybe the delay needs to be adjusted, some debounce added, or
we might want to find a different method for ensuring the window has the
correct size.
Co-authored-by: Chen Asraf <chenasraf@users.noreply.github.com>
Currently, at least `:LazyGitCurrentFile` doesn't handle paths with
spaces correctly as they aren't escaped (if your current path is a valid
shell script, this can also lead to code execution)
This PR changes the lazygit commands from strings to lists to avoid this
problem
Co-authored-by: Dheepak Krishnamurthy <1813121+kdheepak@users.noreply.github.com>
The `vim.loop` prop is deprecated and will be removed at Nvim 1.0. This
PR adds support for the new `vim.uv` prop instead but keeps backward
compatibility with previous versions of Nvim.
signcolumns hide the left borders(for configs that have the signcolumn
opt active. Requires to be set twice(this may be a personal config
scenario). The first sets for the floating window created, the second
for lazygit's UI.
We have already worked out the "git root" for the current buffer, we did
this to work out the relative path. We might as well use this
information when calling `lazygitfilter`.
This now allows `lazygitfiltercurrentfile` to work, whether your actual
cwd is a git repository ('normal' workflow) or a project folder
containing many repositories (another workflow many vim users follow).
It looks like LSP did an autoformat on the file also, I can revert those
two lines if required.
If a user is on windows, and is using powershell as the default nvim
shell the command at [line 69 of
utils.lua](https://github.com/lucaSartore/lazygit.nvim/blob/main/lua/lazygit/utils.lua#L67C2-L67C130)
won’t work due to the `&&` operator.
> local cmd = string.format('cd "%s" && git rev-parse --show-toplevel',
fn.fnamemodify(fn.resolve(fn.expand('%:p')), ':h'), root)
I fixed this by forcing the use of cmd.
## Motivation:
If I close LazyGit after having done some changes (Commit
something/change branch…) I often run into some minor inconsistency with
the UI on screen, that does not get updated to reflect the changes.
In particular the issue I’m having is with the color of the files inside
the [neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim) view. I
understand this is a really insignificant issue, but I still would like
to fix it.
## Proposed solution:
I have added an option that allow an user of the plugin to add a
callback that is automatically executed after exiting LazyGit, so that I
can put there the necessary code to refresh my UI
Passes `work-tree` and `git-dir` arguments for Lazygit.
This is very useful when using a bare git repo, so that Lazygit can still be used to manage the repo.
Add a recommendation to use 'keys' to set the keybinding to load lazygit.nvim if using lazy.nvim. If the keybinding is set elsewhere, e.g. in a config() function, the plugin won't be loaded the first time this is run - the user will have to use `: LazyGit` first.
There is an existing user config for setting the winblend value of the
lazygit floating window. This controls the background transparency of
the window. However, this config option is not respected if the lazygit
window is created using plenary (another user config). This change
forces the plenary window to use the existing config for transparency.
Add `LazyGitBorder` and `LazyGitFloat` highlighting groups using nvim(>=0.7.2) function `vim.api.nvim_set_hl`.
Add full list of window border for useful customize.
The provided instructions help to set up an environment where pressing the key `e` on a file in `lazygit` will edit the file in the same nvim instance.