Yggdroot / indentLine

A vim plugin to display the indention levels with thin vertical lines
MIT License
4.13k stars 227 forks source link

Indented lines of four lengths #358

Open SlRofa-SUSE opened 3 years ago

SlRofa-SUSE commented 3 years ago

Hello, the default indent line is 8 spaces indented once, how can I set it to 4 spaces.

chuckdavisson commented 3 years ago

There are a couple of ways. I'm assuming that you're using vim, so:

You could add this to your .vimrc file: set tabstop=4 " number of visual spaces per TAB set softtabstop=4 " number of spaces per tab when editing set shiftwidth=4 " spaces to insert or remove using the indentation commands set expandtab " tabs are spaces

OR, if you want different spaces for different purposes, for example 4 spaces per tab for Python, 2 spaces for YAML files, you could add this to your .vimrc file instead of the above:

" Shell autocmd Filetype sh setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab " Python autocmd Filetype py setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab " YAML autocmd Filetype yaml setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab autocmd Filetype yml setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab " JSON autocmd Filetype json setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab " Jinja 2 autocmd Filetype j2 setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab

Note that the " in the .vimrc file just indicates that the line is a comment

There's probably other (better) ways to do what you're asking, but this is how I do it.

Hope that helps!

SlRofa-SUSE commented 3 years ago

Thank you. It is now shown in four spaces.