diff options
Diffstat (limited to '.vim/feat/term_scroll.vim')
| -rw-r--r-- | .vim/feat/term_scroll.vim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/.vim/feat/term_scroll.vim b/.vim/feat/term_scroll.vim index d01fe4c..ef55017 100644 --- a/.vim/feat/term_scroll.vim +++ b/.vim/feat/term_scroll.vim @@ -1,19 +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> <ScrollWheelUp> <c-w>:call EnterNormalMode()<CR> +tmap <silent> <buffer> <ScrollWheelUp> <c-w>:call EnterNormalMode()<CR> function! ExitNormalMode() - unmap <buffer> <silent> <RightMouse> + unmap <silent> <buffer> <RightMouse> call feedkeys("a") endfunction function! EnterNormalMode() - if @% == '!lazygit' - tunmap <buffer> <silent> <ScrollWheelUp> + if bufname('%') =~ '!lazygit' + tunmap <buffer> <ScrollWheelUp> elseif &buftype == 'terminal' && mode('') == 't' call feedkeys("\<c-w>N") call feedkeys("\<c-y>") - map <buffer> <silent> <RightMouse> :call ExitNormalMode()<CR> + map <silent> <buffer> <RightMouse> :call ExitNormalMode()<CR> endif endfunction |
