Open ulyssessouza opened 3 months ago
Having the same issue. Escape should not close the floating window. Only q
should.
Sovled this issue by adding this key binding.
vim.keymap.del("t", "<esc>")
I tried something like this, but it doesn't pass escape down to lazygit
map("t", "<ESC>", function()
local win = vim.api.nvim_get_current_win()
-- Do not close lazygit on escape
if not string.find(vim.api.nvim_buf_get_name(0), "lazygit") then
vim.api.nvim_win_close(win, true)
end
end, { desc = "Terminal Close term in terminal mode" })
does anyone know how to pass the escape key to lazygit in this case?
I ended up doing this FWIW: https://github.com/SimonBrandner/dotfiles/commit/a29de2c408d6157760bbfe815a8b49bcb7f8f230
Thanks for posting the examples. I learned a lot reading them and then writing my own autocommand to prevent the escape key from bringing me out of the terminal mode. I was able to get it, with some help from ai, to send esc to lazygit, allowing me to use esc like i normally would outside of neovim
I'd be open to adding such an autocmd to the floating window terminal buffer in this plugin, enabled by default but with an option to not add the autocmd. Thoughts?
@kdheepak i think that would be helpful for newbies like me that might not know how to go about adding the workaround. thank you 👍
I have the same issue. I use Neovim and Lazygit. Any ideas on how to fix it?
Update: I found the root cause of the problem. In this https://github.com/kdheepak/lazygit.nvim/issues/78#issuecomment-1416894837, I learned that a potential key binding might prevent the Esc key from working as expected. In my case, I had:
vim.api.nvim_set_keymap("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
After removing this binding, all Lazygit bindings started working as expected.
Description
To Reproduce
Here are the steps to reproduce the behavior using MINRC: Ps: Couldn't run with MINRC...
Esc
,lg
to open LazyGit in a floating window/bufferTab
to browse toLocal Branches
Enter
to select a branch to see the commitsEsc
to go back (Cancel)Expected behavior
What is expected to happen: When pressing
Esc
that should make theLocal Branches
section to go back.But what is happening is that the floating window just closes. This avoids me to cherrypick a commit from a branch and paste it to another
Screenshots
Desktop (please complete the following information):