Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
elclanrs opened this Issue · 12 comments
@elclanrs
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

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

@rogerbraun

What is the reason for this behaviour?

@spf13
Owner
@cskeeters

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.

@schickling

Same here. Still doesn't work for me.

@zzeroo

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

@webmaven

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

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:

shiftwidth=4
@orendon

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

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

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

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