You are not logged in.

#1 2009-05-12 13:34:14

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

[Solved] Vim tabstop override not working through .vimrc

I'm getting to know Vim and am trying to set my tabstop settings in ~/.vimrc. I've added the lines below:

set autoindent        " always set autoindenting on
set tabstop=4 
set shiftwidth=4 
set noexpandtab
set softtabstop=4

Yet when i start Vim and type 'set tabstop' it still reports back 8, so the settings above apparently don't work. If i 'set tabstop=4' from within Vim it works fine, just only for the current session.

Other settings in .vimrc are read okay, so i don't think the problem lies there.

system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"

Any ideas?

Last edited by litemotiv (2009-05-20 14:28:36)


ᶘ ᵒᴥᵒᶅ

Offline

#2 2009-05-19 22:30:17

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] Vim tabstop override not working through .vimrc

Any chance it's a .virc / .vimrc / .gvimrc or /root/.virc etc. mismatch?
~/vi(m)rc doesn't work, but ~/.vi(m)rc does - mind the dot :-)

Offline

#3 2009-05-20 08:48:01

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Solved] Vim tabstop override not working through .vimrc

karol wrote:

Any chance it's a .virc / .vimrc / .gvimrc or /root/.virc etc. mismatch?
~/vi(m)rc doesn't work, but ~/.vi(m)rc does - mind the dot :-)

No i don't think so:

[ollie@arch ~]% ls .v*
.viminfo  .vimrc

I also have some other settings in the file like 'set number' and a colorscheme, that do get loaded..


ᶘ ᵒᴥᵒᶅ

Offline

#4 2009-05-20 09:44:28

rusty99
Member
Registered: 2009-03-18
Posts: 253

Re: [Solved] Vim tabstop override not working through .vimrc

You could try using setlocal with autocmd, ie

autocmd FileType text    setlocal textwidth=76 tabstop=4

Offline

#5 2009-05-20 10:25:19

Mr.Cat
Member
Registered: 2008-09-27
Posts: 79

Re: [Solved] Vim tabstop override not working through .vimrc

Does the `tabstop' have incorrect value for all file types?
Maybe it is overriden by a plugin?

Offline

#6 2009-05-20 11:15:56

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] Vim tabstop override not working through .vimrc

Remove your configs, start from a clean slate (or the defaults) and add your settings one-by-one.
I have a pretty much vanilla .virc and it just works.

Offline

#7 2009-05-20 14:27:48

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Solved] Vim tabstop override not working through .vimrc

got it! bit stoopid from my side i guess, i hadn't noticed my commands were placed:

if has("autocmd")

else 

<-- here -->

endif

thanks for the suggestions above, i'll mark this solved. smile


ᶘ ᵒᴥᵒᶅ

Offline

Board footer

Powered by FluxBB