RRethy / vim-illuminate

illuminate.vim - (Neo)Vim plugin for automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
2.16k stars 47 forks source link

Use `strcharpart` instead of list splicing for backwards compatibility #29

Closed RRethy closed 5 years ago

RRethy commented 5 years ago

As suggested in https://github.com/RRethy/vim-illuminate/pull/24#issuecomment-459327291, use strcharpart instead of list splicing to fix backwards compatibility issues with Vim versions older than 800.

I want this to be manually tested on an older version of Vim before getting merged, if someone tests it comment below. If there are no testers within a few weeks, I'll checkout an old Vim version and test it.

scottchiefbaker commented 5 years ago

On Vim 7.4.1099 on CentOS 7 I get:

"~/.vim/bundle/vim-illuminate/autoload/illuminate.vim" 137L, 3280C
Error detected while processing function illuminate#on_cursor_moved..<SNR>58_get_cur_word:
line    3:
E117: Unknown function: strcharpart
RRethy commented 5 years ago

Unlucky I would prefer using that. I switched to strpart from strcharpart since Vim7.4 has that function. I ended up ssh'ing into a server which has Vim7.4 installed to verify it works.