edit: Solution found! At the bottom of the post
I installed vim 8.1 via brew on macos Sierra yesterday, and I think that broke some of the filetype setting stuff. When I open a shell script, I get the following error:
Error detected while processing /usr/local/share/vim/vim81/scripts.vim:
line 69:
E117: Unknown function: dist#ft#SetFileTypeSH
The closest answer I could find was here, but I'm not using a session (and the error message is a little different)
I also see a different error if I put my cursor over a parenthesis in a vim script. I don't know if it's related:
Error detected while processing function <SNR>50_Highlight_Matching_Pair:
line 97:
E475: Invalid argument: 0
I tried disabling all my plugins (Just commented out the Vundle lines in my .vimrc and launched vim in a new shell), but it didn't seem to help.
runtimepath
looks ok, referencing /usr/local/share/vim/vim81
.
I'm not sure what to do next. It seems like that function (SetFileTypeSH) is missing from Vim 8.1.
A bit of extra background: I think I was using vim 8.1 last week without issue, but a macos update broke my brew links, so I had to reinstall it and tinker with some symlinks to make it work again. So the problem is probably related to that in some way, I just don't know what to do next to debug it.
Solution:
The problem was that the autoload directory ($VIM_INSTALL_PATH/vim81/autoload) was empty, so a bunch of scripts were missing.
Somehow the autoload directory was owned by root , and was not writable by group users. I solved it by uninstalling vim via brew (brew uninstall vim
), then deleting the vim81 directory manually (sudo rm -rf $VIM_INSTALL_PATH/vim81
), then reinstalled with brew. (brew install vim
), followed by re-linking (brew link vim
) to get it all working.
Seemed to fix the Highlight_Matching_Pair issue too!