首页 > 解决方案 > Gvim/Git 插件错误 E492:不是编辑器命令:GitStatus

问题描述

首先,我认为这是我如何安装东西的问题,而不是包的问题。

在 Windows 上,我从https://github.com/WolfgangMehner/git-support下载了 Vim 的 Git 插件的 zip 文件

zip 文件名为 git-support-master.zip 并具有以下树:

git-support-master\doc
git-support-master\git-support
git-support-master\plugin
git-support-master\project
git-support-master\syntax
git-support-master\README.md

我的 $HOME 是 c:\Users\myuser,我有 c:\Users\myuser\vimfiles。

我将说明解释为意味着我应该能够提取 zip 文件,以便上述 zip 中的 doc 文件进入上面的 doc 目录。为此,我必须从路径中提取 put prune git-support-master。

~ vimfiles/
  ~ autoload/
      pathogen.vim
  ~ bundle/
    + delimitMate/
    + nerdtree/
  ~ doc/
      gitsupport.txt
      tags
  ~ git-support/
    ~ doc/
        ChangeLog
    ~ git-doc/
        commands.txt
        compile_changelog.lua
        help_topics.txt
    + rc/
      README.md
  + pack/typescript/start/typescript-vim/
  ~ plugin/
      git-support.vim
  ~ project/
      release.lua
  + syntax/
    README.md
    vimrc

我的 .vimrc 是:

execute pathogen#infect()
syntax on
filetype plugin indent on
set nocompatible
let $ORACLE_HOME='C:\app\oracle\product\12.1.0\client'
set expandtab


nmap <C-n> :NERDTreeToggle<CR>
set autoindent
set sw=4
set clipboard=unnamed
set nu
set noerrorbells
set nohlsearch
set vb t_vb=

"if $OSTYPE=="cygwin"
"    set SHELL=C:\programs\cygwin\bin\bash.exe
"endif
"
"let g:Git_Executable = 'LANG=en_US git'
let g:Git_Executable = 'C:\programs\cygwin\bin\git.exe'

当我在 git 菜单中运行时,我收到如下错误:

E492: Not an editor command: GitStatus

但是,它可以找到插件支持。

上面的 Git 可执行文件确实存在,是的,我正在使用它的 Cygwin 版本。

我运行了评论中提到的 scriptnames 命令,但无法在暂存缓冲区中捕获它,但确实看到它没有加载任何与 Git 插件相关的内容。它加载了 .vimrc,病原体 vim 插件。

我试过 :GitHelp 它给了我这个:

usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
   clone             Clone a repository into a new directory
   init              Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
   add               Add file contents to the index
   mv                Move or rename a file, a directory, or a symlink
   restore           Restore working tree files
   rm                Remove files from the working tree and from the index
   sparse-checkout   Initialize and modify the sparse-checkout

examine the history and state (see also: git help revisions)
   bisect            Use binary search to find the commit that introduced a bug
   diff              Show changes between commits, commit and working tree, etc
   grep              Print lines matching a pattern
   log               Show commit logs
   show              Show various types of objects
   status            Show the working tree status

grow, mark and tweak your common history
   branch            List, create, or delete branches
   commit            Record changes to the repository
   merge             Join two or more development histories together
   rebase            Reapply commits on top of another base tip
   reset             Reset current HEAD to the specified state
   switch            Switch branches
   tag               Create, list, delete or verify a tag object signed with GPG

collaborate (see also: git help workflows)
   fetch             Download objects and refs from another repository
   pull              Fetch from and integrate with another repository or a local branch
   push              Update remote refs along with associated objects

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system.

标签: gitvim

解决方案


您似乎正在混合三种不同的插件处理方法:

~ vimfiles/
  ~ autoload/
      pathogen.vim
  ~ bundle/

表明您正在使用 Pathogen,

+ pack/typescript/start/typescript-vim/

表明您正在使用新:help package功能,

我将说明解释为意味着我应该能够提取 zip 文件,以便上述 zip 中的 doc 文件进入上面的 doc 目录。为此,我必须从路径中提取 put prune git-support-master。

表明您正在尝试以“经典”方式安装该插件。

你应该选择一种方法并坚持下去……</p>

  • 经典方式被普遍认为是混乱的,所以你应该避免它。
  • 如果您只使用最近的 Vim,您可能应该将 Pathogen 视为已弃用,并选择新的“包”方法(如果您不介意自己管理插件)或像 vim-plug 这样的成熟插件管理器。

推荐阅读