{"id":13761203,"url":"https://github.com/jaawerth/fennel-nvim","last_synced_at":"2025-05-10T12:31:21.539Z","repository":{"id":72797662,"uuid":"160744323","full_name":"jaawerth/fennel-nvim","owner":"jaawerth","description":"running fennel-lang natively in neovim","archived":false,"fork":false,"pushed_at":"2020-07-14T17:01:22.000Z","size":106,"stargazers_count":77,"open_issues_count":4,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-03T13:06:14.087Z","etag":null,"topics":["fennel","lua","native","neovim"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaawerth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-12-06T23:15:21.000Z","updated_at":"2024-06-28T03:55:11.000Z","dependencies_parsed_at":"2023-02-25T13:30:20.345Z","dependency_job_id":null,"html_url":"https://github.com/jaawerth/fennel-nvim","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaawerth%2Ffennel-nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaawerth%2Ffennel-nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaawerth%2Ffennel-nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaawerth%2Ffennel-nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaawerth","download_url":"https://codeload.github.com/jaawerth/fennel-nvim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224958088,"owners_count":17398495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fennel","lua","native","neovim"],"created_at":"2024-08-03T13:01:43.337Z","updated_at":"2024-11-16T18:32:21.071Z","avatar_url":"https://github.com/jaawerth.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"# fennel-nvim [WIP]\n\n**Experimental** plugin adding native [fennel](https://fennel-lang.org) support to nvim by utilizing neovim's native Lua support. No RPC necessary!\n\nI will likely extend this in the future, but for now I'm just testing out the idea. It should be possible reach seamless integration with a little extra work.\n\nCurrently bundled with Fennel `0.4.0-dev`, from the current master branch as of\n[this commit](https://github.com/bakpakin/Fennel/tree/d3620b369a6d16f55f98d939a3b47b56d97b9f19).\n\nThis is basically just `0.3.0` with an extra docstring or two and better readline completion from the repl\n(which requires `readline.lua` to be installed and present on package.path).\nIn the future, I will switch this over to only bundling a full release, and allowing an option to easily supply a custom version.\n\n- [Install](#install)\n- [Fennel Environment](#fennel-environment)\n- [Usage](#usage)\n  - [init.fnl](#initfnl)\n  - [Commands](#commands)\n- [Neovim Lua Completion](#completion)\n- [Configuration](#configuration)\n\n## Install\n\nThe usual, either clone this repository to the plugin directory (or in nvim, somewhere on your `runtimepath`) or a plugin manager of your choice.\n\n```viml\nPlug 'jaawerth/fennel-nvim' \" using vim-plug\n```\n\n## Fennel Environment\n\nThis plugin runs your Fennel code under a custom environment which you can alter by passing, as a second argument\nto the functions below, an `env` table. It inherits from nvim's `_G`, so you will have access to all normal globals,\nincluding neovim's Lua API.\n\nIn addition to the above, for convenient it exposes the `fennelview` function/module as `view` for easy access.\n\n\n## Usage\n\nThe following allows you to run fennel code via Lua in neovim.\nFor the Lua API to manipulate neovim from Lua/Fennel, see `:help lua-vim`, `:help lua`, and `:help api`.\n\n### `init.fnl`\n\nSee `:help init.fnl`. This plugin, when installed on your `runtimepath`, will automatically look for an `init.fnl` file in your\nneovim configuration directories (see `:help xdg` and `:help stdpath`). On Linux, this defaults to `$HOME/.config/nvim/`.\n\nYou can disable this behavior as follows in your `init.vim`:\n\n```viml\nlet g:fennel_nvim_auto_init = v:false\n```\n\n### Commands\n\n#### Eval some Fennel: `Fnl`\n\n```viml\n:Fnl (doc doc)\n\" Output:\n\" (doc x)\n\"   Print the docstring and arglist for a function, macro, or special form.\n```\n\n**Note:** Unlike `:lua`, this will not work with heredoc (`\u003c\u003c`) syntax, as that is only available\nto built-in commands. This behavior may become available in the future when neovim implements `:here`\n(per [this issue](https://github.com/neovim/neovim/issues/7638)).\n\nUsing the `fnl#eval(code[, arg][, compileOpts])` function - like `luaeval()`, you can pass an argument,\nwhich will be bound to the magic global `_A` in the running environment.\n\n```viml\n:call fnl#eval('(print (.. \"Hello, \" _A \"!\"))', 'World')\n\" outputs: Hello, World!\n```\n\n#### Run a file: `FnlFile`\n\nWith `:FnlFile path/to/file.fnl` or simply use `FnlFile` to source `.fnl` files from `init.vim`\n\nFor example, if editing some fennel code you want to test in neovim itself,\n```viml\n:FnlFile %\n```\n\nSimilarly, you can use `fnl#eval(filepath[, compileOpts])`.\n\n#### Execute Fennel on a range of lines: `FnlDo`\n\nFennel analog to `luado` (see `:help luado`). Select/enter a range of lines (defaults to every line in the buffer)\nand the expressions you give it will be wrapped in a function, which is executed for every line, with `line, linenr` passed\nas named arguments.\n\n```viml\n\" print first 5 lines preceded by line #\n:1,5FnlDo (print linenr line)\n\" print the width of every line in file\n:FnlDo (print (string.format \"line %d is %d chars wide\" linenr (# line)))\n```\nCan be invoked as a range function with `\u003crange\u003ecall fnl#do(exprStr)` (see `:help call`).\n\nAlso available from Lua: `require('fennel-nvim').dolines(exprStr, firstline, lastline)`\n\n## Completion\nFor convenience, this module comes with a couple of functions that can be used with `omnifunc`. See `:help fennel-completion`.\nNote that this will only complete on globals and specials/macros currently, using Neovim's internal Lua/Fennel environment.\n\n## Configuration\n\n### `g:fennel_nvim_auto_init`\n\nSee `:help g:fennel_nvim_auto_init` for disabling auto-source of `init.fnl`\n\n### Disable automatic patching of package.loaders\n\nTo make `require` correctly find Fennel modules using `fennel.path`, `package.loaders` (or `package.searchers` in Lua 5.3 environments)\nis patched to include `fennel.searcher`. This also makes it possible to require Fennel modules from Lua (it will first look for a Lua\nmodule of the same name when requiring from Lua).\n\nThis is automatic, but can be disabled by setting `g:fennel_nvim_patch_searchers` to 0 or `v:false` before any Fennel is invoked.\n\nFrom `init.vim`:\n```viml\nlet g:fennel_nvim_patch_searchers = v:false\n```\n\n## Lua API\n**TODO:** Further document this API\nThe [fennel-nvim](lua/fennel-nvim.lua) Lua module offers an API you can use to eval/load/compile Lua.\n\n```lua\nlocal fnl = require('fennel-nvim')\n\nfnl.dofile('path/to/file.fnl')\n\n-- compile some Fennel into Lua for writing\nlocal compiledLua = fnl.compile('path/to/file.fnl')\n```\n\n### Automatic package.path --\u003e fennel.path sync\n\nBecause neovim sets `package.path` dynamically on the Lua side based on changes to the `runtimepath`\nsetting, I've implemented some code that syncs these changes over to `fennel.path`, replacing `?.lua`\nwith `?.fnl`, `/lua/?/init.lua` with `/fnl/?/init.fnl`, etc.\n\nThis behavior can be disabled before running any of the Fennel-executing Vim commands as follows:\n\n```lua\nlocal fnlNvim = require('fennel-nvim')\nfnlNvim.syncFennelPath = false -- disabling syncing\nfnlNvim.resetFennelPath() -- restore to state before sync\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaawerth%2Ffennel-nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaawerth%2Ffennel-nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaawerth%2Ffennel-nvim/lists"}