Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/olical/nvim-local-fennel

Execute local Fennel Lisp files in Neovim upon startup
https://github.com/olical/nvim-local-fennel

fennel lisp lua neovim

Last synced: 7 days ago
JSON representation

Execute local Fennel Lisp files in Neovim upon startup

Awesome Lists containing this project

README

        

= nvim-local-fennel

____
This has been superseded! I now recommend installing https://github.com/Olical/nfnl[Olical/nfnl] and enabling the `exrc` option in order to have https://github.com/Olical/nfnl#directory-local-neovim-configuration-in-fennel[directory local Neovim configuration in Fennel].

Once you have nfnl and a `.nfnl.fnl` file at the root of your project you can write to `.nvim.fnl` and have `.nvim.lua` compiled for you automatically. This file is loaded by native Neovim with zero plugins provided you have `:set exrc` enabled.

This means even colleagues that don't have nfnl installed can use your directory local configuration. Consider this repo as essentially archived and superseded by this much smoother approach.
____

Run https://github.com/bakpakin/Fennel[Fennel] inside Neovim on startup with https://github.com/Olical/aniseed[Aniseed].

Add some Fennel code such as `(print "Hello, World!")` to a file named `.lnvim.fnl` in your current directory or anywhere above it such as your home directory. A file will be created beside the `.fnl` called `.lnvim.lua` which will be executed upon startup. Files higher up in your directory hierarchy, such as the home directory, will be executed before those found lower down, such as in a project.

Be sure to git ignore `.lnvim.fnl` _and_ `.lnvim.lua` if you don't want to share your local configuration with others. If you do want to share a `.lnvim.fnl` I'd recommend you ignore the `.lua` file to prevent duplicated changes in git commits.

Aniseed will only re-compile the Fennel code if it's changed since last time you opened Neovim. If you delete the `.lnvim.fnl` file then the `.lnvim.lua` file will be deleted automatically next time you launch Neovim to ensure you don't accidentally leave Lua files laying around.

== Installation

If you want interactive evaluation of the forms in your `.lnvim.fnl` file you can install https://github.com/Olical/conjure[Conjure] too.

=== https://github.com/wbthomason/packer.nvim[packer.nvim]

[source,lua]
----
use 'Olical/nvim-local-fennel'
use 'Olical/aniseed'
----

=== https://github.com/junegunn/vim-plug[vim-plug]

[source,viml]
----
Plug 'Olical/nvim-local-fennel'
Plug 'Olical/aniseed'
----

== Access to Aniseed

Aniseed is embedded under the `nvim-local-fennel.aniseed.*` module prefix, this means you can use Aniseed's macros and functions in your `.lnvim.fnl` files!

[source,clojure]
----
;; .lnvim.fnl
;; You can give the module any name you want.
(module my-local-fennel
{autoload {a nvim-local-fennel.aniseed.core
str nvim-local-fennel.aniseed.string
nvim nvim-local-fennel.aniseed.nvim}})

;; A hyphen suffix denotes a private function.
(defn- do-some-things [numbers]
(a.println
(nvim.fn.getcwd)
(a.map a.inc numbers)
{:Hello :Fennel!}))

;; Public value.
;; You could require this module and access it.
(def counting [1 2 3])

;; Executed as the file is loaded.
(do-some-things counting)
----

== Unlicenced

Find the full http://unlicense.org/[unlicense] in the `UNLICENSE` file, but here's a snippet.

____
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
____