jamien jamien - 3 months ago 9
Javascript Question

Vim Javascript Indentation Inside A Function

I've been using MacVim for my main editor for a while now. I mainly use it for javascript, express.js to be specific, and one thing that is bothering me is the indentation of it.

I want the indentation to do this:

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


But right now it's doing this:

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


I don't know why it's doing this. And for extra information, this is my .vimrc:

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


I also have this installed via Pathogen. Please help me. Thank you.

Answer

Add filetype plugin indent on to your vimrc.

Comments