Friday, September 21, 2012

Re: increment character under cursor

On 09/21/12 14:27, JP Lew wrote:
> I was wondering if it was possible for Vim to increment the character I
> have selected under the cursor, rather than the whole number.

Not in-built. You could do something like

:nnoremap <f4> s<c-r>=<c-r>"+1<cr><esc>

to just operate on the one character under the cursor.

> A second, and related, question, is it possible to get CTRL-A & CTRL-X to
> move in bigger jumps? Like rather than 1 unit a time, it'd be nice to hit
> CTRL-SHIFT-A to move 10 units at a time.

Well, you can prefix ^A/^X with a count to change the increment, so
in your case, you can use

10^A

as you mention/map below (though in this case, the "r4" solution is
shorter)

> I tried this mapping, but it
> doesn't seem to work:
>
> nmap <S-C-A> 10<C-A>

Part of the problem may have been that vim doesn't discern
control+{char} from control+shift+{char}, but you have the right
idea. You just have to map it to something vim recognizes :-)

-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

No comments:

Post a Comment