我想把大括号映射成输入左大括号就有这样的效果
int main(void){ //缩进了 }
我通过修改home目录下的.vimrc可以达到效果,问题是这样设置是对所有的文件都有效的,C++我想有这样的效果,但是别的语言(如python/lua)我不想有这样的映射,怎样针对某种语言进行vim的设置呢?要修改哪个文件呢?
小伙看你根骨奇佳,潜力无限,来学PHP伐。
也是写在.vimrc里,但是要指定文件类型:
.vimrc
filetype indent on autocmd FileType cpp setlocal ...... # 后面省略号为具体设置,空格分隔,缩写见下表
(no)autoindent
ai
(no)cindent
ci
(no)smartindent
si
tabstop=X
ts
shiftwidth=X
sw
(no)expandtab
(no)et
softtabstop=X
sts
(no)smarttab
(no)sta
也是写在
.vimrc
里,但是要指定文件类型:(no)autoindent
ai
(no)cindent
ci
(no)smartindent
si
tabstop=X
ts
shiftwidth=X
sw
(no)expandtab
(no)et
softtabstop=X
sts
(no)smarttab
(no)sta