9

I want to be able to navigate the cursor across functions using Vim. Mainly, I want a command to allow me to go to the next function, like } allows me to go to the next paragraph. I found this:

Go to the end of the C++ function in Vim

Unfortunately, it doesn't seem to work fine in JavaScript. Also, I believe it would also not work for Python, as Python don't depend much on { and }.

Any help?

Community
  • 1
  • 1
Rafid
  • 18,991
  • 23
  • 72
  • 108
  • 2
    `/^def ` will take you to the next top level function – John La Rooy Jan 24 '11 at 09:38
  • This is only useful in Python, I am also looking for JavaScript and languages with similar syntax. Besides that, it is easier to press few keys, then to have to make a search every time, but it is good, thanks. – Rafid Jan 24 '11 at 09:55

1 Answers1

8

In a Python file I find:

  • } will take me to the end of a block,
  • ]] will take me to the start of the next function.
  • [[ takes me to the start of the current function, or the one above if I keep pressing.

]} didn't seem to work though.

Stephen Paulger
  • 5,204
  • 3
  • 28
  • 46