while using lazygit inside fterm, esc key will act as quit instead of going to normal mode (#762)

This commit is contained in:
Abouzar Parvan 2021-07-07 22:21:23 +04:30 committed by GitHub
parent 5e2a0df7ef
commit 51c0f48970
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -40,6 +40,17 @@ M.config = function()
end
lazy:toggle()
end
-- Map esc to exit inside lazygit
vim.api.nvim_exec([[
function LazyGitNativation()
echom &filetype
if &filetype ==# 'FTerm'
tnoremap <Esc> q
tnoremap <C-v><Esc> <Esc>
endif
endfunction
]], false)
end
return M

View file

@ -76,6 +76,10 @@ lv_utils.define_augroups {
-- will cause split windows to be resized evenly if main window is resized
{ "VimResized ", "*", "wincmd =" },
},
_fterm_lazygit = {
-- will cause esc key to exit lazy git
{"TermEnter", "*", "call LazyGitNativation()"}
},
-- _mode_switching = {
-- -- will switch between absolute and relative line numbers depending on mode
-- {'InsertEnter', '*', 'if &relativenumber | let g:ms_relativenumberoff = 1 | setlocal number norelativenumber | endif'},