Invalid range error #19

Closed
dvcrn opened this Issue Nov 21, 2016 · 5 comments

Projects

None yet

2 participants

@dvcrn
dvcrn commented Nov 21, 2016

I'm not sure if I did something wrong, but every time I try to generate the TOC or run :UpdateToc, I am getting this error:

2016-11-21 0 21 02

The TOC is still getting generated correctly, just this error appears. I am using silent! now to ignore the error. Any thoughts?

@mzlogin
Owner
mzlogin commented Nov 21, 2016 edited

Thanks for reporting.

I can't reproduct this error in lastest version of Vim or NeoVim. Would you please provide me your NeoVim version and one demo file with this error appears? Thanks a lot!

BTW: It seems that error may appears in some versions of Vim/NeoVim sometimes, see neovim/neovim#2600

@dvcrn
dvcrn commented Nov 21, 2016

I'm using NVIM 0.2.0-dev.

Minimal markdown:

<!-- vim-markdown-toc GFM -->
* [Tests](#tests)
  * [Another Tests](#another-tests)

<!-- vim-markdown-toc -->
# Tests
## Another Tests

Using :UpdateToc results in 2 range errors, one for each headline

@mzlogin mzlogin closed this in 1316665 Nov 21, 2016
@mzlogin
Owner
mzlogin commented Nov 21, 2016 edited

I've checked over your dotfiles, and do some test with it, finally found that it caused by set re=1 in https://github.com/dvcrn/dotfiles/blob/master/vim/style.vim#L27. The following line in my code does not compatible with old regexp engine.

let l:headingLink = substitute(l:headingLink, "[^[:alnum:]\u4e00-\u9fbf _-]", "", "g")

Seems old regexp engine cannot handle range \u4e00-\u9fbf, so I changed my code to let this substitute force automatic selection regexp engine. It works on my nvim 0.2.0-dev under Ubuntu with your dotfiles.

Please update the plugin and try again, feedbacks are welcome.

BTW: What makes you to set re=1? The new regexp engine would provide better performance in most cases. I think keep default configuration for this is good enough. For more details by command :h regexpengine and :h two-engines.

@dvcrn
dvcrn commented Nov 22, 2016

Oh that was fast, thank you! Going through my dotfiles is definitely not something every project maintainer would do!

I am setting set re=1 because of what the comment above it says:

" trial & error. These 3 lines seem to cause most of the performance problems I
" was experiencing. Adding these here reduces most of that rendering lag.

I was experiencing very annoying rendering lag and adding these 3 lines seemed to get rid of it. Since then I just left the settings in my config and didn't touch them

@mzlogin
Owner
mzlogin commented Nov 22, 2016

You are welcome! Hope your problem is resolved.

@mzlogin mzlogin added the bug label Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment