sps
sps

Reputation: 2720

how to draw vertical lines between braces in vim?

How can we have a vertical line shown between the braces in vim editor. It is helpful when I am writing C code.

Upto now, while using vim editor, if i want to know the position of the closing brace, i do following:

  1. In normal mode, I take the cursor to opeining brace { and then press % which take the cursor to closing }.

  2. And then (try) to remember the line numbers of opening and closing brace.

But when I do this I often forget the line numbers of opening and closing braces. Plus, many times the brace pairs are nested which makes it more confusing to remember.

So I want to have a vertical line drawn between the braces, so that I can do the following:

  1. In normal mode, take the cursor to open { and press j or k (or even % or any other motion command) to navigate through the file. But with an added line on the left side so that i can know which block I am in.

So, if the code is indented properly, then by looking at the line on the left side I will always have a track of which block I am in. And can use j and k (or any other motion command) without having to remember the line number of opening and closing brace.

How can we do this in vim ?

Update: Got the answer here Is it possible to display Indentation guides in Vim? .

Upvotes: 4

Views: 3676

Answers (1)

Ôrel
Ôrel

Reputation: 7632

The indentLine plugin can help you indentLine plugins https://github.com/Yggdroot/indentLine (new location)

Upvotes: 11

Related Questions