?
设置 256 色模式
:set t_Co=256
:TOhtml
在正常模式下
<<
可以向前缩进>>
可以向后缩进使用 g g = G
我们编程的时候会遇到缩进
空格
呢?还是 tab
呢?空格
和 tab
区别开来:set list
使得列表生效
^I
$
:set nolist
使得列表失效
listchars
组显示出来:set listchars
listchars
:set listchars=eol:$,tab:>-,space:_
tab
对应 >-
>
是开头-
在后面补位space
对应 _
eol
对应 $
:h listchars
可以查看相关手册:hi SpecialKey ctermfg=DarkRed guifg=grey70
listchars
相应的颜色:set shiftwidth=4
shiftwidth
是一个基础的值,对应>>
缩进的宽度\t
时缩进的宽度一般 tabstop
、softtabstop
都与他相同
shiftwidth
是 0 的话tabstop
来tabstop
是 读取文件
时用到的\t
字符时如果 softtabstop
等于 0
tabstop
来如果 tabstop=4
、softtabstop=8
按下 tab 时
要删除 tab 时
shiftwidth
起作用shiftwidth
是基础:set expandtab
tab
变成空格
设置好之后,在正常模式下
>---
,而是直接变成空格 _
反之 :set noexpandtab
之后
tab
都还是 >---
:h expandtab
可以查看相关手册
expandtab
可以简写为 et
:retab!
:set autoindent
:set ai
:se noai
:set smartindent
:se si
autoindent
的基础上根据 {
、}
来调整本行缩进:se nosi
:se nopaste
:set cindent
if
之类的可以自动缩进:set nocindent
:set noexpandtab
:set shiftwidth = 4
:set tabstop =4
:set softtabstop=4
:set autoindent
:set noet sw=4 ts=4 sts=4 ai
<<
缩进tab
缩进有关于缩进对应空格数的参数
不同的文件类型可以对应不同的缩进吗????
?
原文:https://www.cnblogs.com/oeasy/p/15178604.html