mg979 / vim-visual-multi

Multiple cursors plugin for vim/neovim
MIT License
4.22k stars 82 forks source link

v:vim_did_enter causes vim7.4 to error out #34

Closed antoinemadec closed 5 years ago

antoinemadec commented 5 years ago

Making progress on travis CI I stumble upon this issue:

#themes#init:
line    1:
E121: Undefined variable: v:vim_did_enter

The v:vim_did_enter was introduced in vim8 (Patch 7.4.1658), which is very recent. I grep-ed in my 20+ plugins and vim-visual-multi is the only one to use it.

Questions:

  1. can we do without this variable to allow vim 7.4 user to be able to use this plugin?
  2. if not, can we update the plugin to error out with a clear message if vim is too old?

Cheers, Antoine

mg979 commented 5 years ago

Replacing that with a variable that is initilalized in the VimEnter block would be trivial (I didn't know vim_did_enter was that recent), but it's not the only problem for 7.4 compatibility. As far as I know, lambdas were introduced in vim 8, and there are lambdas everywhere in the plugin. Support for 7.4 would require changes everywhere, I'm not saying it's not possible but right now it isn't. Is there a category of people that still uses 7.4 and not 8?

antoinemadec commented 5 years ago
Ubuntu LTS 16.04: vim 7.4.1689
Ubuntu LTS 18.04: vim 8.0.1453
Debian Jessie (oldstable): vim 7.4.488
Debian Stretch (stable): vim 8.0.0197
Debian Buster (testing): vim 8.1.0549

And that is for distros that are more like personal machine distros. In a work environment (RHEL, CentOs etc) it is very common to see vim 7.2.

If vim8 features are needed by this plugin, this is completely OK.

My point is that you should check the vim version at startup and print a warning/error if the version if not compatible with your plugin. Otherwise, when your plugin becomes popular, you will see a lot of people opening issues like this one.

What do you think?

mg979 commented 5 years ago

Ok, I don't think there is anything that requires vim 8. I'll have to convert those lambdas and test it in older vim versions. I'll do it later when the rest of the plugin is in a better shape. I still have to improve certain aspects and there are still bugs that pop up from time to time. It should be possible though to have it run in 7.4 or older.

mg979 commented 5 years ago

Current test branch should be compatible with vim 7.4.330 (anything before that will never work because matchaddpos() was introduced in that patch).