I am trying to install the vim-grammarous plugin for Vim 8.0.1453. I have cloned the repo into my .vim/plugin directory.

Now every time I open Vim I get an error message which also occurs when I try to use the plugin.

Error detected while processing ~/.vim/plugin/vim-grammarous/autoload/grammarous.vim:
line    4:
E117: Unknown function: vital#grammarous#new
E15: Invalid expression: vital#grammarous#new()
line    5:
E121: Undefined variable: s:V
E15: Invalid expression: s:V.import('Web.XML')
line    6:
E121: Undefined variable: s:V
E15: Invalid expression: s:V.import('OptionParser')
line    7:
E121: Undefined variable: s:V
E15: Invalid expression: s:V.import('Process')
line  501:
E121: Undefined variable: s:O
E15: Invalid expression: s:O.new().on('--lang=VALUE', 'language to check', 
  {'default' : g:grammarous#default_lang}).on('--[no-]preview',  
   'enable auto preview', {'default' : 1}).on('--[no-]comments-only',  
   'check comment only',  {'default' : ''}).on('--[no-]move-to-first-error', 
   'move to first error', {'default' : g:grammarous#move_to_first_error}).on('--
    reinstall-languagetool',   'reinstall LanguageTool', {'default' : 0})
Press ENTER or type command to continue

How can I get vim-grammarous to work?


The .vim/plugin directory is not where you want to unpack your plug-ins! (Yes, I known the name would suggest so...)

If you want to use Vim 8 packages (which I believe you do), then you should unpack it under a directory named ~/.vim/pack/*/start, where the component after pack can be named anything (suggestions are bundle, vendor or your username.)

See :help packages for more information about Vim packages.

One alternative to Vim packages is to use a Vim plug-in manager to manage your plug-ins (they can load, install and update them.) If you decide to use a plug-in manager, I'd recommend vim-plug, which is simple to install (just download a single file), to configure and to use.

About the ~/.vim/plugin directory, that's a much simpler concept of plug-in and it simply includes Vim script files that are always unconditionally loaded by Vim on startup.

As Vim evolved, the need for Vim scripts that would loaded in different situations arose, and new directories were added for:

  • dynamically loaded Vim scripts, loaded when a function in that namespace is first called (autoload)
  • scripts that are loaded for files of specific types, for example code in specific languages (ftplugin)
  • scripts to detect what the type of a file should be, based on its extension or even file contents (ftdetect)
  • scripts implementing syntax highlighting (syntax) or indentation (indent) for a specific file type.

A "modern" Vim plug-in is in fact a package that will typically include Vim scripts split into one or more of these directories. (In fact, a large part of plug-ins will not even ship anything in the plugin directory, which means they typically don't incur any cost at Vim startup and only get loaded when they're used, either through a filetype or when an autoloaded function is invoked.)

Since the term plugin was already used, Vim 8 decided to call these "packages", but of course the common term for those is still a "Vim plug-in," which unfortunately causes this confusion.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.