Original vi:
doesn't know about et
, you could experiement with different values for ts
(tabstop) and sw
(shiftwidth, i.e. the amount <<
and >>
indent a line or block of text). Basically, whenever sw is set to something lower (usually a fraction of) the value assigned to ts, indenting will use spaces instead of tabs. Beware that when a multiple of shifts add up to a full tabstop, a tab will be used in that place.
Default is for both to be 8, and a number of other commands (such as expand), base their assumptions on that, so a text written with mixed tabs and spaces where ts has been tweaked may be misaligned when viewed lateron with a different setting for tabstop.
To achieve your goal, you could first use /bin/expand
to replace all tabstops with spaces in your existing text, then pull the text into vi, :set sw=4,ts=20
, and try if these settings suit you. If they do, you can make them permanent by writing them into your .exrc
Another way, which would allow you to use tab and backspace the way you prefer (instead of shifting with <<
and >>
) would be to allow yourself to write the text the way you prefer, and pipe it through /bin/expand
prior to processing with yml, wither as part of your command chain, or from within vi itself:
:1,$!expand
In vim:
you can use the et
(expandtab) setting as already suggested, and even convert all tabs into spaces by uning a builtin (which has the advantage of knowing your tabstop settings, incase you tweaked them, without having to be told explicitely, as expand
needs to).
:set et|retab
other interesting settings would include sts
(softtabstop) and smarttab
, with all these settings adapted to suit your needs, even ai
(autoindent) would behave consistently and throw spaces instead of tabs.
:set et
:set sw=3
:set sts=3
:set smarttab
:set ai
or, in one line:
:set et sw=3 sts=3 smarttab ai
Again, once you agree with these settings, place them in your .vimrc