kana / vim-textobj-line

Vim plugin: Text objects for the current line
http://www.vim.org/scripts/script.php?script_id=3886
178 stars 7 forks source link

Incorrect behaviour with :normal . command #2

Closed nashbridges closed 11 years ago

nashbridges commented 11 years ago

I'm not sure whether it's vim-textobject-line or vim-surround issue. Suppose I have this text:

hello world
bye world
hello again!

Then I run vim-surround command on the first line ysal"

"hello world"
bye world
hello again!

Then I select two remaining lines with Vj and try to run :normal .

"hello world"
"bye world"
"hello aga"in!

If I start from the last (longest) line, I get correct result. If I select all lines and run :normal ysal", the result is also correct.

kana commented 11 years ago

Thank you for the feedback. The problem happens also by directly typing . in Normal mode, doesn't it?

kana commented 11 years ago

Anyway, it would be better to use yss" instead of ysal". The former is properly repeatable.

nashbridges commented 11 years ago

You're right, ysal" is not correctly repeatable in any mode. yss" works just fine, thanks for reply!

kana commented 11 years ago

I investigated the problem. In short, it might be possible to fix the problem. But it's a hard work. I'll try to investigate more deeply when I have spare time.

Technically, Vim has a buffer to record the last executed command for .. The buffer contains the key sequence to execute the last executed command. For example, if you type ysal", Vim maps ys and al to magic stuffs defined by vim-surround and vim-textobj-line. So that Vim doesn't record ysal" as is. Vim records an expanded result of ysal" instead. Usually . repeats a command according to the buffer. But Vim doesn't record expanded key sequence as is in some cases. That's why al is not correctly repeatable.

kana commented 11 years ago

Please upgrade Vim to 7.3.918 or later. This issue has been resolved by Vim 7.3.918.