preservim / tagbar

Vim plugin that displays tags in a window, ordered by scope
https://preservim.github.io/tagbar
Other
6.11k stars 486 forks source link

"E706: Variable type mismatch for: val" on startup on Vim 7.4 #664

Closed claviola closed 3 years ago

claviola commented 3 years ago

Issue

Since a recent module update (via :PlugUpdate) I am getting the error in the title at startup time now:

E706: Variable type mismatch for: val

I've tried fiddling with g:tagbar_position to no avail.

Note that there's no such issue on another install with a newer version of Vim (vim 2:8.1.2269-1ubuntu5 on Ubuntu 20.04, "VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31) // Included patches: 1-2269")

Setup

Tagbar is loaded by vim-plug the standard way:

Plug 'majutsushi/tagbar'

Versions

I'm running Vim 7.4 on CentOS 7.6.1810 (RPM package is vim-enhanced-7.4.629-6.el7.x86_64)

vim --version output:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug  9 2019 03:17:15)                                                                                                                            
Included patches: 1-207, 209-629

Let me know if you need more info.

alerque commented 3 years ago

Hmm, I doubt there is any reason this can't support later VIM 7 series. I'm guessing something inadvertently slipped in because development was only done on VIM 8 / Neovim. Maybe @raven42 can guess what that was?

claviola commented 3 years ago

Sorry, I forgot to paste the full error!

Error detected while processing function <SNR>47_setup_options:
line   66:
E706: Variable type mismatch for: val
raven42 commented 3 years ago

This isn't a problem with the g:tagbar_position per se, but rather this just happens to be the first variable in the list that overloads the var variable as a different type. More of a change in behavior of vim where in 8.0 code it allows reusing a variable as a different type, where the 7.4 code doesn't like that.

Adding a unlet val after the call to s:init_var() seems to do the trick. I'll push up a fix shortly.