最新消息:20210917 已从crifan.com换到crifan.org

[基本解决]vi中tab默认为8个空格

Linux crifan 3237浏览 0评论

现在是vi中用tab,结果缩进了8个字符:

希望改为:

把vi中的tab的空格改为4个空格

vi tab 4 space

结果又出错:

[无需解决]source /etc/vimrc出错:/etc/vimrc:65: unmatched ‘

https://www.crifan.org/souce_etc_vimrc_unmatched

编辑配置文件:

vim /etc/vimrc

去添加:

set tabstop=4
set shiftwidth=4        " Indents will have a width of 4
set softtabstop=4       " Sets the number of columns for a TAB
set expandtab           " Expand TABs to spaces

然后结果用vi,还是没用,问题依旧。

但是用vim去编辑,就可以了:

并且也带语法高亮的。

-》以后,不要用vi,而改用vim了。

既有语法高亮,tab也是4个空格宽度,而不是8个空格了。

转载请注明:在路上 » [基本解决]vi中tab默认为8个空格

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
92 queries in 0.180 seconds, using 23.31MB memory