tpope / vim-commentary

commentary.vim: comment stuff out
http://www.vim.org/scripts/script.php?script_id=3695
5.9k stars 214 forks source link

Incompatibility with vim-fugitive, using dein #109

Closed CharlesGueunet closed 5 years ago

CharlesGueunet commented 5 years ago

Hello and first of all thanks for all your great work on vim !

I use dein as my package manager and I have found an issue concerning both vim-commentary and vim-fugitive. Fortunately, you are the author of both :)

If I add vim-commentary in my plugin list, then vim-fugitive is loaded but none of these functions are available (:Ggrep -> E492: Not an editor command: Ggrep).

I will try to investigate further when I have the time (and post more details here). If you have any idea of what could cause this issue, that could help me.

Thank again! Charles

tpope commented 5 years ago

You do have a file from a Git repository open, correct?

CharlesGueunet commented 5 years ago

Yes, with visible changes given by gitgutter.

tpope commented 5 years ago

Strange is an understatement. I don't have any great advice but my first step would be to check :scriptnames and make sure everything's there. You might also try rearranging the order of your dein declarations.

CharlesGueunet commented 5 years ago

I am still investigating here:

CharlesGueunet commented 5 years ago

This is due to a configuration I did for commentary (so my mistake !) Trying to define '# ' as the default commentstring, I had this line in an augroup:

autocmd BufNewFile,BufRead * if empty(&filetype) | setlocal commentstring=#\ %s 

Replacing it with:

autocmd BufNewFile,BufRead * if empty(&filetype) | setlocal commentstring=#\ %s | endif

solved my issue !

Thanks for your help :)

tpope commented 5 years ago

My personal solution:

setglobal commentstring=#\ %s
autocmd FileType c,cpp,cs,java setlocal commentstring=//\ %s