ryvnf / readline.vim

Readline emulation for command-line mode
88 stars 2 forks source link

Control W <c-w> twice doesn't save into s:yankbuf #3

Closed mbigras closed 5 years ago

mbigras commented 5 years ago

Hello there!

Thank you so much for this plugin, moving around the vim command line was really challenging until I found your work!

I found a minor inconsistency with the behavior of s:yankbuf on the vim command-line compared to the bash command-line when using <c-w> twice.

For example:

in bash

echo hello world█ # <c-w>
echo hello █ # <c-w>
echo █ # <c-y>
echo hello world█

in vim

:echo hello world█ # <c-w>
:echo hello █ # <c-w>
:echo █ # <c-y>
:echo hello █
ryvnf commented 5 years ago

Hello! Thanks for appreciating the plugin.

As you describe this is one of the parts were the plugin fails to completely emulate Readline's behavior. The reason for this is that it is difficult to implement.

The challenging part is to know when to stop appending text to the yank buffer, which happens when the user aborts a series of deletions (or kills as Readline calls them). To perfectly emulate Readline's behavior we need to be notified about all commands that the user enters, including character insertions.

The only complete solution I can see to this problem would be making the plug-in intercept all typed characters in some way. That is probably possible, but would increase the complexity dramatically and would most likely not work well with other plugins.

I am open to other suggestions. But currently I can't see a solution that doesn't either cause other inconsistencies with Readline or would involve a big hack to intercept key presses.

mbigras commented 5 years ago

That makes sense, making such a big change for such a small benefit doesn’t seem worth it, your plugin helps me in an expected way 99 percent of the time as-is