rbong / vim-flog

A blazingly fast, stunningly beautiful, exceptionally powerful git branch viewer for Vim/Neovim.
750 stars 22 forks source link

E518: Unknown option: Add #61

Closed wookayin closed 2 years ago

wookayin commented 2 years ago

How to reproduce:

:Flog
:doautocmd FileType

Error:

Error detected while processing modelines:                                                                                    
line    2:
E518: Unknown option: Add 
TamaMcGlinn commented 2 years ago

Doesn't reproduce for me. Could you try with a minimal vimrc? E.g. vim -u ~/minimal.vimrc and strip everything but loading the flog plugin from that vimrc. Reading the documentation for doautocmd it seems this command should do nothing with a clean vimrc.

If it reproduces with a minimal vimrc, please also specify the (neo)vim version and commit of flog you are using.

wookayin commented 2 years ago

I figured out this is modeline command being executed. When the git log message contains some strings like vim: ..., it will be executed as a modeline command.

image

Therefore modeline should be disabled: setlocal nomodeline.

This also happens with the minimal vimrc only containing fugitive and vim-flog; I think even not with a minimal vimrc you should be able to reproduce this. FYI I was using nvim 0.6.0 nightly and nvim 0.5.1.

TamaMcGlinn commented 2 years ago

After several attempts I gave up trying to reproduce the actual bug, which requires a line in your git log that happens to exactly look like a C-style comment. In particular, I think this only triggers when the git log graph starts with two slashes, which can occur for the default ASCII style (there is also a prettier unicode version), but also requires that I make a bunch of parallel branches and I am too lazy for that.

However, the presence of the problem in Flog can be easily verified by opening a flog git log graph and asking vim set modeline? which should say 'nomodeline' since modelines are only ever useful in editable buffers. I've fixed the problem in PR 62 and rebased the commit to our common ancestor, so that Roger and I can both merge it without needing to rebase.

rbong commented 2 years ago

I believe this should be resolved... please let me know if it's still an issue.

wookayin commented 2 years ago

After several attempts I gave up trying to reproduce the actual bug, which requires a line in your git log that happens to exactly look like a C-style comment.

This is actually very easy: You can create an empty repository and create a commit with a commit message vim: ...

I think this only triggers when the git log graph starts with two slashes

I don't think so; for me, it was just the only very first commit. The line started with * 2021-MM-DD .... Modelines do not necessarily require C-style comments, but just the vim: .. string will be enough (see :help modeline)

BTW thanks for the fix. I can confirm the bug doesn't happen anymore.