2

While writing a C program in Vim editor, suppose I want to edit the argument list of a function for example:

int show_user_data(float num){ //Some code //more code } 

My cursor currently blinking on i of the int in

int show_user_data(float num){

How do I bring my cursor directly inside the argument list of the function i.e inside the round brackets so that it is now blinking (better going into insert mode also) at the f of float such that I am ready to edit the argument list already.

2
  • Why not just 3w ? Commented Dec 23, 2019 at 16:33
  • I dont know why I didn't think of that . Thanks ! Commented Dec 24, 2019 at 12:20

2 Answers 2

4

The command % will bring you to the next "match item", which is ) in this case (see :h 'matchpairs').

Now, when the cursor is on the right paren, you can do %a to get to the left one and enter insert mode.

So, it takes only 3 keystrokes: %%a

Or you can search for ( character: f(a. Three keystrokes too.

Sign up to request clarification or add additional context in comments.

Comments

1

There will be many ways based on user preference and habit. For your example code, I would simply do

ffi 

f will take you to first character which follows it, here f and i for insert

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.