All Projects → svermeulen → nvim-moonmaker

svermeulen / nvim-moonmaker

Licence: other
Moonscript plugin support for neovim

Programming Languages

lua
6591 projects
MoonScript
45 projects
Vim Script
2826 projects

Projects that are alternatives of or similar to nvim-moonmaker

lua-mailgun
Lua bindings to Mailgun HTTP API
Stars: ✭ 25 (-54.55%)
Mutual labels:  moonscript
docker-lapis
Dockerized Lapis
Stars: ✭ 20 (-63.64%)
Mutual labels:  moonscript
mpv-progressbar
A simple progress bar for mpv.
Stars: ✭ 106 (+92.73%)
Mutual labels:  moonscript
alfons
🚀 Task runner for Lua and MoonScript.
Stars: ✭ 17 (-69.09%)
Mutual labels:  moonscript
moonblob
Binary serialization for moonscript + LuaJIT
Stars: ✭ 22 (-60%)
Mutual labels:  moonscript
lua-twitter
A Lua twitter library that works with OpenResty or LuaSocket
Stars: ✭ 29 (-47.27%)
Mutual labels:  moonscript
lapis-bayes
Naive Bayes classifier for use in Lua
Stars: ✭ 26 (-52.73%)
Mutual labels:  moonscript
Moonscript
🌙 A language that compiles to Lua
Stars: ✭ 2,694 (+4798.18%)
Mutual labels:  moonscript
Lapis
A web framework for Lua and OpenResty written in MoonScript
Stars: ✭ 2,621 (+4665.45%)
Mutual labels:  moonscript
lapis-community
Pluggable message board for Lapis powered websites
Stars: ✭ 41 (-25.45%)
Mutual labels:  moonscript
demoloops
Toolkit for building looping gif "demos" and collection of such
Stars: ✭ 31 (-43.64%)
Mutual labels:  moonscript
Moonscriptxx
A standalone executable compiler for Moonscript. And much more. Moonscript++
Stars: ✭ 41 (-25.45%)
Mutual labels:  moonscript
Yuescript
A Moonscript dialect compiles to Lua.
Stars: ✭ 172 (+212.73%)
Mutual labels:  moonscript
razcal
Build cross platform desktop app with Lua, MoonScript, and Layout Language
Stars: ✭ 15 (-72.73%)
Mutual labels:  moonscript
alive
experimental livecoding environment with persistent expressions
Stars: ✭ 29 (-47.27%)
Mutual labels:  moonscript
ijitsuki
Aegisub 3+ moonscript macros
Stars: ✭ 19 (-65.45%)
Mutual labels:  moonscript

MoonMaker

This plugin adds support for writing moonscript plugins in Neovim

Install via vim-plug by adding this to your init.vim.

Plug 'svermeulen/nvim-moonmaker'

Then all you need to do is place .moon files in a 'moon' directory inside any plugin directory that is on the vim &runtimepath and they will automatically compiled and available to be loaded.

This follows the same convention that Vim uses for other file types. For example, if you place Foo.py inside a directory named 'python3' (underneath the root directory of your plugin) then it can be loaded by executing :python3 import Foo.

And similar rules apply to lua (that is, they are expected to be placed underneath a 'lua' directory). However, despite early plans to do so, direct MoonScript was never added to Neovim (hence this plugin).

So all this plugin really does is keep the lua directory in sync with the corresponding moon directory for every plugin on the runtimepath.

Compilation occurs at Neovim startup or whenever manually executed by one of the methods below. Note that it will only compile the moon files that are out of date (ie. those moon files with a greater file modification time then the corresponding lua file).

You can then use the lua require() method to lazily load and call your lua code from vim script or from other moonscript/lua files.

See here for an simple example.

After editting your moon files, you can update them manually by any of the following methods:

  • Calling the command :MoonCompile
  • Binding something to <plug>(MoonCompile) (eg: nmap <leader>cm <plug>(MoonCompile))
  • Calling moonmaker#compile() from VimL

After manually calling one of these, if any .moon files in any plugin directory are out of date, they will be compiled. The require cache for each updated lua file will also be cleared so that the next time you call require you will get the latest version.

More things to be aware of:

  • If you want to execute some moonscript code you can use the included :Moon command. For example: :Moon print('hello') or :Moon require('Foo').doThing!
  • When you are actually ready to distribute your plugin, you don't need to depend on this plugin, since you can just include the compiled lua files
  • You need to install moonscript for this to work. The moonc executable needs to be on the PATH.
  • If your plugin contains multiple moon files and you want to avoid polluting the root require path, you can put your moon files into subdirectories underneath the moon folder. Then you can use require("dir1.dir2.filename") to use them from other moonscript files
  • Make sure to place this plugin earlier in the list of plugins with whatever plugin manager you're using, so that the lua files will be compiled as soon as possible. This would be important if you're calling lua code during startup from one of your own plugins.
  • Currently only Neovim is supported however Vim support could be added too
  • If there are any lua files that do not have a corresponding moon file, a confirmation popup will be shown before it is deleted. You can also suppress this popup and always delete orphaned lua files by setting g:MoonMakerDeleteOrphanedLuaFiles to 1.
  • If you are using a custom moonscript compiler, you can set this using the g:MoonCompiler variable. Otherwise it will use moonc which is assumed to exist on the PATH
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].