vim – Navigating around code blocks quickly

You can use the following to quickly navigate around code blocks in vim.

  • [{ – Jump to nearest inner code block ( { curly brace ).
  • ]} – Jumps to the nearest inner code block ( } curly brace ).
  • [[ and ]] – allows you to quickly jump from function to function within the file.
  • % – Jumps to the opposite bracket or brace you are currently on.

You can keep pressing [{ to keep going out a scope. Then you can jump to the other using % if you want.

I have my space bar mapped to “zz” in my vim config file. zz allows you to center the text on the screen, which is very useful when navigating around code files like this.

Leave a Reply

You must be logged in to post a comment.