From 6309eb628ddf53f7d19aac6e1d5fa1bf6f71c232 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 28 Jan 2024 16:10:06 +0200 Subject: [.vimrc] Added feats --- .vim/feat/term_scroll.vim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .vim/feat/term_scroll.vim (limited to '.vim/feat/term_scroll.vim') diff --git a/.vim/feat/term_scroll.vim b/.vim/feat/term_scroll.vim new file mode 100644 index 0000000..d01fe4c --- /dev/null +++ b/.vim/feat/term_scroll.vim @@ -0,0 +1,19 @@ +" Scrolling (shows history) in terminal (except in lazygit) +" Scroll up to activate it, and press right mouse button to deactivate it +" Slightly modified version of: https://github.com/vim/vim/issues/2490#issuecomment-393973253 +tmap :call EnterNormalMode() + +function! ExitNormalMode() + unmap + call feedkeys("a") +endfunction + +function! EnterNormalMode() + if @% == '!lazygit' + tunmap + elseif &buftype == 'terminal' && mode('') == 't' + call feedkeys("\N") + call feedkeys("\") + map :call ExitNormalMode() + endif +endfunction -- cgit v1.2.3