Open paulhmurray opened 2 years ago
I'm not sure if my issue is related or not, but I can't exit out of LazyGit anymore. Whether I hit q
, <Esc>
, or Ctrl+C
, it just gives a blank screen and I have to :q
to exit.
I do see an error at the bottom that says:
^I...uyz/git/+huyz/dot-vim/plugged/lazygit.nvim/lua/lazygit.lua:28: in function <...uyz/git/+huyz/dot-vim/plugged/lazygit.nvim/lua/lazygit.lua:17>
It seems there's some sort of exception at https://github.com/kdheepak/lazygit.nvim/blob/c7a8bfb6062e57f3f7cc735720893f2706e6fc8e/lua/lazygit.lua#L29
@paulhmurray do you see the same error?
can't reproduce on my side, maybe clashes with some configuration or mapping from other plugin !?
I was able to resolve the error. I use a TermClose
autocmd
, as suggested in the neovim docs, but that sample code interferes with lazygit's exit.
This works though:
" NOTE: added lazygit check to avoid lua error
" NOTE: added "silent!" to avoid error when FZF terminal window is closed.
autocmd TermClose * if &filetype != 'lazygit' && !v:event.status | silent! exe 'bdelete! '..expand('<abuf>') | endif
I was able to reproduce the bug with ToggleTerm installed. Like @thefux said, it might be a conflict somewhere in the configs.
See if you have the following keymap set somewhere (i.e. your toggleterm setup file). Either remove it or rebind it to something else.
vim.keymap.set("t", "<esc>", [[<C-\><C-n>]], opts)
from: https://github.com/akinsho/toggleterm.nvim#terminal-window-mappings
The bug is still not fixed?
Are you able to reproduce this bug with a minimal neovim setup? For example with a file like this:
I don't believe this is a bug in lazygit.nvim per say, just a configuration collision. In neovim's terminal mode, hitting esc
may or may not change the terminal mode to normal mode, depending on your configuration. See comments above for the conflicting configuration.
I don't have any other Terminal Plugin like toggleTerm. But with following keymapping the plugin is not usable. After disabling this mapping it works
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
also mapping like this is causing problems. So rebinding it does not help.
vim.keymap.set("t", "jj", "<C-\\><C-n>", { desc = "Exit terminal mode" })
Is there a way to enable these mappings for non lazygit terminals or disable them for lazygit terminal windows?
When lazygit.nvim opens a terminal it sets the buffer name to lazygit. You can use an autocmd to check for the buffer name on BufOpen and set whatever bindings you want conditionally.
Describe the bug Loading LazyGit with NeoVim plugin there is conflict when using Esc and then trying to exit LazyGit with 'q' command for quit
To Reproduce Steps to reproduce the behavior:
Load LazyGit Press Esc Then try and leave LazyGit by pressing 'q' for quit won't work Only way to exit is to use Vim's ":q" Expected behavior That exiting the floating LazyGit screen will work regardless of pressing the 'esc' button
Screenshots Not much need for a screenshot, as the floating LazyGit window just hangs until I select ":q" for vim exit
Version info: LazyGit Version 0.34 Git version 2.34.1