0

accidentally just wrote

void foo(bar, baz, que) {

and forgot to specify type, I want to convert the above to

void foo(String bar, String baz, String que) {

How can I do that quickly?

1

Define "quickly".

Easiest way for me:

/bar<cr>iString <esc>WW.WW.

Another one would be:

V:s/b/String b/g

1

I handle such situations using macros

1) move cursor to right place:

void foo(bar, baz, que) {
         ^

2) Start writing macros to some buffer. For example - buffer "e" qe

3) correct one argument and move cursor to another iString <esc>WW

void foo(String bar, baz, que) {
                     ^

4) Stop macros execution q

5) Execute macros two more times 2@e

void foo(String bar, String baz, String que) {
                                             ^

Total input from right position qeiString <esc>WW2@e. Where <esc> is escape key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.