Thursday, June 4, 2015

Re: Incrementing and decrementing numbers

On 2015-06-04 16:12, Arun wrote:
> Looks like it is signed operation always, you can try these mappings
> instead:
>
> "Keeping cursor on a number, hit these
> nn <c-a> ciw<c-r>=@"+1<cr><esc>
> nn <c-x> ciw<c-r>=@"-1<cr><esc>
>
> You can, maybe, write a function to move to the nearest number to
> mimic native ctrl-a behavior.

You can do a ^A followed by an undoing ^X to move the cursor to the
right place before Arun's suggestion:

nnoremap <c-a> <c-a><c-x>ciw<c-r>=@"+1<cr><esc>
nnoremap <c-x> <c-a><c-x>ciw<c-r>=@"-1<cr><esc>

-tim



--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment