Wednesday, October 3, 2007

"." command doesn't work as expected

First of all I have to thank Kamil Dworakowski who notice this behavior and warn me.

Now, what is happen is after a pair completion, if you exit from insert mode and try to do the last command with the "." key in normal mode, Vim will only reinsert the content that you enter inside the pair chars, e.g:

On insert mode type (123 and exit to normal mode. You should have this:

Now move to any other part of text and press "." (without quotes) and you should see this:

What is happen is that a movement key on insert mode (e.g. <Left>, <Right>, <Down> or <Up>) says to Vim that what will be inserted next is to be kept, the rest forget.

To confirm that make a simple test and you'll see:

  • Go to insert mode;
  • Type 124<Left>3;
  • Go to normal mode;
  • Move cursor to other place;
  • Press <.>;

Now only 3 is reinserted!

This behavior is reflected on TownkAutoCompleteChar because it inserts the "close-pair" and right after that it "insert" an extra <Left> char, making the cursor go inside the pair of chars.

If anyone have any idea on how can I workaround this behavior, please send me a comment or an email!