Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does vim-illuminate require Vim 8.x? #23

Closed
scottchiefbaker opened this issue Sep 11, 2018 · 5 comments
Closed

Does vim-illuminate require Vim 8.x? #23

scottchiefbaker opened this issue Sep 11, 2018 · 5 comments

Comments

@scottchiefbaker
Copy link

I'm trying to run vim-illuminate on Vim 7.4x (CentOS 7) and I get this error:

"~/.vimrc" 270L, 9893C
Error detected while processing function illuminate#on_cursor_moved..<SNR>57_get_cur_word:
line    3:
E121: Undefined variable: l:col:

If I move to Vim 8.x I don't have any problems with the same config. I don't see anything in the docs about requiring 8 so I wasn't sure how to proceed.

@scottchiefbaker
Copy link
Author

For the time being I've worked around this in my .vimrc with

if version >= 800
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Highlight the word under the cursor
Plugin 'RRethy/vim-illuminate'
" Time in millis (default 250)
let g:Illuminate_delay = 250
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
endif

@RRethy
Copy link
Owner

RRethy commented Sep 11, 2018

It should work for previous versions of Vim. The Illuminate_delay is only available on Vim8 since it uses the timers features (I'll update the README so that's clear). I'm going to build an older version of Vim on my machine and do some testing.

@RRethy
Copy link
Owner

RRethy commented Sep 11, 2018

It seems to be a Vim bug in Vim7.4. I can't find any reference to it in online forums but the problem is that list splicing doesn't work when using a variable as the start.

To reproduce, in Vim7.4 try this:

:let col = 1
:let str = "abcd"
:echo str[col:]

It will error but it shouldn't. If you ran echo str[1:] it will not error, and if you run the three commands above in Vim8 or Neovim it will work fine.

I'll put out a check for the Vim version and default to an older way that I would get the current word under the cursor (although it is not as good, see #3). This will stop the error. Weird bug, I'd recommend using Vim8 if you can since it will match the word a lot better (again, see #3 for more info).

@RRethy RRethy closed this as completed in 9b78261 Sep 11, 2018
@scottchiefbaker
Copy link
Author

Whatever you did works for me on Vim 7.4.x now. Thank you!

@RRethy
Copy link
Owner

RRethy commented Feb 17, 2019

@scottchiefbaker Can you try looking #29 and checking out the branch to see if highlighting works in Vim 7.4.x, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants