Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

elclanrs opened this Issue Oct 24, 2012 · 15 comments


None yet
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?

slajax commented Nov 1, 2012

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

What is the reason for this behaviour?


spf13 commented Nov 16, 2012

It caches the state of the editor for the file you are editing, stores the
cache in .vimswap.

If you manually change any setting while editing this file, exit vim and
reopen vim it will retain that setting.

Steve Francia

On Mon, Nov 5, 2012 at 7:36 AM, Roger Braun notifications@github.comwrote:

What is the reason for this behaviour?

Reply to this email directly or view it on GitHubhttps://github.com/spf13/spf13-vim/issues/193#issuecomment-10068899.

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.

zzeroo commented Mar 12, 2014

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


webmaven commented May 19, 2014

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?

droope commented May 20, 2014

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:


orendon commented Jun 12, 2014

@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.


spf13 commented Jun 30, 2014

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.


webmaven commented Jul 1, 2014

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 Jul 12, 2014

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

rm ~/.vimswap/* works for me here.

seeder commented Apr 7, 2017

for me , had to clear the .vimviews

can't believe this is still an issue

kai101 commented Apr 26, 2017

rm -f ~/.vimviews/* works for me.

2 tab indent for javascripts files with this in ~/.vimrc.local
autocmd Filetype javascript setlocal ts=2 sw=2 sts=2 expandtab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment