在.vimrc中添加以下代码后,重启vim即可实现按TAB产⽣4个空格:
set ts=4 (注:ts是tabstop的缩写,设TAB宽4个空格)
set expandtab
替换对于已保存的⽂件,可以使⽤下⾯的⽅法进⾏空格和TAB
的替换:
TAB替换为空格:
:set ts=4
:set expandtab
:%retab!
空格替换为TAB:
:set ts=4
:set noexpandtab
:%retab
在.vimrc中添加以下代码后,重启vim即可实现按TAB产⽣4个空格:
set ts=4 (注:ts是tabstop的缩写,设TAB宽4个空格)
set expandtab
替换对于已保存的⽂件,可以使⽤下⾯的⽅法进⾏空格和TAB
的替换:
TAB替换为空格:
:set ts=4
:set expandtab
:%retab!
空格替换为TAB:
:set ts=4
:set noexpandtab
:%retab