Warning
The Makefile and scripts use POSIX commands, so it doesn't work on Windows. I don't (or, rather, can't) use Windows, so a contribution on that regard would be very much welcome! ^^
Single Makefile is used to build the plugin. It's easy to read if you know the basics of Make.
Here's how you build the plugin:
make
# or
make clean build
This is where you put all your Fennel code. When you run make
, it compiles everything into lua/
directory.
All your macro files go into this folder.
All the wonderful scripts you'd like to reuse.
Project dependencies. This is mainly reserved for the fennel executable and nothing else, but you may repurpose it.
colors/
and after/
directories are used very rarely, and, thus, are not supported.
You only put loading code in colors/
and I've never in my life touched after/
.
Use :help
or :Telescope help_tags
to search for any function you'd want to use. NeoVim has quite a number of functions you may want to use.
Look into vim.tbl_*
functions and vim.iter
(NeoVim >=0.10), they're pretty useful!
Merging user config with default config
(local config {:some_setting 42})
(lambda setup [?user-config]
(let [user-config (or ?user-config {})]
(set M.config (vim.tbl_extend :force M.config user-config))))
Checking if at least one buffer is modified
(let [buffers (vim.api.nvim_list_bufs)
buffers-iter (vim.iter buffers)
any-buffer-modified? (buffers-iter:any #(vim.api.nvim_get_option_value :modified {:buf $2}))]
(if any-buffer-modified?
(print "At least one buffer is modified!")
(print "No buffers are modified.")))
Try to minimize the amount of dependencies you import yourself, because it's usually hard for Lua runtime to cache those dependencies consistently across multiple plugins.
I don't provide any support for libraries in this template, but you can easily modify the Makefile to your liking.