[英]Vim weird indentation for .php
我想喜歡vim縮進的這種行為。
public function foo()
{
_ <= cursor position
}
但是,變成了...
public function foo()
{
_
}
我的.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>
整個就在這里 。
關於這可能是什么想法?
之所以這樣,是因為如果您用<Left><CR>
剪切行,vim將不會考慮行的結尾(在您的情況下為"}"
)以考慮縮進。
請嘗試以下映射:
inoremap {<Enter> {<cr>}<esc>O
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.