martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.27k stars 261 forks source link

lua: add <plugin>/init.lua to package.path #800

Closed ghost closed 4 years ago

ghost commented 4 years ago

This patch makes vis follow a Lua convention about modules, and also makes it easier to keep plugins up to date.

require'plugin'

will match both plugin.lua and plugin/init.lua.

Currently, most of the existing single-file plugins have the following structure - vis-plugin/plugin.lua, which is not a Lua convention or standard. One either has to

With this change, just cloning a repo and require-ing its name would be enough, and you get to use git-pull to check for any updates.

It doesn't harm the existing plugins in any way, AFAICT.

erf commented 4 years ago

@TmpFinger1 what do you think of a plugin manager like vim-plug for vis once we have some conventions? It could be a plugin in itself e.g. vis-plug and you'd describe your plugins in the visrc.lua file ( or elsewhere? ) and you'd be able to install and update plugins into a default folder e.g. $HOME/.config/vis/plugins, on startup or using a vis-install or vis-update command, which would use wget, curl or git on the list of plugins. We could default to github urls or use full urls for source. This might make it easier to setup an editor with third party plugins. Overkill?

EDIT: I've starting working on something, i'll share later

erf commented 4 years ago

Regarding my previous comment, i made a prototype for a vis plugin manager here: https://github.com/erf/vis-plug

It is very simple per now.. You configure a list of plugin paths before requiring the plug plugin, it will then automatically download and require the plugins upon start.

ghost commented 4 years ago

@erf I already have a "plugin manager" - https://repo.or.cz/vis-bundle.git I don't even use it.

martanne commented 4 years ago

Applied as b87a64ec90ced056b96b1833477bc3253f393531.