Commit Graph

204 Commits

Author SHA1 Message Date
HyBer
8797c0df3f fix(window): set correct window size for lazygit to render (#158)
since `open_floating_window` use async way `vim.defer_fn` to create
window, `lazygit` executed with a sync way of `vim.fn.jobstart` in
`exec_lazygit_command`, it can't get the floating window size at the
banging

before:


https://github.com/user-attachments/assets/771b4099-c398-42b4-a80f-367f2d1305e7



after:


https://github.com/user-attachments/assets/12cb7381-625c-49c3-bf61-0e385ce79c76
2025-07-22 07:16:27 -04:00
HyBer
541bc0d46e fix(window): custom border not work (#157)
use `vim.opt.winborder' as float window border

with `vim.opt.winborder = 'rounded'`

before:
<img width="3780" height="2112" alt="CleanShot 2025-07-22 at 13 48
04@2x"
src="https://github.com/user-attachments/assets/92fceab3-6f8b-4698-a887-1c7d8722a781"
/>

after:
<img width="3768" height="2102" alt="CleanShot 2025-07-22 at 13 47
19@2x"
src="https://github.com/user-attachments/assets/efbc5537-63fe-4a59-aebb-f603ffb1dc00"
/>
2025-07-22 07:15:19 -04:00
Anthony
b4229a094b fix: plenary usage crash (#156)
Fixes bug created in the [commit
ac4a400](ac4a400b25)
**Prevent crash when using plenary.window.float for floating window**

This MR fixes a bug caused by inconsistent return values from
get_window_pos() when vim.g.lazygit_floating_window_use_plenary is
enabled.

**Problem**
When plenary.window.float is used, get_window_pos() returned (win_id,
bufnr) instead of the expected (width, height, row, col). This led to a
runtime error:
E5108: Error executing lua ...window.lua:33: attempt to perform
arithmetic on local 'row' (a nil value)

**Solution**
Ensure that get_window_pos() always returns consistent values and
explicitly handle the Plenary case in open_floating_window().

This prevents arithmetic operations on nil values and restores
compatibility with the Plenary-based layout logic.

**Tested**
- Works correctly with and without
vim.g.lazygit_floating_window_use_plenary set.
- No runtime errors on window resize or open.
- Borders and buffer correctly positioned in both modes.

Co-authored-by: abezlyudniy <abezlyudniy@ozon.ru>
2025-07-21 07:27:19 -04:00
Chen Asraf
ac4a400b25 feat: resize window on nvim resize (#117)
Fixes #116 


https://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>
2025-07-19 10:24:06 -04:00
Mr. Pine
0a5fdb99ce fix: Command injection and errors when repo name contains spaces (#153)
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>
2025-07-19 10:06:52 -04:00
Dheepak Krishnamurthy
ab3de030df fix: Support both table or string 2025-07-19 10:04:54 -04:00
luca-sartore-prorob
0cb05f46bf fix: update deprecated vim api usage (#155)
replace `termopen` (deprecated according to [the
docs](https://neovim.io/doc/user/deprecated.html#deprecated-0.11)) with `jobstart`
2025-07-19 10:01:11 -04:00
Carlos Calla Alarcón
4839ab6429 update deprecated vim api usage (#152)
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.
2025-06-13 09:54:25 -04:00
Teddy Waweru
b9eae3bada fix: signcolumn overlaps left borders (#132)
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.
2025-02-17 13:36:36 -05:00
Rich
0a3a4c5e52 feat: Allow current buffer commits to show on the already worked out Git root (#148)
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.
2025-02-17 13:34:07 -05:00
Dheepak Krishnamurthy
adc37c5a6d feat: Add lazygitlog 2025-02-03 12:27:04 -05:00
luca-sartore-prorob
77a0d42943 fix: explicitly use cmd on windows to avoid problem using powershell (#145)
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.
2024-12-12 08:06:41 -05:00
luca-sartore-prorob
02a7a2789f feat: Add option for user's on exit callback (#144)
## 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
2024-12-06 14:14:54 -05:00
Diego Vélez
cc07dc1599 feat: use git-dir and work-tree from environment (#142)
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.
2024-12-04 11:44:05 -05:00
Mainak Mandal
56760339a8 docs: Update Lazy install instructions (#129) 2024-10-01 07:45:16 -04:00
Hassan El-Mehalawi
bd36b40814 fix: use quotes to allow filtering on files with spaces in path (#141)
:LazyGitFilterCurrentFile currently breaks if the path of the file
contains a space. Fixed by wrapping the path in quotes.
2024-10-01 07:36:39 -04:00
Dheepak Krishnamurthy
2432b44748 Update README.md 2024-08-10 05:30:17 -04:00
akan
dc56df433b Get the path of current file relative to the git root 2024-07-08 18:59:56 -04:00
Avery Lewis
ad3e1ea592 Update README.md 2024-05-12 20:28:01 -04:00
Jacob Scott
0ada6c6e7e Update README.md
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.
2024-03-23 22:13:09 -04:00
Rocco Goßmann
774dcecbd0 Updated install lazy.nvim section in README.md
When using lazy.nvim, the Plugin should only load now, if one of its functions is called.
2024-02-29 22:50:17 -05:00
pythoner6
10a5f30536 fix: only set custom config file settings if not set already 2024-02-22 07:09:38 -05:00
Ethan Warrick
1e08e3f5ac feat: Use winblend config for plenary window
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.
2023-12-15 00:18:17 -05:00
Srivatsan Ramaswamy
de35012036 feat: Add support for multiple lazygit config files
Lazygit supports using multiple config files: https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md?plain=1#L346

This commit adds code to parse vim.g.lazygit_config_file_path as a `string | table`,
then passes the files to `lazygit` via the `-ucf` flag
2023-09-26 00:30:26 -04:00
Roger Kim
75c920883f fix: Cover missing edge case in resetting user's preferred shell 2023-09-05 18:46:07 -04:00
Dheepak Krishnamurthy
18060f9841 Merge pull request #103 from gmerzu/fix2
fix: open_floating_window should return lazygit buffer instead of border_window
2023-09-02 16:01:31 -04:00
Dheepak Krishnamurthy
22e51e0326 Merge pull request #102 from gmerzu/fix1
fix: plenary.percentage_range_window returns 'win_id' and 'bufnr'
2023-08-07 00:07:02 -04:00
Anton Kozhemyachenko
a9382f03c7 fix: open_floating_window should return lazygit buffer instead of border_window 2023-08-03 21:29:54 +03:00
Anton Kozhemyachenko
3d7878cad9 fix: plenary.percentage_range_window returns 'win_id' and 'bufnr' 2023-08-03 18:58:37 +03:00
Dheepak Krishnamurthy
1578fa3db0 Merge pull request #99 from frantisekstanko/main
docs: Fix lua example
2023-07-21 14:10:44 -04:00
Frantisek Stanko
b5ff804b44 docs: Fix lua example
Lists in lua are specified with curly brackets, not square brackets.
2023-07-21 20:08:02 +02:00
Dheepak Krishnamurthy
146c6294bf Merge pull request #97 from TashreeqPeck/main
fix: store win and buffer for :LazyGitFilter command
2023-07-15 08:25:23 -04:00
Tashreeq Peck
b4a4c6d26b fix: store win and buffer for :LazyGitFilter command 2023-07-15 17:39:21 +08:00
Dheepak Krishnamurthy
3466e48439 Create FUNDING.yml 2023-06-03 19:14:06 -04:00
Dheepak Krishnamurthy
883c25d13e Merge pull request #90 from yorik1984/main
Add highlighting groups and udpate border chars
2023-05-20 17:33:07 -04:00
Dheepak Krishnamurthy
e1f4ee5697 docs: Update README.md 📚 2023-05-20 17:31:43 -04:00
Dheepak Krishnamurthy
e90f0ee657 feat: Change option to lazygit_floating_window_border_chars 2023-05-20 17:30:30 -04:00
Dheepak Krishnamurthy
41c617f2da feat: Add deprecation message for old option 2023-05-20 17:27:59 -04:00
Dheepak Krishnamurthy
64455f601b Merge pull request #85 from lawrence-laz/lawrence-laz-readme-nvim-listen-server
Update README.md with nvim --listen and --server
2023-05-20 17:15:18 -04:00
yorik1984
096bef1ec6 change border chars 2023-01-11 02:04:50 +02:00
yorik1984
9c4dc0b3c4 add install by lazy and info about highlighting 2023-01-11 01:54:10 +02:00
yorik1984
6f5174ff60 Add LazyGit highlighting groups and new border
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.
2023-01-11 01:17:54 +02:00
Laurynas Lazauskas
3a807afedd Update README.md with nvim --listen and --server
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.
2022-11-09 00:08:18 +02:00
Dheepak Krishnamurthy
32bffdebe2 Merge pull request #83 from aabccd021/main
fix: Fix broken background color on NVIM v0.8.0
2022-11-05 07:24:38 -04:00
aabccd021
3d3ad785d1 fix: Fix broken background color on NVIM v0.8.0 2022-11-05 17:04:52 +07:00
Dheepak Krishnamurthy
56045b4a0d feat: change custom config file logic 2022-11-02 08:34:49 -04:00
Dheepak Krishnamurthy
2fd5b526e2 fix: escape spacing 🐛 2022-11-02 08:30:43 -04:00
Dheepak Krishnamurthy
e2b1e4c231 fix: Change default lazygit config directory 🐛 2022-11-02 08:27:28 -04:00
Dheepak Krishnamurthy
cd3f79f4ce Merge pull request #81 from cleong14/patch-1
fix(lazygit.lua): escape 'space' in filepath
2022-11-02 07:55:48 -04:00
Chaz
914816035f fix(lazygit.lua): escape 'space' in filepath 2022-11-02 00:18:07 -10:00