Vim tab spacing after enter (new line)
vim
Solution
Please try using the following:
set smartindent
set tabstop=2
set shiftwidth=2
set expandtab
Problem
I've this tab spacing configuration: ``` set autoindent set smartindent set expandtab tabstop=4 shiftwidth=4 smarttab softtabstop=4 ``` and at the end of configuration, I put this: ``` autocmd FileType javascript,jade,json set shiftwidth=2 tabstop=2 softtabstop=2 ``` The 2 spaces tab works just fine. But, if I type enter (new line), it became 4 spaces. Here is the example: ``` var Post = orm.define('Post', { title: sequelize.STRING, content: sequelize.STRING, | /* wrong spaces */ }); ``` But if I use 4 tab spaces, it also use 4 spaces after enter. I can't figure out what's the problem. EDIT: It ONLY happened when I write object-literal in a javascript callback function (like the code example above). It works fine with general code statement and in json object-literal. Here is the example: ``` /* the 2 spaces works fine*/ app.set('port', 3000); app.use(express.bodyParser()); /* also works fine here */ var config = { host: 'localhost', port: 5432 } ```