You are not logged in.

#1 2022-11-01 12:27:00

ignuthat
Member
Registered: 2022-03-23
Posts: 22

[Resolved] Vim not reflecting *some* .vimrc changes

I've been experiencing strange behavior in vim for over a week. In my ~/.vimrc are lines like:

set number
set tabstop=8 shiftwidth=8
autocmd FileType python setlocal et ts=4 sw=4
au BufNewFile,BufRead *.py setlocal tabstop=4 softtabstop=4 shiftwidth=4 expandtab autoindent fileformat=unix textwidth=79

When I change the values of these, or comment them out, most of them are not reflected when I open a file again in vim. I am quitting completely each time, and I've even deleted the file at ~/.vim/view, thinking it was caching some changes, but this doesn't fix anything. I will set shiftwidth to 8 for *.py files and for the python FileType, and it will still indent to 4 spaces.

The only way to get it to change is to type :set sw=8 when I'm editing the file. And then this change will persist even after I quit the file and open it again! It seems like it's preferencing some kind of cached settings over ~/.vimrc.

I've also tried taking out set number, which does nothing. However, if I don't include "colorscheme desert" in my ~/.vimrc, then all files will not have this colorscheme when opened. So this works! Same with syntax on.

I've also tried opening the file with vim --clean, which seemed to finally discard all of these changes. I didn't find much else out about this, though.

I thought maybe it was because I didn't reboot immediately after updating the kernel, so I tried that too, but this hasn't solved anything.

I know that ~/.vimrc is being sourced because it's there as the third file when running :scriptnames.

I'm out of ideas as to what could be causing this and how to fix it.

Edit: Oh, and I've tried :so ~/.vimrc after opening the file, but this doesn't bring in the changed settings either.

Edit 2: I'm using the GVim-provided Vim, and I'm on Sway.

Last edited by ignuthat (2022-11-01 13:25:10)

Offline

#2 2022-11-01 13:24:42

ignuthat
Member
Registered: 2022-03-23
Posts: 22

Re: [Resolved] Vim not reflecting *some* .vimrc changes

This was completely self-inflicted.

At some point, I ended up with these lines in my ~/.vimrc:

autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview

Removing them restores expected behavior. A good reminder not to include configurations you don't understand.

Offline

Board footer

Powered by FluxBB