[注:在vi中使用:help expandtab可以查看expandtab的使用说明,其它配置项同理。]
1. Tab自动转换为空格
在~/.vimrc中加入:
set tabstop=4 // Force tabs to be displayed/expanded to 4 spaces (instead of default 8).
set expandtab // Use the appropriate number of spaces to insert a <Tab>. To insert a real tab when 'expandtab' is on, use CTRL-V<Tab>.
2. 自动缩进
set smartindent / set autoindent
3. 显示行号
set nu
4. 针对C语言自动缩进
set cindent
5. 设置缩进的空格数
set shiftwidth=4

本文介绍了如何在Vim编辑器中进行基本配置,包括Tab自动转换为空格、自动缩进、显示行号等,特别关注了C语言的自动缩进设置及缩进空格数量的调整。
1634

被折叠的 条评论
为什么被折叠?



