jeetsukumaran / vim-pythonsense

A Vim plugin that provides text objects and motions for Python classes, methods, functions, and doc strings.
MIT License
213 stars 12 forks source link

README "override yet replicate the default mappings" is misleading #18

Open Paul-Aime opened 3 years ago

Paul-Aime commented 3 years ago

In the README is the following:

For example, to override yet replicate the default mappings you would define, the following in ~/.vim/ftplugin/python/pythonsense-custom.vim:

map <buffer> ac <Plug>(PythonsenseOuterClassTextObject)
map <buffer> ic <Plug>(PythonsenseInnerClassTextObject)
map <buffer> af <Plug>(PythonsenseOuterFunctionTextObject)
map <buffer> if <Plug>(PythonsenseInnerFunctionTextObject)
map <buffer> ad <Plug>(PythonsenseOuterDocStringTextObject)
map <buffer> id <Plug>(PythonsenseInnerDocStringTextObject)

...

So I did override all the keybindings, even if only modifying a few, so to have them all in one place to read.

However this does not replicate the default behavior, because map also apply to normal mode whereas default mappings are only omap and vmap (as I can tell by reading pythonsense.vim source code).

And all those mappings begin with i or a, which from normal mode make you go into insert mode. So it introduces lag, or even bug, e.g. when typing idef to enter insert mode and starting to define a function, nothing will happen.

Maybe a note should be added on that in the README.

Btw, thanks for the great plugin!

Hubro commented 2 years ago

Thank you! This was exactly what I was going to report. I've never heard of "omap" and "vmap" before, so I wouldn't have figured this out on my own.