DEV Community

CodingShower
CodingShower

Posted on

Vim Convert Tab Key Press into Spaces

Here's a quick tip on how to convert the tab key in vim to spaces instead of the tab character. Put the following in your ~/.vimrc:

set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
Enter fullscreen mode Exit fullscreen mode

Or the following command when the editor is open:

:set et sw=2 ts=2 sts=2
Enter fullscreen mode Exit fullscreen mode

Head over to this article to read up more on each setting/option specified above.

Top comments (0)