Tab configuration in vim
This posts mainly show the configuration of vim to translate tab to 4 spaces.
~/.vimrc file, we can set the following code
set tabstop=4 " set the size of Tab set shiftwidth=4 " set the width of shift set expandtab " expand tab to space set softtabstop=4 " <BS> can delete 4 space
The more details can be shown in
If the file has been storaged, you can use the following commands in vim to expand tab to space
:set tabstop=4 :set expandtab :%retab!
Expanding space to tab can be completed using the commands below
:set tabstop=4 :set noexpandtab :%retab!
! is used to change all
Tab, otherwise, only the
Tab in the start of line