2016-08-15 54 views
1

我一直在爲我的主編輯器使用MacVim一段時間。我主要將它用於javascript,express.js是具體的,有一件令我困擾的事情是它的縮進。Vim Javascript Indentation內函數

我想縮進做到這一點:

app.get('/', function(req, res) { 
    res.send("Hello, world!"); 
}); 

但現在它這樣做:

app.get('/', function(req, res) { 
     res.send("Hello, world!"); 
      }); 

我不知道爲什麼它這樣做。而對於額外的信息,這是我的.vimrc:

execute pathogen#infect() 
set tabstop=4 
set smartindent 
set autoindent 

我也有通過病原安裝this。請幫幫我。謝謝。

+3

將'filetype plugin indent on'添加到'vimrc'中。 – dNitro

+0

什麼是文件類型或文件擴展名。你確定編輯器知道它是一個JavaScript文件嗎? – jfriend00

+0

謝謝@dNitro!在我向vimrc中添加'filetype plugin indent'之後,問題就解決了。 – jamien

回答

1

filetype plugin indent on添加到您的vimrc