how I can quickly change number like this

87 views
Skip to first unread message

Yang Luo

unread,
Apr 18, 2016, 11:18:45 AM4/18/16
to vim_use
call append(curr_line+13, call append(curr_line+14,
call append(curr_line+13, call append(curr_line+15,
call append(curr_line+13, call append(curr_line+16,
call append(curr_line+13, call append(curr_line+17,
call append(curr_line+13, call append(curr_line+18,
call append(curr_line+13, call append(curr_line+19,
call append(curr_line+13, call append(curr_line+20,
call append(curr_line+13, call append(curr_line+21,
call append(curr_line+13, ==> call append(curr_line+22,
call append(curr_line+13, call append(curr_line+23,
call append(curr_line+13, call append(curr_line+24,
call append(curr_line+13, call append(curr_line+25,
call append(curr_line+13, call append(curr_line+26,
call append(curr_line+13, call append(curr_line+27,
call append(curr_line+13, call append(curr_line+28,
call append(curr_line+13, call append(curr_line+29,
call append(curr_line+13, call append(curr_line+30,
call append(curr_line+13, call append(curr_line+31,
call append(curr_line+13, call append(curr_line+32,

h_east

unread,
Apr 18, 2016, 11:31:32 AM4/18/16
to vim_use
Hi Yang,

2016-4-19(Tue) 0:18:45 UTC+9 Yang Luo:

Please see document.
:help v_CTRL-A

--
Best regards,
Hirohito Higashi (a.k.a. h_east)

lessthanideal

unread,
Apr 18, 2016, 11:39:43 AM4/18/16
to vim_use

See this thread from before for some more solutions

https://groups.google.com/forum/#!topic/vim_use/tET37NdW7LM

The one I use a lot from it (credit to OP of course) would be to do this

:let i = 13
:g/13/s//\=i/|let i+=1

Bram Moolenaar

unread,
Apr 18, 2016, 12:50:39 PM4/18/16
to lessthanideal, vim_use
If all the "13" are alligned there is a simpler way:
Use CTRL-V to visually select every "13", then type g CTRL-A.

--
You had connectors? Eeee, when I were a lad we 'ad to carry the
bits between the computer and the terminal with a spoon...

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

h_east

unread,
Apr 18, 2016, 9:31:29 PM4/18/16
to vim_use
Hi,

> Please see document.
> :help v_CTRL-A

Oops, I was half asleep.

:help v_g_CTRL-A

Yang Luo

unread,
Apr 22, 2016, 9:57:42 AM4/22/16
to vim_use
how to add a short key to map this command?

Yang Luo

unread,
Apr 23, 2016, 5:17:49 AM4/23/16
to vim_use
在 2016年4月18日星期一 UTC+8下午11:39:43,lessthanideal写道:
so, if I map this command to a short key, it will have a variable(13) in my command, how should I do?

Yang Luo

unread,
Apr 23, 2016, 5:19:42 AM4/23/16
to vim_use, geoffr...@thomsonreuters.com
在 2016年4月19日星期二 UTC+8上午12:50:39,Bram Moolenaar写道:
All 13 is aligned, but I do like this:
in normal mode:
Hit v
Hit g
Hit CTRL-A
No response, is something I missed?

h_east

unread,
Apr 23, 2016, 5:32:01 AM4/23/16
to vim_use, geoffr...@thomsonreuters.com
Hi Yang,

2016-4-23(Sat) 18:19:42 UTC+9 Yang Luo:
First, you need to select all `13` in visual mode like below.
ggf1<C-V>Gf3

NOTE:
<C-V> is Ctrl-V

Then hit g and Ctrl-A
Message has been deleted

Yang Luo

unread,
Apr 23, 2016, 7:50:40 AM4/23/16
to vim_use
yes. I move cursor to first 13, then i hit ctrl+v in visual block mode, then move jk to selecte all 13, then hit g ctrl+a. it have no response.
i use gvim 7.3

h_east

unread,
Apr 23, 2016, 7:55:14 AM4/23/16
to vim_use
Hi Yang,

2016-4-23(Sat) 20:50:40 UTC+9 Yang Luo:


> yes. I move cursor to first 13, then i hit ctrl+v in visual block mode, then move jk to selecte all 13, then hit g ctrl+a. it have no response.
> i use gvim 7.3

v_g_CTRL-A feature was implemented by Patch 7.4.754.
https://groups.google.com/d/topic/vim_dev/5u4nnnUbA70/discussion

Please use Vim 7.4.754 or later.

Reply all
Reply to author
Forward
0 new messages