Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you select the entire PHP function definition?

Tags:

vim

In PHP, if I have a function such as:

function test($b) {

  var $a = 0;

  while ($a < b) {
    $a += 3;
  }

  return $a;
}

and the cursor is on the $a += 3 line, is it possible to quickly select the entire function?

"v2aB" would select everything including the function braces but not the declaration function test($b)

like image 976
case nelson Avatar asked Dec 16 '09 18:12

case nelson


1 Answers

Press V after the selection command you post, to convert the selection to line selection, and it will select the function declaration:

v2aBV

like image 159
Christian C. Salvadó Avatar answered Nov 09 '22 23:11

Christian C. Salvadó