Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a vim command to move the cursor to the parent bracket?

Tags:

vim

Is there a vim command to move the cursor to the parent bracket?

I have a configuration file like this one, and I want to go straight to the parent bracket. Is there a simple movement command to do this, or is there a way to combine commands to do what I want?

PARENT{ // I want to move my cursor here     CHILD { stuff... }    CHILD { stuff... }    CHILD { stuff... }  ...     CHILD { stuff... } // my cursor is on this line    CHILD { GRANDCHILD { more stuff } }    CHILD { stuff... } } 
like image 385
B Johnson Avatar asked Dec 02 '10 21:12

B Johnson


People also ask

How do I move between brackets in vim?

You can easily use the % key to jump to a matching opening or closing parenthesis, bracket or curly brace. You can also set the option showmatch . The cursor will briefly jump to the matching bracket, wen you insert one.

What does Ctrl-o do in Vim?

In insert mode, Ctrl-o escapes user to do one normal-mode command, and then return to the insert mode. The same effect can be achieved by <ESC> ing to normal mode, doing the single command and then entering back to insert mode.

How do I move the cursor to the end of a word in Vim?

Press e (“end”) to move the cursor to the last character of the current word.


1 Answers

Yes. Do [{ in normal mode for that. It might not work for all languages though.

Many move commands are available at :help [.

like image 146
Benoit Avatar answered Sep 22 '22 15:09

Benoit