Coc.nvim: coc visual mapping for "i" interferes with typical bindings for COLEMAK users

Created on 31 Aug 2019  ·  4Comments  ·  Source: neoclide/coc.nvim

When using coc, if in visual mode is mapped to coc-funcobj-i. This works great for qwerty users, where i will be bound to the entering of insert mode.

colemak and dvorak users usually rebind i to other things. For example, in colemak i is where l is in qwerty. Since we like the hjkl bindings, most of us remap hjkl to snei. The result is that hitting i in visual mode no longer works well when using coc. We essentially lose the ability to go right quickly in visual mode, vim pauses for about a second while it waits for the f key which creates a pretty bad experience.

I wonder if it would be possible to allow the binding for i to be set as an option to coc? Or for coc to somehow see what is already bound to i and bind that instead? Or to add something to the README to show how to work around it?

question

Most helpful comment

Default mappings for function text object are removed.

All 4 comments

~For anyone interested, the solution I use is to add this to my neovim/vim config:~
I tried this but it throws errors when if is not mapped, like when I open vim with a text file:

xunmap if
xmap uf <Plug>(coc-funcobj-i)

I'm still not actually sure what if (uf) does ;)

Okay here is the actual solution:

xmap uf <Plug>(coc-funcobj-i)

If coc sees that <Plug>(coc-funcobj-i) already has a mapping, it won't take if for that mapping.

If coc sees that (coc-funcobj-i) already has a mapping, it won't take if for that mapping.

It's feature, you can add xmap if <Plug>(coc-funcobj-i) to your vimrc if you want to.

Default mappings for function text object are removed.

Default mappings for function text object are removed.

完全没有必要把这个默认映射去掉啊。楼主的问题是自己的i映射为l和默认的if映射有重合造成的,自己重新设置一下映射就可以了啊。
if和af这两个映射好多插件都默认了,这样删掉好多用户都要在自己的vimrc中配置一下。而且不知道为什么,我刚才在自己的vimrc添加这几个配置后,发现不起作用。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lanox picture lanox  ·  3Comments

zhou13 picture zhou13  ·  3Comments

andys8 picture andys8  ·  3Comments

FrankLA0203 picture FrankLA0203  ·  3Comments

svenstaro picture svenstaro  ·  4Comments