On Fri, May 8, 2009 at 01:28, Yegappan Lakshmanan <[email protected]> wrote:
>
> Hi,
>
> On Thu, May 7, 2009 at 2:09 PM, Erik Wognsen <[email protected]> wrote:
>>
>> Hi people!
>>
>> I'm programming some x86 assembly, where all my stack offsets are 4
>> bytes. Once in a while, I'll want to change e.g.
>>
>> movl 4(%ebp), %eax
>> into
>> movl 8(%ebp), %eax
>>
>> Now CTRL-A four times or 4CTRL-A will do that. But being bent on
>> optimization I wanted CTRL-A and CTRL-X to move in steps of four.
>> First, I tried:
>>
>> noremap <c-a> 4<c-a>
>>
>> which works fine until I want to use it with a count, e.g. 2CTRL-A
>> works like 24 increments instead of 8 and 3CTRL-A as 34 instead of 12
>> and so on. Now, guided by the vim manual, I did:
>>
>> noremap <c-a> @='4<c-a>'<cr>
>>
>> This sends vim into recursion that is not stopped by maxmapdepth!
>>
>> Any ideas?
>>
>
> You can try using something along the lines of the following command:
>
> nnoremap <c-a> :<c-u>exe 'norm! ' . <c-r>=v:count1*4<cr> . '<c-a>'<CR>

Thanks! Works nicely!

/Erik

>
> - Yegappan
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to