I have the vim-fugitive plugin and use :G a lot. If I have NERDTree as a plug or netrw enabled then :G will open either a NERDTree file or a netrw file instead of the usual fugitive file with the current git status. I even tried in neovim to have nvim-tree and vim-fugitive together, which works better but prints out an error message every time:

Error executing lua callback: vim/shared.lua:0: s: expected string, got nil
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'validate'
        vim/shared.lua: in function 'startswith'

After pressing away this error message, fugitive works as expected. It seems that any file explorer is overriding fugitive commands. Is there anyway to fix this? One workaround is to map :G to :silent! G, but it seems there are deeper issues here.

  • Try :verbose command G
    – D. Ben Knoble
    Commented May 17, 2023 at 16:47
  • When in vim with vim-fugitive and NERDTree plugged it returns ! G ? . customlist,fugitive#Complete exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>), i.e. it points to the correct function, but all :G shows is a buffer of nerdtree filetype showing fugitive directories.
    – hilbor
    Commented May 17, 2023 at 17:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.