Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Setting indent to 2 doesn't behave as expected #193

elclanrs opened this Issue · 12 comments
set shiftwidth=2
set tabstop=2
set softtabstop=2

I tried the above and some js still weirdly default to 4 spaces in some cases. It's not consistent... Are there any other values modifying this?


rm ~/.vimswap/* should do ya right.


What is the reason for this behaviour?


I'm still new to vim, but I think .vimrc sets shiftwidth with the old vi style "sw" variable in the indent_guides plugin section. When I commented that out, I could change the setting in the Formatting section and have them take effect after restarting vim.


Same here. Still doesn't work for me.


Works for me rm ~/.vimswap/* does the trick


Isn't working for me (and I set them in both .vimrc.local and .gvimrc.local, and ~/.vimswap/ is empty). Note, this is a JS file. Could vim-javascript be responsible?


Deleting the files did not work for me, I am working with ruby files. I will let you know if I find a solution.

I've added this to my ~/.vimrc.local file

set smartindent
set shiftwidth=2
set expandtab

However, after opening a ruby file, and doing :set shiftwidth, vim responds with:


@droope @webmaven if rm ~/.vimswap/* didn't worked for you, then try clean your vimviews folder, it probably cached the files you we're editing before. Use rm ~/.vimviews/* that should pick up your new settings.


It's probably a ruby specific plugin that is setting it upon opening a ruby file which would happen after the .local file is read. That's a pretty common thing for language specific plugins to do.


Not sure what changed (rm ~/.vimviews/* didn't have any effect for at least a few days), but JS files eventually did start picking up the 2-space indentation as intended.

@spf13 spf13 closed this

@webmaven so I'm hopeful my JS files will, as well...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.