6

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!

hoylemd
  • 163
  • 5

1 Answers1

2

If your 'runtimepath' is correct, then you seem to be missing the /usr/local/share/vim/vim81/autoload/dist/ft.vim file; it ships with Vim 8.1. Check the file system and reinstall if necessary.


That error in <SNR>50_Highlight_Matching_Pair seems to be in the matchparen++ plugin. I had submitted a patch for that problem to the author; you can download the fixed version 1.0.3 from vim.org.

Ingo Karkat
  • 17,819
  • 1
  • 45
  • 61
  • Ah-ha! You got it! the whole autoload directory is empty! I wonder why brew would leave that out.

    Huh, I didn't think I had that plugin, since I don't recognize the name. Could it be bundled with another plugin?

    Thanks for your help!

    – hoylemd Nov 15 '18 at 18:24
  • edit: Figured out the former. Somehow the autoload directory was owned by root , and was not writable by group users. I just uninstalled vim via brew, then sudo rm -rf'd the vim81 directory, then did brew install vim again, followed by brew link vim to get it all working.

    Seemed to fix the Highlight_Matching_Pair issue too!

    (adding this to main post too, for posterity)

    – hoylemd Nov 15 '18 at 18:30
  • Ah, then it was the matchparen plugin (note: no ++) that ships with Vim. – Ingo Karkat Nov 15 '18 at 19:49
  • This isn't working for me, but I need to use macvim instead of vim. I checked my runtime autoload and it's got stuff in it and nothing is owned by root. But I'm getting that error. It started after I ran brew upgrade. I even just tried :PlugClean, :PlugInstall, :PlugUpdate, which all worked. – Sigfried Jun 19 '20 at 15:28
  • Huh. I just figured out, I only have the problem when I open gvim with -S Session.vim. I guess I have to remake my million-tab-and-window session – Sigfried Jun 19 '20 at 15:30