tpope / vim-repeat

repeat.vim: enable repeating supported plugin maps with "."
http://www.vim.org/scripts/script.php?script_id=2136
2.58k stars 81 forks source link

Using '.' Inside a Macro Not Working Properly #50

Closed lag13 closed 8 years ago

lag13 commented 9 years ago

I just noticed this today and I think it could be a bug. Sorry if it's not. I'm running vim version 7.3 in the terminal. In trying to narrow down this error I made a file called 'simplevimrc' with these contents:

set nocompatible
set rtp+=~/.vim/bundle/vim-repeat
nnoremap ,o :call append('.', '') \| silent! call repeat#set(",o")<CR>

I then edited a file 'temp' with this command:

vim -u simplevimrc temp

The file 'temp' contained only these two lines:

$iIDAccessLevel = SPE_ID_ACCESS_LEVEL_CLIENT_PROD_HM;
$iIDAccessLevel = SPE_ID_ACCESS_LEVEL_CLIENT_DEV_HM;

I then recorded this macro into the q register:

0dW.idefine("^[$cl", 4);^[

That macro is supposed to make those lines above look like this:

define("SPE_ID_ACCESS_LEVEL_CLIENT_PROD_HM", 4);
define("SPE_ID_ACCESS_LEVEL_CLIENT_DEV_HM", 4);

If I run this macro right after recording it, it seems to work just fine. But if I use the ",o" mapping before executing the macro, the '.' command in the macro (which is supposed to repeat the 'dW' command) doesn't seem to work. Sometimes running the macro made the second line look like this:

define("= SPE_ID_ACCESS_LEVEL_CLIENT_DEV_HM", 4)", 4);

Other times the line ended up looking like this:

define("= SPE_ID_ACCESS_LEVEL_CLIENT_DEV_HM", 4); 

Any insight as to what is going on would be much appreciated. Also, I could not reproduce this issue in 7.4 versions of MacVim or gVim. Thanks!

tpope commented 9 years ago

The plugin does special case behavior based on the Vim version to try to account for Vim bugs. Search for v:version to see the specifics.

lag13 commented 8 years ago

Hey, sorry for bothering you with this issue. I looked into it more a while back and this is just a limitation of the version of vim I was using.