After emerging the vim editor I wanted it to properly indent my files. In the /etc/vim/vimrc file, it gives instructions to uncomment the following line to have indentation rules loaded based on the filetype. filetype indent on Setting that up does have it parse the $VIMRUNTIME/indent.vim file but it does not seem to go from there and parse the for example $VIMRUNTIME/indent/php.vim file. Reproducible: Always Steps to Reproduce: 1. emerge vim 2. uncomment 'filetype indent on' in /etc/vim/vimrc file 3. open a test.php script and start programming Actual Results: Does not indent and move braces as it should (does do any indentation rules at all) Expected Results: It should indent, move braces as typing, etc. Sort of like cindent does. (By the way "cindent" was failing too, I have to use "set cin!")
Created attachment 55244 [details] new indentation file for php Found if I replaced /usr/share/vim/vim63/indent/php.vim with this attached file (it's the newer version I got from vim website), then this issue goes away. I had only tested it on a php file, I did a quick check of another filetype and it seems to be working. Obviously I was mistaken and it does parse this file, I had put code in the old file just to test if it took affect and it didn't so I assumed the file was never loaded.
I'd prefer not to override upstream-provided vim-core stuff where possible, it gets very messy. You can install this kind of thing into ~/.vim/indent/ to override yourself. If you'd like this one included with the default vim runtime snapshot, it's best to ask upstream, although they don't tend to do major runtime changes during stable releases.
Thanks for this clear response. I'm beginning to understand how packages are built and why upstream is usually left in tact. I have a Fedora box as well and it has the same version of the indent file, yet it worked just fine. So I wasn't sure at first if this was an upstream thing. I do realize however that Fedora packages are sometimes heavily customized from the original upstream. I did not know you could override simply with ~/.vim/indent/ This is very useful information. Thank you. Too bad there wasn't a global equivalent for all the users. Thanks again for the info.
/usr/share/vim/vimfiles/indent is for all users. Still, if the vim-supplied file works with a Fedora vim, I'd expect it to work with ours... Neither of us modify vim too heavily. Do you have identical configuration on each?
At the start of this problem both boxes had identical ~/.vimrc files on an otherwise default vim installation. (Also have same ~/.vimrc file on an old RedHat 7.3 box). At first I could only get them to behave the same if I changed a line that forced cindent on files with php extensions. Gentoo needed "set cim!" while the other boxes worked fine with "set cindent". The original .vimrc file I used never tried the "filetype indent on" option (I didn't know about that until reading the /etc/vim/vimrc file on the gentoo box). I went back and tried it on the Fedora box and it worked without the newer indent/php.vim file but I now realize I still had not pulled out the set cindent from my .vimrc file. Removing that the behaviour is the same. So it appears the vim/indent/php.vim file in the default vim distro is faulty. It doesn't explain however why I needed to use set cim! in the gentoo config instead of set cindent though. I'm going to contact vim and let them know about the php.vim file needing updating. I've made a lot of changes to the different ~/.vimrc files on my systems as reading docs I've discovered a lot of my ~/.vimrc file is redundant or obsolete. If I set them both to use just have the line "filetype plugin indent on" then they both appear to run the same (ie php indentation broken).