summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@yeah.nah.nz>2020-09-27 22:00:29 +1300
committerDavid Phillips <david@yeah.nah.nz>2020-09-27 22:00:29 +1300
commit1e46113c9acffdec505a471f9fbd923bccf5171f (patch)
treeb4072358abbef448b4b246234669496e3d6ba11e
parent45655b50d04d58b65fd3e8c38ac563a43e28abeb (diff)
downloaddotfiles-1e46113c9acffdec505a471f9fbd923bccf5171f.tar.xz
Hack in vimclutch functionality
This will need some polishing but it mostly works like this
-rw-r--r--vimrc23
1 files changed, 23 insertions, 0 deletions
diff --git a/vimrc b/vimrc
index 97a6e76..abb9b5e 100644
--- a/vimrc
+++ b/vimrc
@@ -89,3 +89,26 @@ highlight DiffAdd cterm=bold ctermfg=233 ctermbg=101 gui=none guifg=bg guibg
highlight DiffDelete cterm=bold ctermfg=175 ctermbg=175 gui=none guifg=bg guibg=Red
highlight DiffChange cterm=bold ctermfg=234 ctermbg=101 gui=none guifg=bg guibg=Red
highlight DiffText cterm=none ctermfg=242 ctermbg=0 gui=none guifg=bg guibg=Red
+
+let g:previousmode = 'i'
+function PushModeSwitchNormal() abort
+ let g:previousmode = mode()
+ " important: l so that we don't walk backward every time clutch is pushed
+ return "\<C-\>\<C-n>l"
+endfunction
+
+function PopMode() abort
+ return g:previousmode
+endfunction
+
+inoremap <expr> <F11> PushModeSwitchNormal()
+vnoremap <expr> <F11> PushModeSwitchNormal()
+xnoremap <expr> <F11> PushModeSwitchNormal()
+snoremap <expr> <F11> PushModeSwitchNormal()
+onoremap <expr> <F11> PushModeSwitchNormal()
+inoremap <F12> <Nop>
+vnoremap <F12> <Nop>
+xnoremap <F12> <Nop>
+snoremap <F12> <Nop>
+onoremap <F12> <Nop>
+nnoremap <expr> <F12> PopMode()