1

I like to see my indentation level with listchars=tab:\|\

enter image description here

But one project uses two spaces instead. Is there any way to show indentation level lines then?

This question seems to the opposite of Show listchars tab as spaces

And differently from https://stackoverflow.com/questions/40498265/show-space-character-via-listchars-only-for-leading-spaces i would not like to show all spaces, but just the indentation level. e.g. two spaces |, four spaces | |, and not .., ....

0

Option 1:

vim-indent-guides on github

This plugin uses two alternating colors to show guiding lines (see the screenshot there).

The thickness of these lines can also be varied, as well as you could use just one color.

Option 2:

indentLine on github

This plugin uses customizable vertical tab characters for the guide lines. See the screenshots further down on the github page.

Note, that the leftmost guide is not displayed on the screenshots. This is not mentioned in the documentation, but if you want to have it displayed as well, you need to change

~/vim/after/plugin/indentLine.vim

and change the assignment of variable indentLine_showFirstIndentLevel from 0 to 1.

Note further, that the guideline is broken, if an empty line is passed. This is caused by the underlying technique of using vim's conceal feature.

For both options, read the respective github pages for the minimum requirements.

  • 1
    Thank you! IndentLine seems to be the definitive answer to my problem! It even states the goal is to be a listchars fix for code indented with spaces. – Gabriel Jan 4 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.