diff options
| Commit | 6ea45e425be52b92006e97e2caf315036542856d (patch ) | |
|---|---|---|
| Author | Syndamia <kamen@syndamia.com> | 2023-02-24 22:39:05 +0200 |
| Committer | Syndamia <kamen@syndamia.com> | 2023-02-24 22:39:05 +0200 |
| Files | 99e37b4a5963af7c99b35e705135b9457800aa82 /.vim/miniplugins/spell_check_mode.vim | |
| dotfiles-6ea45e425be52b92006e97e2caf315036542856d.tar dotfiles-6ea45e425be52b92006e97e2caf315036542856d.tar.gz dotfiles-6ea45e425be52b92006e97e2caf315036542856d.zip | ||
| Parent | 9020beac90c6779d831f0d73639c95a2dabacdb1 (diff) | |
[.vimrc] Huge overhaul, separating contents into different files
1 files changed, 33 insertions, 0 deletions
| -rw-r--r-- | .vim/miniplugins/spell_check_mode.vim | 33 |
diff --git a/.vim/miniplugins/spell_check_mode.vim b/.vim/miniplugins/spell_check_mode.vim new file mode 100644 index 0000000..cfdd46a --- /dev/null +++ b/.vim/miniplugins/spell_check_mode.vim @@ -0,0 +1,33 @@ +" When you press F6 it will toggle a "spell check mode", +" spell is activated and the colour scheme is changed +nmap <F6> :call SpellCheckModeToggle()<CR> + +function! SpellCheckModeToggle() + if g:colors_name == 'gruvbox' + set spell + colorscheme darkblue + else + set nospell + colorscheme gruvbox + endif +endfunction + +" Scrolling (shows history) in terminal (except in lazygit) +" Scroll up to activate it, and press a to deactivate it +" Slightly modified version of: https://github.com/vim/vim/issues/2490#issuecomment-393973253 +tmap <silent> <ScrollWheelUp> <c-w>:call EnterNormalMode()<CR> + +function! ExitNormalMode() + unmap <buffer> <silent> <RightMouse> + call feedkeys("a") +endfunction + +function! EnterNormalMode() + if @% == '!lazygit' + tunmap <silent> <ScrollWheelUp> + elseif &buftype == 'terminal' && mode('') == 't' + call feedkeys("\<c-w>N") + call feedkeys("\<c-y>") + map <buffer> <silent> <RightMouse> :call ExitNormalMode()<CR> + endif +endfunction |
