在.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!

相关文章:

  • 2021-11-21
  • 2021-08-19
  • 2021-11-20
  • 2021-11-20
  • 2022-12-23
  • 2021-11-09
猜你喜欢
  • 2021-12-12
  • 2021-10-15
  • 2021-08-14
  • 2021-11-09
  • 2021-12-22
相关资源
相似解决方案