preservim / vim-markdown

Markdown Vim Mode
4.7k stars 524 forks source link

NeoVim crashes when doing gx with cursor on link text #479

Open mawkler opened 4 years ago

mawkler commented 4 years ago

For a link that looks like this: [foo](http://www.example.com) when doing gx with the cursor on foo, Neovim prints the following and freezes:

:call <SNR>27_OpenUrlUnderCursor()

This is what the smallest I was able to boil down my init.vim and still keep the crash (if I remove anything else NeoVim doesn't crash):

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'joshdick/onedark.vim'
Plugin 'plasticboy/vim-markdown'
call vundle#end()
colorscheme onedark

This is what :version looks like:

NVIM v0.4.3
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.4.3/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info
krnl0138 commented 4 years ago

Can confirm the same issue with my setup. Though I have a lot of plugins turned on, but as I see above it may not be the case here.

$ nvim --version output

NVIM v0.4.3
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.4.3/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info
yamnikov-oleg commented 4 years ago

I did some debugging and it looks like it hangs on this line: https://github.com/plasticboy/vim-markdown/blob/master/ftplugin/markdown.vim#L546

The while loop in FindNextSyntax waits for 'mkdURL' syntax, but on my system it's called 'mkdUrl' so the loop never ends.

However I don't know how to fix this properly. So I've made a fork in which all mkdURL strings are replaced with mkdUrl: https://github.com/yamnikov-oleg/vim-markdown

mawkler commented 4 years ago

@yamnikov-oleg Who's fault is this incosistent spelling of 'mkdURL'/'mkdUrl'? Is it vim-markdown or is it the onedark colorscheme?

I feel like this could be easily fixed in with a small pull request but I'm not sure in which project.

joshdick commented 4 years ago

Quoted from https://github.com/joshdick/onedark.vim/issues/221#issuecomment-669014399:

It looks like vim-markdown expects mkdURL rather than mkdUrl based on this search, so I've updated onedark.vim accordingly in joshdick/onedark.vim#233; let me know if that has resolved the issue.

That said, it seems like this is ALSO a bug in vim-markdown; encountering an incorrectly-cased highlight group that it therefore seemingly shouldn't otherwise know or care about should not cause a hang.