php的Vim缩进
我想喜欢vim缩进的这种行为php的Vim缩进,php,vim,Php,Vim,我想喜欢vim缩进的这种行为 public function foo() { _ <= cursor position } 我的vimrc是 filetype plugin indent on set expandtab set tabstop=4 set softtabstop=0 set shiftwidth=4 set autoindent set smartindent autocmd FileType php setlocal sw=4 sts=4 ts=4 et
public function foo()
{
_ <= cursor position
}
我的vimrc是
filetype plugin indent on
set expandtab
set tabstop=4
set softtabstop=0
set shiftwidth=4
set autoindent
set smartindent
autocmd FileType php setlocal sw=4 sts=4 ts=4 et
au BufRead,BufNewFile,BufReadPre *.php setl ft=php
inoremap {<Enter> {}<Left><CR><ESC><S-o>
inoremap [<Enter> []<Left><CR><ESC><S-o>
inoremap (<Enter> ()<Left><CR><ESC><S-o>
filetype插件缩进
设置扩展选项卡
设置tabstop=4
设置softtabstop=0
设置shiftwidth=4
自动缩进
智能对齐
autocmd文件类型php setlocal sw=4 sts=4 ts=4 et
au BufRead,BufNewFile,BufReadPre*.php setl ft=php
inoremap{{}
inoremap[]
inoremap()
整体是
关于这可能是什么有什么想法吗?它的行为是这样的,因为如果您使用
剪切行,vim将不会考虑缩进行的末尾(“}”
)
请尝试此映射:
inoremap {<Enter> {<cr>}<esc>O
inoremap{{}O
我投票决定将这个问题作为离题问题来结束,因为它属于Vim SE站点。@Script47:但是关于Vim的哪个问题不是离题问题(这是一个真诚的问题,我已经在想了)?-->这个问题涉及设置.vimrc
,它是用脚本语言编写的。那么为什么不讨论这个问题呢?您可能希望在vimrc内部的文件类型插件缩进。如果文件类型缩进脚本应该处理它。(这也意味着你不需要setl ft=php
autocmd)。@FDinoff另外,中已经添加了filetype-plugin-indent-on
。vimrc
@FDinoff语法在没有ft=php
的情况下不起作用……非常感谢你的帮助!我尝试了,但没有效果……我得到了同样的结果。
inoremap {<Enter> {<cr>}<esc>O