Is there a vim command to move the cursor to the parent bracket?
VimVim Problem Overview
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... }
}
Vim Solutions
Solution 1 - Vim
Yes. Do [{
in normal mode for that. It might not work for all languages though.
Many move commands are available at :help [
.
Solution 2 - Vim
Also you can press % and it will show your open or close bracket
Solution 3 - Vim
It looks like [[
does what you want. And ][
moves to the bottom-most brace. (With many thanks to @Benoit for cluing me in that this might be possible...)