tpope / vim-fugitive

fugitive.vim: A Git wrapper so awesome, it should be illegal
https://www.vim.org/scripts/script.php?script_id=2975
19.99k stars 1.01k forks source link

E117: Unknown function: FugitiveGitDir #1478

Closed vonum closed 4 years ago

vonum commented 4 years ago

The error message is shown when starting vim on mac os 10.15.2

Error detected while processing function fugitive#BlameSyntax[2]..fugitive#Config[1]..<SNR>26_Dir:
line    1:
E117: Unknown function: FugitiveGitDir

This is the list of plugins I have installed:

CamelCaseMotion                 vim-cucumber
MatchTag                        vim-elixir
Vundle.vim                      vim-elixir-alternative-files
ack.vim                         vim-endwise
ctrlp.vim                       vim-fugitive
emmet-vim                       vim-javascript
file-line                       vim-jsx
palenight.vim                   vim-markdown
supertab                        vim-projectionist
tabular                         vim-python-alternative-files
vim-airline                     vim-rails
vim-bdd                         vim-rake
vim-bufexplorer                 vim-repeat
vim-colorschemes                vim-surround
vim-commentary                  vimpyter

The functions like git blame, status, log, etc are working, but the message is shown every time i start mac vim.

vim --version output:

VIM - Vi IMproved 8.1 (2018 May 18, compiled Nov  9 2019 02:36:49)
Included patches: 1-503, 505-680, 682-1312
Compiled by root@apple.com
Normal version without GUI.  Features included (+) or not (-):
+acl               +extra_search      -mouse_netterm     -tag_old_static
-arabic            -farsi             +mouse_sgr         -tag_any_white
+autocmd           +file_in_path      -mouse_sysmouse    -tcl
+autochdir         +find_in_path      -mouse_urxvt       -termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
-balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
+builtin_terms     -gettext           +netbeans_intg     +textprop
+byte_offset       -hangul_input      +num64             +timers
+channel           +iconv             +packages          +title
+cindent           +insert_expand     +path_extra        -toolbar
-clientserver      +job               -perl              +user_commands
-clipboard         +jumplist          +persistent_undo   -vartabs
+cmdline_compl     -keymap            +postscript        +vertsplit
+cmdline_hist      +lambda            +printer           +virtualedit
+cmdline_info      -langmap           -profile           +visual
+comments          +libcall           +python/dyn        +visualextra
-conceal           +linebreak         -python3           +viminfo
+cryptv            +lispindent        +quickfix          +vreplace
+cscope            +listcmds          +reltime           +wildignore
+cursorbind        +localmap          -rightleft         +wildmenu
+cursorshape       -lua               +ruby/dyn          +windows
+dialog_con        +menu              +scrollbind        +writebackup
+diff              +mksession         +signs             -X11
+digraphs          +modify_fname      +smartindent       -xfontset
-dnd               +mouse             +startuptime       -xim
-ebcdic            -mouseshape        +statusline        -xpm
-emacs_tags        -mouse_dec         -sun_workshop      -xsmp
+eval              -mouse_gpm         +syntax            -xterm_clipboard
+ex_extra          -mouse_jsbterm     +tag_binary        -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv -framework Cocoa
tpope commented 4 years ago

Sounds like something is doing set syntax=fugitiveblame before Vim has finished loading. Does that ring any bells?

vonum commented 4 years ago

You are rigth. set filetype=fugitiveblame - this line triggers the error. However, it is after the part which loads plugins. This doesn't happen on ubuntu 18.04 where I also use the same dotfiles.

vimrc

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

Plugin 'vim-airline/vim-airline'
Plugin 'ervandew/supertab'
Plugin 'mileszs/ack.vim'
Plugin 'renderedtext/vim-bdd'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'tpope/vim-projectionist'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-rake'
Plugin 'tpope/vim-cucumber'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-endwise'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-commentary'
Plugin 'thisivan/vim-bufexplorer'
Plugin 'gregsexton/MatchTag'
Plugin 'kien/ctrlp.vim'
Plugin 'elixir-lang/vim-elixir'
Plugin 'renderedtext/vim-elixir-alternative-files'
Plugin 'vonum/vim-python-alternative-files'
Plugin 'bogado/file-line'
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
Plugin 'flazz/vim-colorschemes'
Plugin 'bkad/CamelCaseMotion'
Plugin 'drewtempelmeyer/palenight.vim'
Plugin 'szymonmaszke/vimpyter'
Plugin 'mattn/emmet-vim'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
filetype plugin on

source ~/.vim/mappings.vim
source ~/.vim/config.vim
source ~/.vim/plugins_config.vim

plugins_config.vim

" Autocompletion settings
let g:SuperTabDefaultCompletionType = "<c-n>"

" markdown configuration
let g:vim_markdown_folding_disabled = 1

" CTRL P
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)|deps|_build|vendor$'

" Ack vim
let g:ackprg = "ack -H --nocolor --nogroup --column --ignore-dir={vendor,.git}"

" Search word under cursor
" nnoremap F :Ack "\b<cword>\b" app lib spec features config<CR>

" Disable AutoComplPop.
let g:acp_enableAtStartup = 0

" Enable JSX syntax highlight in .js files
let g:jsx_ext_required = 0

" Tree view depth
let g:netrw_liststyle = 3

" Fugitive colors
set filetype=fugitiveblame

" Python syntax highlighting
let g:semshi#mark_selected_nodes = 0
let g:semshi#simplify_markup = 1
let g:semshi#excluded_hl_groups = ['local', 'unresolved']

let g:python_highlight_string_templates = 1
let g:python_highlight_indent_errors = 1
let g:python_highlight_class_vars = 1

Do you have an idea on what could be the problem? Or if there were some similar issues?

tpope commented 4 years ago

Setting the filetype during Vim startup is a nonsense operation. Stop doing it. It was broken then and broken now, the only difference is that it's now breaking noisily instead of silently.

axd1967 commented 3 years ago

same issue Ubuntu 18

when using 9871822dd537c05ad805859cc217e9a40647e863

Error detected while processing function fugitive#BlameFileType[3]..<SNR>12_Dir:
line    1:
E117: Unknown function: FugitiveGitDir

-V2 log:

finished sourcing $HOME/.vimrc
could not source ".exrc"
Searching for "pack/*/start/*" in "/home/alex/.vim,/var/lib/vim/addons,/etc/vim,/usr/share/vim/vimfiles,/usr/share/vim/vim81,/usr/share/vim/vimfiles/after,/etc/vim/after,/var/lib/vim/addons/after,/home/alex/.vim/after"
not found in 'packpath': "pack/*/start/*"
Searching for "plugin/**/*.vim" in "/home/alex/.vim,/var/lib/vim/addons,/etc/vim,/usr/share/vim/vimfiles,/usr/share/vim/vim81,/usr/share/vim/vimfiles/after,/etc/vim/after,/var/lib/vim/addons/after,/home/alex/.vim/after"
sourcing "/home/alex/.vim/plugin/vim-dirdiff/plugin/dirdiff.vim"
finished sourcing /home/alex/.vim/plugin/vim-dirdiff/plugin/dirdiff.vim
sourcing "/home/alex/.vim/plugin/vim-fugitive/autoload/fugitive.vim"
finished sourcing /home/alex/.vim/plugin/vim-fugitive/autoload/fugitive.vim
sourcing "/home/alex/.vim/plugin/vim-fugitive/ftdetect/fugitive.vim"
finished sourcing /home/alex/.vim/plugin/vim-fugitive/ftdetect/fugitive.vim
sourcing "/home/alex/.vim/plugin/vim-fugitive/ftplugin/fugitiveblame.vim"
Searching for "autoload/fugitive.vim" in "/home/alex/.vim,/var/lib/vim/addons,/etc/vim,/usr/share/vim/vimfiles,/usr/share/vim/vim81,/usr/share/vim/vimfiles/after,/etc/vim/after,/var/lib/vim/addons/after,/home/alex/.vim/after"
not found in 'runtimepath': "autoload/fugitive.vim"
Error detected while processing function fugitive#BlameFileType[3]..<SNR>10_Dir:
line    1:
E117: Unknown function: FugitiveGitDir
finished sourcing /home/alex/.vim/plugin/vim-fugitive/ftplugin/fugitiveblame.vim
sourcing "/home/alex/.vim/plugin/vim-fugitive/plugin/fugitive.vim"
finished sourcing /home/alex/.vim/plugin/vim-fugitive/plugin/fugitive.vim
sourcing "/home/alex/.vim/plugin/vim-fugitive/syntax/fugitive.vim"
Searching for "syntax/diff.vim" in "/home/alex/.vim,/var/lib/vim/addons,/etc/vim,/usr/share/vim/vimfiles,/usr/share/vim/vim81,/usr/share/vim/vimfiles/after,/etc/vim/after,/var/lib/vim/addons/after,/home/alex/.vim/after"
line 8: sourcing "/usr/share/vim/vim81/syntax/diff.vim"
finished sourcing /usr/share/vim/vim81/syntax/diff.vim
continuing in /home/alex/.vim/plugin/vim-fugitive/syntax/fugitive.vim
finished sourcing /home/alex/.vim/plugin/vim-fugitive/syntax/fugitive.vim
sourcing "/home/alex/.vim/plugin/vim-fugitive/syntax/fugitiveblame.vim"
finished sourcing /home/alex/.vim/plugin/vim-fugitive/syntax/fugitiveblame.vim
alex@xray:~/.vim$ tree -L 3
.
├── colors
│   └── alex.vim
├── plugin
│   ├── vim-dirdiff
│   │   ├── doc
│   │   ├── plugin
│   │   ├── README.md
│   │   ├── screenshot.png
│   │   └── vim-dirdiff.git
│   └── vim-fugitive
│       ├── autoload
│       ├── CONTRIBUTING.markdown
│       ├── doc
│       ├── ftdetect
│       ├── ftplugin
│       ├── plugin
│       ├── README.markdown
│       └── syntax
└── syntax
    └── mediawiki.vim

14 directories, 6 files

solution:

alex@xray:~/.vim$ tree -L 4
.
├── colors
│   └── alex.vim
├── pack
│   └── tpope
│       └── start
│           └── vim-fugitive
├── plugin
│   └── vim-dirdiff
│       ├── doc
│       │   └── dirdiff.txt
│       ├── plugin
│       │   └── dirdiff.vim
│       ├── README.md
│       ├── screenshot.png
│       └── vim-dirdiff.git
│           ├── branches
│           ├── config
│           ├── description
│           ├── HEAD
│           ├── hooks
│           ├── info
│           ├── objects
│           ├── packed-refs
│           └── refs
└── syntax
    └── mediawiki.vim

16 directories, 10 files
tpope commented 3 years ago

It's installed wrong. None of that stuff should be in .vim/plugin.

axd1967 commented 3 years ago

indeed - i moved it to pack. didn't know about this pack thing, not sure what's the difference with a plugin, I'll search. anyway, it seems to work now.