Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: vertical lines indicating how much a line of code has been indented?

Is there a way to get Vim to show vertical lines that make it visually easier to see how many tab stops (or spaces) a line of code has been indented?

like image 397
Matty Avatar asked Dec 16 '22 09:12

Matty


2 Answers

I think this plugin does what you want.

https://github.com/nathanaelkane/vim-indent-guides

like image 135
nickmbailey Avatar answered Dec 21 '22 10:12

nickmbailey


as a start, try this:

set list listchars=tab:»·,trail:·,extends:#

see :help 'listchars'

You can also place a vertical line at any desired column using (80 in this case):

highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%81v.\+/

As of vim 7.3, you can use set colorcolumn=80 (set cc=80 for short).

like image 32
Fredrik Pihl Avatar answered Dec 21 '22 09:12

Fredrik Pihl