diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-06-17 08:16:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-16 17:16:33 -0700 |
commit | 1fe94cb008e062ba42e09c284e32cf10c912689e (patch) | |
tree | 46f89d79651b6e1ecf7a91520393c29d7df936e2 | |
parent | c57f6b28d71df1eb6e967381a44a1c038a75698d (diff) | |
download | rneovim-1fe94cb008e062ba42e09c284e32cf10c912689e.tar.gz rneovim-1fe94cb008e062ba42e09c284e32cf10c912689e.tar.bz2 rneovim-1fe94cb008e062ba42e09c284e32cf10c912689e.zip |
docs: improve 'insertmode' emulation #18962
The current emulation script enters Insert mode much too frequently.
Using only BufWinEnter seems to be a closer simulation.
Also add a few more mappings.
-rw-r--r-- | runtime/doc/vim_diff.txt | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 8e67cb0923..385a5f8f61 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -550,10 +550,31 @@ Options: *'imstatusfunc'* *'imsf'* *'insertmode'* *'im'* Use the following script to emulate 'insertmode': > - autocmd VimEnter,CmdlineLeave,WinEnter,WinScrolled,BufEnter * silent! if &modifiable | startinsert | endif - inoremap <Esc> <Nop> - inoremap <C-L> <Esc> - nnoremap <Esc> i + autocmd BufWinEnter * startinsert + inoremap <Esc> <C-X><C-Z><C-]> + inoremap <C-C> <C-X><C-Z> + inoremap <C-L> <C-X><C-Z><C-]><Esc> + inoremap <C-Z> <C-X><C-Z><Cmd>suspend<CR> + noremap <C-C> <Esc> + snoremap <C-C> <Esc> + noremap <C-\><C-G> <C-\><C-N><Cmd>startinsert<CR> + cnoremap <C-\><C-G> <C-\><C-N><Cmd>startinsert<CR> + inoremap <C-\><C-G> <C-X><C-Z> + autocmd CmdWinEnter * noremap <buffer> <C-C> <C-C> + autocmd CmdWinEnter * inoremap <buffer> <C-C> <C-C> + + lua << EOF + vim.on_key(function(c) + if c == '\27' then + local mode = vim.api.nvim_get_mode().mode + if mode:find('^[nvV\22sS\19]') and vim.fn.getcmdtype() == '' then + vim.schedule(function() + vim.cmd('startinsert') + end) + end + end + end) + EOF < *'macatsui'* *'maxcombine'* *'mco'* |