开发者

goto definition (gd) while inside function call

If I am editing a function call like:

many_params(param1, "a long...string", p|aram3); // Cursor located at |

Then typing gd will jump to the def开发者_StackOverflowinition of param3, not many_params. What is the most efficient idiom for moving the cursor to many_params, without using ^.

To clarify, please do not answer with ^, because I want an idiom that is also compatible with:

// Lets jump to func3's definition
func1(func2(123, "aaaaa"), func3("bbbbb", 3|, 4, 5));


The only idea I have is to:

  • go to the left opening parenthesis - F(
  • move one word backwards - b

so the command is F(b. However it won't work with text like func1("abc(d", 222|2)


It feels a bit dirty to me, but you can handle nested parentheses as well with ya(h. Note that this yanks the parenthesized bits to your yank buffer, which may not be desirable, but you would work around that by mapping to "_ya(h. This will go to the open paren of the enclosing parens, and subsequent executions of it will go to subsequent levels of parenthesization. I don't know of another way to get to the enclosing parentheses without being interrupted by intervening parentheticals.

If you're using this, you need to use the h instead of b in case you have multiple parentheses in a row. ...but then again, maybe the behavior with b would be desirable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜