Summary Files Commits Branches @commit @diff @stats
path: root / vim / .vim / feat / term_scroll.vim
diff options
context:
space:
mode:
Commit72d71324e1063d4d7402180e846aeff3056ba177 (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-11-01 22:20:13 +0200
Committer
 Syndamia <kamen@syndamia.com>
2026-11-01 22:25:29 +0200
Filesabf61c5cce667703c24d29f8798f8379879c39e3 /vim/.vim/feat/term_scroll.vim
.files-72d71324e1063d4d7402180e846aeff3056ba177.tar
.files-72d71324e1063d4d7402180e846aeff3056ba177.tar.gz
.files-72d71324e1063d4d7402180e846aeff3056ba177.zip
Parentc27f36a146d44325e33a24471375c8e8cdf71158 (diff)
feat(vim): Implement vim config
Latest version from https://git.syndamia.com/conf/dotfiles Not edited in 2 years
1 files changed, 19 insertions, 0 deletions
-rw-r--r--vim/.vim/feat/term_scroll.vim19
diff --git a/vim/.vim/feat/term_scroll.vim b/vim/.vim/feat/term_scroll.vim
new file mode 100644
index 0000000..ef55017
--- /dev/null
+++ b/vim/.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 <silent> <buffer> <ScrollWheelUp> <c-w>:call EnterNormalMode()<CR>
+
+function! ExitNormalMode()
+ unmap <silent> <buffer> <RightMouse>
+ call feedkeys("a")
+endfunction
+
+function! EnterNormalMode()
+ if bufname('%') =~ '!lazygit'
+ tunmap <buffer> <ScrollWheelUp>
+ elseif &buftype == 'terminal' && mode('') == 't'
+ call feedkeys("\<c-w>N")
+ call feedkeys("\<c-y>")
+ map <silent> <buffer> <RightMouse> :call ExitNormalMode()<CR>
+ endif
+endfunction